-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: Add illustration to Figure.subplots_adjust #28844
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
Conversation
ffb36ba
to
f51037f
Compare
This is nice but same concern as previous one of these: most folks consume the api docs in IDEs and may be frustrated they cannot reach this. It'd be nice to work on a solution that allowed both the image and a link. |
Same answer: Link sounds nice but in a text-based renderer a usable realization is non-trivial. How should the link look like? Where should it point to? How would it be used? The plots I add are supplementary illustrations. You can get all information from the text. It think we have to accept that some interfaces to the docstrings are just less capable and cannost show illustrations / have links. - We also live with the fact that code links like |
It would take a new directive I suppose, but something like
which then either just display that in the rendered docs, or generated it from
would be fine too if sphinx allowed the image directive to use an html. That has a bootstrapping problem in that the example plot would need to be on stable, whereas a new directive that created the file and put in the right spot would be better (the absolute path would be ignored in rendering). |
I would support such a directive. As you said, there are a number of aspects to work out. Related: It may also be an idea to have a link in every API doc something like: "Online version: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.margins.html" at the bottom. With that one gets access not only to the image but cross-references, related examples etc. But all of this is off-topic. In this PR I'm just adding content, that is for now helpful in the HTML docs. Whether one can additionally find better representations in the raw docstring is orthogonal. Also, I believe it's helpful to start with the content. If we only need/have such images in one or two places, the work for a extension may not be justifed. But having already several plots can be a motivation for the extension. |
lib/matplotlib/figure.py
Outdated
The following plot illustrates the effect of the parameters: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following plot illustrates the effect of the parameters: |
Suggest you just remove this for now. It should be obvious what the plot is for, and is less distracting for folks who can't see the plot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
f51037f
to
a0d5f89
Compare
Feel free to self merge when build done |
Closes #23005.
Example: https://output.circle-artifacts.com/output/job/227e8182-1813-47e4-8cfc-1689902c5e28/artifacts/0/doc/build/html/api/_as_gen/matplotlib.figure.Figure.subplots_adjust.html#matplotlib.figure.Figure.subplots_adjust