sciapp / gr

GR framework: a graphics library for visualisation applications
Other
329 stars 54 forks source link

Rotating polar plot coordinates? #168

Open rfritz opened 1 year ago

rfritz commented 1 year ago

Enhancement request

I recently tried using GR via Plots.jl to produce a polar plot of luminaire photometry. I was quite surprised to discover that there no way to change the polar coordinates used by GR. No matter what I did, 𝜃 = 0° was always at the right of the chart and type C photometry is usually presented with 𝜃 = 0° at the bottom.

So this is a request for the ability to rotate the axis of the polar graph.

Dan, over on the Julia Discourse board, provided a Julia function which made it work, and so I have graphs to present, showing what is currently supported and what I actually wanted.

What I could get from unmodified GR: image

What I wanted: image

jheinen commented 1 year ago

Thanks for the FR. We will support this with the next release.

AhmedSalih3d commented 1 year ago

First and foremost; @jheinen thank you for the great work you are putting into this library!

Can I ask if this has this been natively implemented?

I stumbled upon this today and was surprised I could not do it

Kind regards

jheinen commented 1 year ago

In GR.jl, you can now set an offset ("E", "N", "W", "S") and the direction (1, -1):

using GR
angles = LinRange(0, 2pi, 40)
radii = LinRange(0, 2, 40)
polar(angles, radii, theta_zero_location="S", theta_direction=-1)
Screenshot 2023-04-02 at 07 48 46
AhmedSalih3d commented 1 year ago

In GR.jl, you can now set an offset ("E", "N", "W", "S") and the direction (1, -1):

using GR
angles = LinRange(0, 2pi, 40)
radii = LinRange(0, 2, 40)
polar(angles, radii, theta_zero_location="S", theta_direction=-1)
Screenshot 2023-04-02 at 07 48 46

Thank you that is amazing! I suppose the issue can be closed then, seems to satisfy @rfritz original request?

As a side-note; how did you get such a pretty font in the plot / how would I do that?

Kind regards

jheinen commented 1 year ago

This is the default font in GR: Computer Modern

rfritz commented 1 year ago

That is marvelous news. Thank you!

On Sun, Apr 2, 2023 at 2:01 AM Josef Heinen @.***> wrote:

This is the default font in GR: Computer Modern https://en.wikipedia.org/wiki/Computer_Modern

— Reply to this email directly, view it on GitHub https://github.com/sciapp/gr/issues/168#issuecomment-1493271589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACDNUR7AG3XFTRC256A7BLW7E56HANCNFSM6AAAAAATKBJBBU . You are receiving this because you were mentioned.Message ID: @.***>

-- -- Randolph M. Fritz || @.***