Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc]: Sphinx gallery links mispointed for Axes3D methods #28250

Open
scottshambaugh opened this issue May 17, 2024 · 5 comments · Fixed by sphinx-gallery/sphinx-gallery#1320

Comments

@scottshambaugh
Copy link
Contributor

scottshambaugh commented May 17, 2024

Documentation Link

https://matplotlib.org/devdocs/gallery/mplot3d/lines3d.html#sphx-glr-gallery-mplot3d-lines3d-py

Problem

The Axes3D methods which are automatically linked in example code in the docs all incorrectly point towards the Axes methods instead.

For example ax.plot here links to matplotlib.axes.Axes.plot instead of mpl_toolkits.mplot3d.axes3d.Axes3D.plot
image

Suggested improvement

Not sure if there's a way to type hint this in all the example code, or somehow make Sphinx recognize this.

@story645
Copy link
Member

story645 commented May 17, 2024

Hmm wonder changing the config to prefer full module names might work? https://sphinx-gallery.github.io/stable/configuration.html#resolving-module-paths

Far as I can tell we're not doing that right now
https://github.com/matplotlib/matplotlib/blob/main/doc%2Fconf.py#L252

@scottshambaugh
Copy link
Contributor Author

Good find @story645 I'll give that a shot!

@scottshambaugh
Copy link
Contributor Author

Did not work unfortunately

@story645
Copy link
Member

story645 commented May 27, 2024

So after I couldn't get any configuration to work, I went down the rabbit hole of trying to figure out how sphinx-gallery is parsing this and uh link to collab I'm not sure if it's parsing down to the chaining -> pandas doesn't use sphinx gallery and seaborn doesn't seem to have the code linking feature enabled.

Uh @larsoner any ideas?

@larsoner
Copy link
Contributor

Unfortunately not. It is a bit of a rabbit hole and I have to spend a lot of time to figure out why it does the wrong thing sometimes. In theory it should look at the __class__ of the instance and resolve mpl_toolkits.mplot3d.axes3d.Axes3D properly, not sure why it wouldn't. Maybe becaues of the mpl_toolkits namespace instead of matplotlib or something?

QuLogic added a commit to QuLogic/sphinx-gallery that referenced this issue Jun 3, 2024
Some registries may contain multiple modules (e.g., Python contains all
the standard library modules, or Matplotlib contains modules in the
`mpl_toolkits` namespace), and the previous lookup by the intersphinx
mapping _only_ could cause these to be missed. There was already some
special casing for Python, but this is now extended to all inventories,
fixing the case for Matplotlib as well.

Fixes matplotlib/matplotlib#28250
QuLogic added a commit to QuLogic/sphinx-gallery that referenced this issue Jun 3, 2024
Some registries may contain multiple modules (e.g., Python contains all
the standard library modules, or Matplotlib contains modules in the
`mpl_toolkits` namespace), and the previous lookup by the intersphinx
mapping _only_ could cause these to be missed. There was already some
special casing for Python, but this is now extended to all inventories,
fixing the case for Matplotlib as well.

Fixes matplotlib/matplotlib#28250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants