Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the TernaryAxis code #11

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

asinghvi17
Copy link

@asinghvi17 asinghvi17 commented Feb 17, 2023

WIP. This aims to build the foundations for a ternary-axis layoutable, which can be directly plotted into.

The PR also has some other minor changes which I needed for my work.

There are 2 potential approaches to implementing this kind of thing:

  1. Plot everything in a true 3D scene, and set the camera such that what you can see is the x + y + z = 1 plane. Then, draw the axis around that.
  2. Extend what is done now, such that there is some nonlinear transformation which turns Point3f(x, y, z) into Point2f(u, v) (this is TernaryDiagrams.from_cart_to_bary). Then, following the method of GeoAxis, change the transform of the ternary axis' plots to this transform.

Both approaches will be somewhat technically challenging. Would appreciate any help!

@stelmo
Copy link
Owner

stelmo commented Feb 17, 2023

This is great! Thanks for the interest. I don't have time to make major changes now, but after mid-March my schedule opens up quite a bit. It is on my list :)

@stelmo
Copy link
Owner

stelmo commented Feb 17, 2023

But feel free to continue this PR, I will catch up with you next month!

@asinghvi17
Copy link
Author

Sounds good! This will be pretty slow burn in any case, as and when I get time for it :)

@asinghvi17 asinghvi17 changed the title Make a TernaryAxis layoutable Refactor the TernaryAxis code Feb 22, 2023
@asinghvi17
Copy link
Author

asinghvi17 commented Feb 22, 2023

ternary_cleaned
download-2

OK, so I hacked a bit on this and figured I should change the code first before doing anything else. This relies on Makie master for now but is otherwise just a refactoring of the ternary axis recipe.

It brings the ternary axis theme in line with the rest of Makie's axis themes, for later integration as a layoutable (Block). Here is a (brief) list of changes I've made:

  1. Arrows are now drawn by the new bracket! recipe, which maintains the correct rotation at all times.
  2. The theme has been changed to reflect the theme of e.g. Axis. As such, labelx -> xlabel, and all attributes are per individual label, not global to all labels in a TernaryAxis.
  3. The ticks have been changed - the grid and minor grid are now plotted separately, and may have separate colors as a result. These can be themed easily.

TODOs:

  • Get tick spacing/padding working correctly
  • Add tick marks
  • Get the spacing between the arrow and the axis to depend on the ticks' size + some scale factor
  • Let the bracket arrow be themable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants