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 polar plot and scatter recipes #1706

Closed
wants to merge 1 commit into from

Conversation

garrekstemo
Copy link

Description

Fixes # 521

I added two recipes for creating polar plots and scatter polar plots, following the plan posted in issue #521 by @asinghvi17. I understand (from other issues) that there is some inconsistency with how Attributes are used, so I wasn't sure what to do there and mostly followed other recipes. I also would like to remove the xy axes spines and decorations, but I have seen elsewhere that this is under consideration since recipes are apparently older than the Axis framework. I wasn't sure how to handle the docs, and I put the lines! plot and scatter! plot examples in the same .md file. The plots I include in the docs are attached to this PR.

As far as setting r-ticks and theta-ticks, does my solution look reasonable? I thought this in particular would need to be reviewed.

(This is my first PR (ever!), so please guide me if there's something I'm missing)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • Added an entry in NEWS.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

Images

polar(r, theta)

3polarplots

polarscatter(r, theta)
scatterplot

@juliohm
Copy link
Member

juliohm commented Feb 26, 2022

@garrekstemo any chance you could take this opportunity to also add a polar heatmap? Now that you have the concepts fresh in your mind, maybe it is easy to consider this plot as well?

@ffreyer
Copy link
Collaborator

ffreyer commented Feb 26, 2022

I think the way we would want to implement polar plots is by adding a transform function (https://github.com/JuliaPlots/Makie.jl/blob/f04ea93cde4384bad3f008bddf291a15ac35774a/src/layouting/transformation.jl) that converts polar to Cartesian coordinates. That way (r, \theta) inputs would work for any plot that uses that transform. Polar axis should probably be their own separate thing. I.e. we should have something like PolarAxis in analog to Axis so you can pick the layout you want.

@garrekstemo
Copy link
Author

OK, that makes a lot more sense and would be more generalizable. I'll close this PR and help out with transform functions where I can.

@adigitoleo
Copy link

I'm interested in something quite similar, I'd like to do azimuthal projections (e.g. Lambert equal-area). Are there any plot examples/recipes currently using the built in transformation mechanism? GeoMakie uses PROJ for transformations but I'd rather do it all in Julia. Obviously this would also be the case for the polar plots.

@asinghvi17
Copy link
Member

GeoMakie is now just a wrapper around Axis with some conveniences for projections, but does everything else using the Scene transformation interface, specifically scene.transformation.transform_func and defining Makie.apply_transform.

I have been meaning to make a sort of "NonlinearAxis" Block for a while but have been slowly iterating on how it might work and what changes would be desirable in Makie.

As of now it should be easy to simply feed a polar-to-cartesian converter to transform_func and possibly use the framework of this PR to draw gridlines. The only question then would be the logic of where and how to draw ticks...

@adigitoleo
Copy link

Thanks for the info, I should have checked more of the GeoMakie source. I'll try with transform_func, since I don't really need ticks for my case ("pole figures" of crystalline texture, Wikipedia, rust prototype) The contouring might get interesting. I don't expect this kind of plot in particular to be included in Makie core, but drawing the basic axis is similar to a polar plot. If NonlinearAxis is on the table, then I'll also mention stereographic plots in general. I can try to help with all of the above.

@adigitoleo
Copy link

I've started a thread over at discourse to discuss this. I'm also interested in doing Ternary plots, and can try to help with that as well later.

@adigitoleo
Copy link

#2014

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.

Polar axis plan
5 participants