Skip to content

Inconsistent use of angle units (degrees vs radians) in polar axes #4986

Open

Description

@dww100

When making a polar plot the units used for input data are radians, however the axes produced for the plot are in degrees. This seems unnecessarily confusing. A short illustrative example is provided below:

import matplotlib.pyplot as plt
theta = [1.5, 3, 10, 90, 180]
r = range(1,6)
ax = plt.subplot(111,polar=True)
ax.scatter(theta,r)
plt.show()

polar-rad-deg-issue

This extends to the placing of axis labels etc, i.e. to move the r axis labels to the vertical grid line you use degrees:

ax.set_rgrids(r, angle = 90)

As mentioned to @jenshnielsen

Activity

  1. added
    API: default changes
    on Aug 25, 2015
  2. jenshnielsen commented on Aug 25, 2015

    @jenshnielsen
    Member

    Im not sure this is in scope for 2.0 but in the long run I think the issues in #4897 shows clearly that the unit system needs some work and this should include issues like this one IMHO

  3. modified the milestone: on May 29, 2016
  4. modified the milestones: , on Oct 3, 2017
  5. timhoffm commented on Feb 11, 2020

    @timhoffm
    Member

    This is really a mess. Radians/degrees seem to be chosen randomly:

    Radians:

    • internally used coordinates and given data points
    • positional arguments in set_thetalim
    • get/set_theta_offset

    Degrees:

    • keyword arguments in set_thetalim
    • get/set_thetamin/max
    • parameter offset in set_theta_zero_location
    • set_thetagrids

    I'm not even sure which API I would like to have. Does anybody have thoughts on this? Maybe we can then come up with a reasonable migration strategy, e.g. with warnings depending on data with typical ranges ~ -2pi:pi vs -360:360.

  6. modified the milestones: needs sorting, v3.3.0 on Feb 11, 2020
  7. jklymak commented on Feb 11, 2020

    @jklymak
    Member

    This is part of a "project", but I agree this API problem is pretty urgent!

    I would guess most folks would prefer degrees, but?

  8. anntzer commented on Feb 11, 2020

    @anntzer
    Contributor

    My personal preference would be for radians, because that matches what numpy uses basically everywhere (even in things such as np.unwrap, which are not bound by consistency with C functions (sin, cos, etc.)). Also it would be quite hard to really insulate the internals which for now are, well, using radians. OTOH I agree anything consistent, whether degrees everywhere or radians everywhere, would be nicer than the current mess.

  9. timhoffm commented on Feb 11, 2020

    @timhoffm
    Member

    I agree that changing everything to radians is technically simpler. The only concern I have here is that the axis is labelled in degrees, which would still be somewhat awkward.

  10. gewoondim1 commented on Feb 11, 2020

    @gewoondim1

    Would it be possible to "set" matplotlib to degree or radian mode?

  11. timhoffm commented on Feb 11, 2020

    @timhoffm
    Member

    Would it be possible to "set" matplotlib to degree or radian mode?

    AFAIR we've refrained from such approaches because of the added complexity. Also, it wouldn't make the interface more consistent unless you fully implement both versions, which is more work than even coercing to one choice of angles.

  12. 10 remaining items

  13. modified the milestones: v3.5.0, v3.6.0 on Sep 25, 2021
  14. modified the milestones: v3.6.0, v3.7.0 on Jul 8, 2022
  15. github-actions commented on Jan 29, 2024

    @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!

  16. added
    status: inactive
    on Jan 29, 2024
  17. added
    status: closed as inactive
    on Feb 29, 2024
  18. timhoffm commented on Feb 29, 2024

    @timhoffm
    Member

    IMHO this is fundamentally reasonable and we should keep it open in an aspirational sense. But unless someone is stepping up there’s likely no near-term action.

  19. added
    keep
    and removed
    status: closed as inactive
    on Feb 29, 2024
  20. removed
    status: inactive
    on Jun 2, 2025
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

    API: changeskeeptopic: polar

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions