You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Document how to write a References section in examples #19232
However this is more like a hack with several drawbacks, which is why I'm a bit hesitant to document it as the recommended solution
You need to put import matplotlib in
You get the Out[] line.
You have to mention pyplot as well as Axes to get references in both docs.
Also, I had the impression that this way of writing code and let sphinx gallery discover it does not always work, but I cannot point at an example right now.
The good solution would be to write a sphinx directive
###############################################################################
#
# .. admonition:: References
#
# The use of the following functions, methods, classes and modules is shown
# in this example:
#
# - `matplotlib.axes.Axes.fill` / `matplotlib.pyplot.fill`
# - `matplotlib.axes.Axes.axis` / `matplotlib.pyplot.axis`
Activity
ianhi commentedon Jan 4, 2021
I think ideally there would be a
minigallerydefined by the example. Though im not sure sphinx-gallery supports that.rajpratyush commentedon Mar 16, 2021
@timhoffm does this issue needs work?
timhoffm commentedon Mar 16, 2021
Yes it does.
There are multiple things to do here:
The trivial thing would be to just write down what we're currently doing. See, e.g. https://matplotlib.org/devdocs/gallery/lines_bars_and_markers/fill.html#references.
However this is more like a hack with several drawbacks, which is why I'm a bit hesitant to document it as the recommended solution
import matplotlibinOut[]line.pyplotas well asAxesto get references in both docs.Also, I had the impression that this way of writing code and let sphinx gallery discover it does not always work, but I cannot point at an example right now.
The good solution would be to write a sphinx directive
That'd possibly be need to be done upstream in sphinx-gallery.
timhoffm commentedon Mar 25, 2021
Proposal: Switch to
Which results in
This works without defining any new directives.
For comparison: Current look
Document how to create sphinx-gallery references to examples