FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

axes.format_{x,y} data should have a setter · Issue #17286 · matplotlib/matplotlib · GitHub

Repository navigation

axes.format_{x,y} data should have a setter #17286

Open

Description

In the Date tick labels example, the code for setting the cursor coords message overwrites the default formatters:

ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
ax.format_ydata = lambda x: '$%1.2f' % x  # format the price.

This creates confusion because runs counter to how basically everything else in matplotlib is set via setter but especially the formatters:

ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y'))

and the docs aren't especially clear either on this being a property:

Axes.format_xdata(self, x)

    Return x formatted as an x-value.

    This function will use the fmt_xdata attribute if it is not None, else will fall back on the xaxis major formatter.

To be consistent with the API, I'm proposing properties/functions of the form:

  • ax.{x,y}data_formatter(mdates.DateFormatter('%Y-%m-%d'))
  • ax.data_formatter(which=(x,y, both), mdates.DateFormatter('%Y-%m-%d'))

Activity

  1. added
    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …
    on Apr 30, 2020
  2. anntzer commented on Apr 30, 2020

    Contributor

    Really this should be called something like set_xcursor_formatter, data is just too vague.

  3. story645 commented on Apr 30, 2020

    MemberAuthor

    Agree, and should also steal from #16715 that it should take a str, callable, or mticker instance.

  4. story645 commented on May 4, 2020

    MemberAuthor

    And xref #9593 'cause fixing this issue should maybe help fix that one?

  5. added this to the v3.4.0 milestone on May 4, 2020
  6. modified the milestones: v3.4.0, v3.5.0 on Jan 27, 2021
  7. modified the milestones: v3.5.0, v3.6.0 on Sep 25, 2021
  8. modified the milestones: v3.6.0, v3.7.0 on Aug 24, 2022
  9. github-actions commented on Mar 30, 2026

    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!

  10. added
    keepItems to be ignored by the “Stale” Github Action
    on Mar 30, 2026
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: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …keepItems to be ignored by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL