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

DOC: document fmt_xdata, fmt_ydata, and fmt_zdata by tacaswell · Pull Request #25187 · matplotlib/matplotlib · GitHub

Repository navigation

DOC: document fmt_xdata, fmt_ydata, and fmt_zdata - #25187

Open
tacaswell wants to merge 6 commits into
matplotlib:mainfrom
tacaswell:doc/fmt_xydata
Open

tacaswell wants to merge 6 commits into
matplotlib:mainfrom
tacaswell:doc/fmt_xydata

Conversation

Copy link
Copy Markdown
Member

PR Summary

Closes #9593

This documents the exact call chain so we can leave the monkey patching route implicit ;)

tacaswell added this to the v3.8.0 milestone Feb 9, 2023
Comment thread doc/users/explain/interactive.rst Outdated

oscargus commented Feb 10, 2023 •
edited
Loading

Copy link
Copy Markdown
Member

Makes sense to add the same to

# func used to format z -- fall back on major formatters
self.fmt_zdata = None

?

This may just as well go in 3.7? (I guess it would if there was a 3.7-doc? Edit: no, not in 3.7-doc as it also changes the lib-files, but still...)

Comment thread lib/matplotlib/axes/_base.py Outdated
Comment thread doc/users/explain/interactive.rst Outdated
Comment thread doc/users/explain/interactive.rst Outdated
Comment thread doc/users/explain/interactive.rst Outdated

ksunden commented Mar 3, 2023

Copy link
Copy Markdown
Member

Do we want to get this in prior 3.7.1, which we are looking to tag today?

QuLogic modified the milestones: v3.7.1, v3.7.2 Mar 4, 2023
tacaswell changed the title DOC: document fmt_xdata and fmt_ydata DOC: document fmt_xdata, fmt_ydata, and fmt_zdata Mar 31, 2023
Comment thread lib/matplotlib/axes/_base.py Outdated
Comment thread lib/mpl_toolkits/mplot3d/axes3d.py Outdated

Copy link
Copy Markdown
Member

Just thought that I'd highlight #17286 as it is sort of related to this. At least the suggestion to rename this attribute and/or have setters/getters for it. Doesn't have to be a show stopper for this PR though.

QuLogic modified the milestones: v3.7.2, v3.7.3 Jul 5, 2023
QuLogic modified the milestones: v3.7.3, v3.8-doc Sep 6, 2023
story645 modified the milestones: v3.8-doc, v3.9-doc Jul 8, 2024
github-actions Bot added the Documentation: API files in lib/ and doc/api label May 16, 2025
tacaswell modified the milestones: v3.10-doc, v3.11.0 May 16, 2025

Copy link
Copy Markdown
Member Author

This can't get pulled back to the doc branch (it touches library code).

Comment thread lib/mpl_toolkits/mplot3d/axes3d.py Outdated

rcomer commented May 16, 2025

Copy link
Copy Markdown
Member

Recently we have documented other attributes using class level type hints (and we did backport one of these): #29965 #28825

Would it make sense to do that here too?

Copy link
Copy Markdown
Member

I'm a bit torn how to do this properly. The fundamental issue is that attributes are a dynamic concept and it's hard to attach meta information to them. Actually I don't like either approach: Class level type annotations are a bit awkward because we have otherwise pushed all typing to the stubs. OTOH I also don't like to create class attributes for documentation when we actually have instance attributes.

If I have to choose between those, I'd go for the type annotations, but YMMV.

Copy link
Copy Markdown
Member Author

If we have two other instances of using the typing style and @timhoffm prefers it, go with that method!

rcomer commented May 17, 2025

Copy link
Copy Markdown
Member

Oh it seems it doesn't work for 3D. Is that because we have not typed the module more generally?

Copy link
Copy Markdown
Member

Doc build failure due to

/home/circleci/project/doc/api/_as_gen/mpl_toolkits.mplot3d.axes3d.Axes3D.fmt_zdata.rst: WARNING: document isn't included in any toctree [toc.not_included]

But I don't really understand why this is the case.

QuLogic commented Sep 12, 2025

Copy link
Copy Markdown
Member

Comment thread doc/api/toolkits/mplot3d/axes3d.rst Outdated
Axes._shared_axes["z"] = cbook.Grouper()
Axes._shared_axes["view"] = cbook.Grouper()

fmt_zdata: Callable[[float], str] | None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Setting this to something seems to fix it, though again, not sure why it doesn't seem necessary on the others.

Suggested change
fmt_zdata: Callable[[float], str] | None
fmt_zdata: Callable[[float], str] | None = None

QuLogic Sep 12, 2025 •
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I just had an idea... Neither of these exist as attributes on the class:

>>> from matplotlib.axes import Axes
>>> Axes.fmt_xdata
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    Axes.fmt_xdata
AttributeError: type object 'Axes' has no attribute 'fmt_xdata'. Did you mean: 'format_xdata'?

>>> from mpl_toolkits.mplot3d.axes3d import Axes3D
>>> Axes3D.fmt_zdata
Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    Axes3D.fmt_zdata
AttributeError: type object 'Axes3D' has no attribute 'fmt_zdata'. Did you mean: 'format_zdata'?

and yet the former works.

But the difference between 2D and 3D Axes is the former has type stubs and the latter doesn't. Unfortunately, removing fmt_xdata/fmt_ydata from the _base.pyi type stub did not break the docs. So I still don't know why it doesn't work.

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: need discoverable documentation for Axes.fmt_xdata

9 participants


Back | FazBrowse Home | New Git URL