feat(text): Allow mixed per-axis space like (:data, :relative)#5612
Open
jkrumbiegel wants to merge 6 commits into
Open
feat(text): Allow mixed per-axis space like (:data, :relative)#5612jkrumbiegel wants to merge 6 commits into
space like (:data, :relative)#5612jkrumbiegel wants to merge 6 commits into
Conversation
`space` may now be a tuple of symbols, with each entry applying to a single axis (axes not covered default to `:data`). This is the natural way to annotate `vlines`/`hlines`: use `(:data, :relative)` for a vertical line label or `(:pixel, :data)` for a horizontal line label without polluting the axis autolimits. The combiner takes the diagonal of each axis's projection matrix, so it is exact for orthographic axis-aligned cameras (the typical 2D `Axis`) and ignores rotation/perspective coupling. Closes #3038. Partial progress on #4407.
Collaborator
Benchmark ResultsSHA: 5d031bcaca3eec67b82f6ea40dba60cdaf6b2b2a Warning These results are subject to substantial noise because GitHub's CI runs on shared machines that are not ideally suited for benchmarking. |
Collaborator
|
I want to rework this. Specifically pull in and generalize the changes I made in #5556, which get rid of this weird And then:
|
Member
Author
|
Okay, sounds good. You can just continue this one if you want. I don't know enough about the internals anyway. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
spacecan now be a tuple of symbols, with each entry applying to a single axis (axes not covered default to:data). The natural use case is annotatingvlines/hlineswhere one coordinate is meaningful in data space and the other is most easily expressed as a fraction of the viewport (or a pixel offset). Mixed-space plots only contribute to axis autolimits on their:dataaxes, so a(:data, :relative)scatter dot at relative y=0.95 doesn't blow up the y limits.The implementation builds a per-axis combined projection matrix from each axis's individual matrix (taking the diagonal entry only), so it's exact for orthographic, axis-aligned cameras (the standard 2D
Axis) and ignores rotation/perspective coupling. The same path is used for bothtextandscatter(and any other plot whose positions go throughregister_camera_matrix!/register_positions_projected!).Example
Closes #3038. Partial progress on #4407 (covers the
(data, relative)style from the request, doesn't cover arithmetic composition likedata(123) + pixel(3)).Checks
@testset "mixed-space data_limits"inMakie/test/boundingboxes.jl— asserts which axes contribute todata_limitsforscatterandtextunder(:data, :relative),(:relative, :data),(:data, :pixel), plus homogeneous-tuple corner cases (12 assertions).@reference_test "mixed-space annotations"inReferenceTests/src/tests/text.jlcovering(:data, :relative),(:relative, :data),(:data, :pixel)with text + scatter on top of vline / hline.docs/src/reference/plots/text.mdwith the example shown above.spaceplots,Axis3, andspace = :relative-only plots are unchanged.