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

Add extension feature for plotting fields when nodes are provided #3715

Merged
merged 3 commits into from
Aug 17, 2024

Conversation

glwagner
Copy link
Member

I noticed that there was code in the grids tutorial that could benefit from this feature.

@navidcy
Copy link
Collaborator

navidcy commented Aug 16, 2024

Like which code? I mean what's an example that benefits from what changed here so I can test it to approve?

@glwagner
Copy link
Member Author

Like which code? I mean what's an example that benefits from what changed here so I can test it to approve?

This PR supports this kind of code:

c = Field{Center, Center, Nothing}(grid)
x, y, z = nodes(c)
heatmap(x, y, c)

The coordinates x, y can also be divided by a normalization (say 1000 to convert from m to km).

Copy link
Collaborator

@navidcy navidcy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! LGTM!

For future, we might wanna consider making this work:

c = CenterField(grid)
x, y, z = nodes(c)
heatmap(x, y, view(c, :, :, 1))

or

heatmap(x, z, view(c, :, 2, :))

@navidcy
Copy link
Collaborator

navidcy commented Aug 17, 2024

Great! LGTM!

For future, we might wanna consider making this work:

c = CenterField(grid)
x, y, z = nodes(c)
heatmap(x, y, view(c, :, :, 1))

or

heatmap(x, z, view(c, :, 2, :))

I take it back! What I suggested actually works!

@navidcy navidcy merged commit 088f973 into main Aug 17, 2024
46 checks passed
@glwagner
Copy link
Member Author

Great! LGTM!

For future, we might wanna consider making this work:

c = CenterField(grid)
x, y, z = nodes(c)
heatmap(x, y, view(c, :, :, 1))

or

heatmap(x, z, view(c, :, 2, :))

This PR supports this syntax I thought

@glwagner
Copy link
Member Author

glwagner commented Aug 19, 2024

Ah yeah. I didn't put view in the example just to keep it simple but the point of all of this is to support all fields. view returns a Field so should be supported.

@glwagner glwagner deleted the glw/more-makie branch August 19, 2024 15:45
jagoosw added a commit that referenced this pull request Aug 22, 2024
Patch release including bug fix for biogeochemistry fallbacks (#3685), `mask_immersed_field!` method for `BinaryOperations` (#3683), restricting lat/lon grid topologies (#3694), and more Makie recipe components (#3715).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants