Skip to content

Interactive features in polar plots #1700

Open

Description

@aestrivex

For polar axes, set_xlim and set_ylim behave completely differently than on rectangular coordinate systems. One unfortunate consequence of this is that panning and zooming on polar plots doesn't really make much sense.

When I figured out this was an issue, I set out to try to create my own callbacks to add zooming functionality to my application. As it turns out, the inability of polar axes to support zooming goes quite a bit deeper.

It would be really nice if the polar axes had zoom and pan tools that do what you intuitively expect -- e.g. treating the x and y coordinates as though they belonged a rectangular axis with polar data. This would be extremely helpful for the application I am building which relies partly on displaying very large polar plots that the user needs to be able to zoom in to see what is going on and read text. It might be so important that I will hack it myself, I'm not sure.

Activity

  1. pelson commented on Jan 25, 2013

    @pelson
    Member

    Firstly, thanks @aestrivex - it's something which has bothered me in the past too.

    I'm not sure how embedded this limitation is into Polar and hence I am concerned as to whether you will be able to achieve this functionality without breaking backwards compatibility on several fronts. I'd encourage you to play with this though.

    Something which you will find useful is to look at a cartopy plot which implements this kind of functionality for its map plots. If you have a linux based machine I'd have a look at that to see what is going on. Example code to see the plot, and then zoom/pan with it:

    import matplotlib.pyplot as plt
    import cartopy.crs as ccrs
    import cartopy
    
    ax = plt.axes(projection=ccrs.Stereographic())
    ax.add_feature(cartopy.feature.LAND)
    ax.add_feature(cartopy.feature.OCEAN)
    ax.add_feature(cartopy.feature.COASTLINE)
    ax.gridlines()
    
    plt.show()
    

    bendy_shape

    If you want to talk through what's going on, feel free to use the mpl-dev mailing list and prefix the subject with "Cartopy: ". I'll be away for a week as of tomorrow, but I'll be able to help when I get back.

    Cheers,

  2. fariza commented on May 5, 2014

    @fariza
    Member

    @pelson @aestrivex
    A little bit late (a year is little right?)

    For the MEP22 I have been playing with the Axes3D zoom and pan actions.
    Polar is not 3D but is similar in that they both require special treatment.

    With the Navigation class and the Tools classes I have tried to address the problem of untangling the Toolbar from the actions (PR #2759).

    I was looking at the code, but the pyplot stuff is too much of a mess for me to understand clearly what a polar Axes is.

    • Is it just a regular Axes?
    • Is it another class based in Axes like Axes3D?

    If you could point me in the right direction, I can modify the Zoom and Pan tools to work with polar plots.

  3. fariza commented on May 5, 2014

    @fariza
    Member

    Ups...
    After hitting Comment I found the polar implementation of start_pan, end_pan and drag_pan.

    It didn't work for me on the examples, because I was trying with the Pan and button 1, it only works on Pan and button 3.

  4. efiring commented on May 6, 2014

    @efiring
    Member

    I think they are not very useful. In my opinion, when a projection is used, zooming and panning should work in the Cartesian display space (with the aspect ratio held constant), not in the r, theta coordinates, for example. I doubt anyone has actually found radial panning to be particularly helpful, and what it does accomplish could be done equally well by a more general zoom and pan. Similarly, there is no reason why one should not be able to do a zoom to rect on a polar or other projection. The hard part is figuring out how to handle grid lines and tick labels.

  5. aestrivex commented on May 6, 2014

    @aestrivex
    Author

    When I looked at this previously (I am not very familiar with the matplotlib codebase and was even less so a year ago), there appeared to be no real way to do what I wanted. From my pretty inexact understanding, polar axes are a type of 2Daxes (not anything like 3Daxes afaik) in which the x-values are actually theta-values, y-values are actually r-values and in many places in the code transformations are provided to do the right thing. The flow of execution is very complicated and because I didn't know what I was doing I came away with the conclusion that in order to implement the right thing, it would be easier to start from scratch with a new projection type (which is probably not correct).

    If we can implement something that works, though, I'd use it.

  6. modified the milestones: , on Oct 3, 2017
  7. erkantan commented on Apr 24, 2020

    @erkantan

    Is there any development for the feature? or another solution? @tacaswell @story645

  8. github-actions commented on Feb 28, 2023

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  9. added
    status: inactive
    on Feb 28, 2023
  10. added
    status: closed as inactive
    on May 30, 2023
  11. emdiet commented on May 8, 2024

    @emdiet

    If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment

    Leaving a comment :)

    I've found polar plots to be super useful in exploring LLM embeddings. While I understand that this might be a sort of niche thing, I'd still like enter into the record that even in 2024 there still exists an (albeit itinerant) interest in this feature.

    The unfortunate reality though is that it's so much easier nowadays for everyone to roll their own than to contribute to this amazing lib. :(

  12. removed
    status: inactive
    status: closed as inactive
    on May 8, 2024
  13. reopened this on May 8, 2024
  14. added
    keep
    on May 8, 2024
  15. story645 commented on May 8, 2024

    @story645
    Member

    The unfortunate reality though is that it's so much easier nowadays for everyone to roll their own than to contribute to this amazing lib.

    Can you please say more about why you feel this way? Not cause I think you're wrong, but cause I'm interested in what we can do to make contributing easier. And you can reach out privately on any of our comms channels if there are things you're not comfortable saying in public.

  16. story645 commented on May 8, 2024

    @story645
    Member

    The unfortunate reality though is that it's so much easier nowadays for everyone to roll their own than to contribute to this amazing lib.

    Can you please say more about why you feel this way? Not cause I think you're wrong, but cause I'm interested in what we can do to make contributing easier.

    As for this issue, I'll put it on the call and see if folks can unpack what's the difficulty with it.

  17. asmwarrior commented on Aug 1, 2024

    @asmwarrior

    This is the related discussion about how to pan or zoom in the polar axis, there are several workaround methods, see the answers in that post:

    https://stackoverflow.com/questions/78819087/how-to-use-mouse-left-button-drag-to-pan-on-matplotlibs-polar-coordinate-axis/78819533#78819533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featurekeeptopic: polar

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions