More cleanup to annotations tutorial.#20531
Conversation
Make most of the tutorial a comment, rather than a string. Remove non-informative plot titles. Move annotate_simple01 into the tutorial, and delete it as independent example. Remove the table of fancybox properties, and directly output them as part of the plot in fancybox_demo.py. In that same example, it is also nicer to use two column output, and simpler to just output one fancybox per subplot, rather than having to recompute the position of each fancybox in data coordinates. Don't alphabetically sort boxstyles/arrowstyles/etc., the source order being semantically more meaningful.
timhoffm
left a comment
There was a problem hiding this comment.
Deleting annotate_simple01 seems somewhat arbitrary. annotate_simple01...04 sort of belong together. They show some examples of annotations. Whether we want them as separate examples (because the show up in the gallery) or whether that's too much can be discussed. But removing only 01 is inconsistent. Either we keep all, or we remove all.
My first-step intuition is to merge annotate_simple01..04 into a single example with a (2, 2) subplot. That way it's still possible to see the variants in the gallery, but they can be described and compared more easily within a single example.
| @@ -15,17 +17,16 @@ | |||
| # First we'll show some sample boxes with fancybox. | |||
There was a problem hiding this comment.
| # First we'll show some sample boxes with fancybox. | |
| # The following box styles are available: |
| ax.set_axis_off() | ||
| for ax, (stylename, stylecls) in zip(axs.T.flat, styles.items()): | ||
| ax.text(.5, .5, | ||
| f"{stylename}\n{inspect.signature(stylecls)}", |
There was a problem hiding this comment.
I'm not convinced this stylecls inspection is an improvement. This plot should primarily illustrate the available boxstyles. Adding the parameters is rather distracting. And also these are only the defaults, which should be irrelevant to most users (well maybe if you start modifying them, but that should be discussed separately.
|
Sorry, I think I'm trying to do too much here, let me split that PR into smaller ones... |
|
Sorry I didn't see this before I started #23606 - how badly does that conflict w/ this & should I incorporate stuff from here into there? |
|
Feel free to pick up whatever is relevant from my patch and either close this if you think everything that matters has been handled, or leave it open if there's more to do. |
|
@story645 did you incorporate any of this PR? Or should we close this PR as outdated? |
|
I think I went in a different but overlapping direction, enough that the rebase would be messy. Not sure what @anntzer wants to do w/ the other files in this PR, especially since I moved the code for the user demo examples into the tutorial and therefore think those examples should be removed. |
|
I'll try and sort out if there's anything left to do and if so open separate PRs for them. I guess this can be closed, in the meantime. |
|
OK, I think the only remaining work is #24723, everything else has been handled. |
Make most of the tutorial a comment, rather than a string. Remove
non-informative plot titles (as in #20393).
Move annotate_simple01 into the tutorial, and delete it as independent
example.
Remove the table of fancybox properties, and directly output them as
part of the plot in fancybox_demo.py. In that same example, it is
also nicer to use two column output, and simpler to just output one
fancybox per subplot, rather than having to recompute the position of
each fancybox in data coordinates.
Don't alphabetically sort boxstyles/arrowstyles/etc., the source order
being semantically more meaningful (as in #20430).
PR Summary
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand 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).