-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add reference section to all statistics examples #19231
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
Three other thoughts:
|
This is very welcome. We just haven't gotten around to doing every example yet and have been counting on people just adding them as needed. |
👍
There's quite some redundancy in some areas of the examples; I guess for historic reasons. More and more examples were added and it was not always checked if this adds something new or if there should have been some rearrangement. A bit consolidation would be good. But that's also a tedious process. One has to find out what the core message of each example is and if that's already explained in another example. If you see something that is duplicate or if some examples could be merged easily, you're welcome to open a PR.
Yes definitively. The references are value in particular because of the backlinks from the functions to the examples. But choosing the relevant references must be done manually. |
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.
Generally, we add the corresponding pyplot functions as well, even if they are not used. See e.g. https://51381-1385122-gh.circle-artifacts.com/0/doc/build/html/gallery/statistics/barchart_demo.html#sphx-glr-gallery-statistics-barchart-demo-py
This is quite a crutch, but the only way, that the pyplot functions get to show the examples as well.
# The use of the following functions and methods is shown in this example: | ||
|
||
import matplotlib | ||
matplotlib.transforms.Affine2D |
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.
I'd add matplotlib.patches.Ellipse
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.
good point. Although it seems that the backlinking does not work for classes like Ellipse
or Affine2D
. See https://51381-1385122-gh.circle-artifacts.com/0/doc/build/html/api/transformations.html#matplotlib.transforms.Affine2D where this example is not linked to :(
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.
I added that the Ellipse in the latest push, though the issue with it rendering will remain I suppose
Ideally this could be automated to catch both |
Done |
the example does not demonstrate these things
Unfortunately this is all very manual: We're tuning our content so that sphinx-gallery does "the right thing". But sphinx-gallery does not know anything about pyplot <-> axes relations. And we cannot easily patch this in. Probably the most promising direction of automation would be to customize the generation of the pyplot ReST code, so that it references the respective Axes minigallery; i.e.
instead of That way:
But up until somebody comes up with such a solution, we should go the manual route. |
I think you can continue that discussion in #19232. |
PR Summary
As the title says.
I didn't add every function used in the examples, rather I erred on the side of caution against overlinking things such as
set_ylabel
and tried to include only the functions that the examples focus on.PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).