-
-
Notifications
You must be signed in to change notification settings - Fork 361
Only apply axis/scene transformations to :data space plots #2436
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
Conversation
| Apply the data transform func to the data if the space matches one | ||
| of the the transformation spaces (currently only :data is transformed) | ||
| """ | ||
| apply_transform(f, data, space) = space == :data ? apply_transform(f, data) : data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to point it out - this might need to be copy(data) if there are any mutating operations done on the output. I don't think there are, since we generally go through observables which create copies, but I thought I'd mention it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The identity transforms make a point of returning data (or x) directly (and verifies that by checking === in one of the test cases), so that behavior was mirrored here. I would think any issues with mutating the data would quickly show up in that regard. Let me know if you think this needs any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I did that at the time because I thought the overhead of copying was unnecessary. And because I didn't see the need for mutation afterwards, but still one should be careful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a change (documentation note maybe?) or test you would like to insert here to make sure this stays consistent in the future?
78829df to
214ae10
Compare
|
I spotted a few other places in GLMakie.jl where I wasn't wrapping the space observable in a map. (When I was testing locally, this initially caused the log10 heatmap reference image to fail before I fixed it.) The other cases are in |
b6994a3 to
0bdba06
Compare
|
Okay, I fixed the other cases... GLMakie.jl passes tests locally. |
|
Should we make this non breaking by having |
|
Is |
|
It's used in other packages, e.g. GeoMakie 🤷 |
|
Hm ok maybe it's the path of least resistance then? |
|
Yeah would be nice to not break GeoMakie if it's so easy to avoid... |
|
This shouldn't break anything. All the other spaces should exclude transformation function by definition. |
|
The breaking change is that |
Both exist. For implementing new functions you'd still extend the 2 argument version, but for usage it should generally be the 3 argument version. |
|
Jeez, you're right... I really need to up my github diff reading game ;) @dgleich, could you add a minimal test plot to: https://github.com/MakieOrg/Makie.jl/blob/master/ReferenceTests/src/tests/short_tests.jl#L247, which now works with your changes? Just add a block like: @reference_test "array of rects poly" begin
plot_that_looks_correct_now(...)
end |
0e0b330 to
c3e0b22
Compare
|
@SimonDanisch Added! Was going to inquire if you wanted something like that too :) |
|
@SimonDanisch That's what I get on the current master. With the updates, it should look like this |
|
This is the picture the CI created from the current run... And if I check out the PR locally, I get the same... How did you produce the picture? |
|
Hmm... the CairoMakie images I downloaded here look okay and ran okay locally... https://github.com/MakieOrg/Makie.jl/actions/runs/3565833787 It looks like something changed in GLMakie.jl -- let me take a quick look. |
|
Okay, tests are useful :) The poly command for GLMakie.jl is the one that gives the problem. (This works with lines and scatter...) I'm still debugging. |
|
In CairoMakie, |
|
Found the issue -- I can work around this. (e.g. the routines that did work pulled out the space attribute before connect_camera.) Is |
|
Okay, new code passes the simple test. I added another test that tries to plot an image into a transformed axis with pixel... it fails on master and works with the new code (yay!) |
c6e0aa4 to
1c05c40
Compare
1c05c40 to
6fee016
Compare
|
Looking at fixing it now. I think I had a tiny typo in the new test and I’m
being more careful with the final edits.
…On Tue, Nov 29, 2022 at 08:46 Simon ***@***.***> wrote:
Ok, this looks good now:
[image: image]
<https://user-images.githubusercontent.com/1010467/204545295-cb2f8d5b-2b5d-45e4-95ad-c4253f77309d.png>
I think we should be able to merge this if CI runs through with the new
reference image :)
—
Reply to this email directly, view it on GitHub
<#2436 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAIJS55K6TFDJMWNFL7A5TWKYCLLANCNFSM6AAAAAASIJQXMA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
6fee016 to
55cdc0f
Compare
|
Okay, I fixed the typo which passes GLMakie.jl tests locally. |
|
But CairoMakie.jl fails on saving the resulting figure -- I'm just going to remove that extra test with images. |
and fix for GLMakie plot
55cdc0f to
d200c0a
Compare
|
Great :) Thanks for hanging in there and pushing this through! ;) |
|
Okay -- I was again too hasty! Turns out the CairoMakie failure is related to this request. Let me see if I can fix that one up too... The existing code here: should also check if we are doing pixel-space plots... |
|
Alright, I think fixing that issue with CairoMakie.jl is going to end up related-to-but-really-disconnected from this issue/pull request. e.g. the current non-fast path doesn't work in CairoMakie.jl so I'm going to open a separate issue to resolve those. e.g. the following code (with no transforms) fails... Does that seem okay to try and merge the current one and defer the other one into a separate issue? |
|
Sounds good to me! |
|
Anything else that I should change on this one? Do I need to re-request a review due to the new changes? |
…2436) * Only apply axis/scene transformations to :data space plots * Add test for pixel space plots in transformed axis, and fix for GLMakie plot Co-authored-by: Simon <sdanisch@protonmail.com>



Description
Fixes #2424 Fixes #2065
This PR adjusts the behavior of the axis/scene transformations to only apply to plots in the :data space.
Notes
Examined and editing almost all places where "apply_transform" was used to switch to the new three parameter version suggested in #2065.
There were some places where the existing behavior was left. This is due to a quick survey of the surrounding logic suggesting that the existing code assumes things are transformed. Places where this happens:
NO CHANGE src/basic_recipes/hvspan.jl:_apply_x_transform(t::Tuple, v) = apply_transform(t[1], v)
NO CHANGE src/basic_recipes/hvspan.jl:_apply_y_transform(t::Tuple, v) = apply_transform(t[2], v)
NO CHANGE src/layouting/data_limits.jl: point_t = apply_transform(trans_func, point)
NO CHANGE src/layouting/data_limits.jl: (to_ndim(Point3f, project(model, apply_transform(trans_func, point)), 0f0) for point in points)
NO CHANGE src/makielayout/blocks/axis.jl: tlims = Makie.apply_transform(t, lims)
Type of change
Checklist