| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| ax.text(.5, .5, | ||
| f"{stylename}\n{inspect.signature(stylecls)}", | ||
| transform=ax.transAxes, ha="center", va="center", | ||
| bbox=dict(boxstyle=stylename, fc="w", ec="k")) |
There was a problem hiding this comment.
anyway to make the boxes slightly bigger? especially for the sawtooth and round4, the styling gets a little lost in the smaller size.
Sorry, something went wrong.
There was a problem hiding this comment.
Actually these are the default params, and I'd rather keep using the defaults for the reference docs?
Sorry, something went wrong.
There was a problem hiding this comment.
Hmm, makes sense, but ugh so hard to differentiate :/ is it cause size is determined by pad? And then hmm, could changing the color help? maybe an inside gray to make the border pop?
Sorry, something went wrong.
Sorry, something went wrong.
|
I like the idea of the parameters next to the images since it makes it very clear these aren't defaults what's controlled by parameters. |
Sorry, something went wrong.
🤣 SCNR, but this is part of my point. I see the desire to provide the parameters, but as of now they are really cluttering the images. 1) It's hard to see what the main We don't have rich-text do we? Otherwise we could use color/font weight/font size to highlight the main parameter compared to the other parameters. |
Sorry, something went wrong.
|
I think, we'd rather want something like import inspect
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
import matplotlib.patches as mpatch
from matplotlib.patches import FancyBboxPatch
styles = mpatch.BoxStyle.get_styles()
ax = plt.figure(figsize=(5, len(styles))).add_axes([0, 0, 1, 1])
ax.set_axis_off()
ax.set(xlim=(0, 1), ylim=(len(styles) + 0.5, -0.5))
ax.text(.15, 0, 'boxstyle', fontsize=18, ha="center", va="center")
ax.text(.45, 0, 'default parameters', fontsize=18, va="center")
for i, (stylename, stylecls) in enumerate(styles.items(), start=1):
ax.text(.15, i, stylename, fontsize=15, color='tab:blue',
ha="center", va="center",
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
ax.text(.45, i, str(inspect.signature(stylecls))[1:-1].replace(', ', '\n'),
va='center')
Similarly for the arrow style (e.g. move the parameters to the right, highlight the style name in blue, make the target marker grey). |
Sorry, something went wrong.
|
How do the ones below look to you? I think specifically for arrows it's better to keep the arrowstyle on the left (because that's what "<-" means...), and then it seems natural to keep the parameters next to the arrowstyle... |
Sorry, something went wrong.
Sorry, something went wrong.
|
In #20546, I'm dropping the 50% scale of the figures in the tutorials, because they are generally too small to be useful. I'm not sure exactly how big the figure ends up here now, but in order to avoid scaling, it would be good if you can make the figure fit the text width of the new theme. That would be about 749.167 pixels, or just under 7.5 inches at 100 DPI (though I wonder if we could tweak the theme to be a rounder number.) |
Sorry, something went wrong.
|
Sure. Perhaps you can document that size somewhere? |
Sorry, something went wrong.
|
Previously, the content width was 919px. Reducing that in the new theme is a broader issue that will cause many figures to be rescaled and thus look blurry. We have
It's worth discussing if we want to increase the width of the theme. Going to 800px would at least save the 43 figures with 8inch width. Once decided, the width should be documented in Writing examples and tutorials. |
Sorry, something went wrong.
|
[Agreed that I should just pick a size and go with it for now.] |
Sorry, something went wrong.
This will allow later removing the table of values in the annotation tutorial. Also, draw things each in their axes and in axes coordinates, to simplify the code.
There was a problem hiding this comment.
I'm not 100% happy with using a grid of Axes instead of positioning the elements in a single Axes. This makes the example more complicated IMHO. In particular, you need a lot of transform=ax.transAxes, which is a non-trivial concept.
That is okish, because the main purpose of the example is the overview image, not how you generated it. Conceptually simpler code would still be better, but I'll merge as an improvement. We can always have further changes in a followup OR.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This will allow later removing the table of values in the annotation
tutorial.
Also, draw things each in their axes and in axes coordinates, to
simplify the code.
Split out of #20531.
Before:


After:


In #20531 (comment) @timhoffm has argued against the addition of all parameters; I think specifically for the example the effect may be neutral or indeed perhaps slightly negative, but the point is actually to remove the tables at
matplotlib/tutorials/text/annotations.py
Lines 139 to 151 in 60ff0d4
matplotlib/tutorials/text/annotations.py
Lines 241 to 256 in 60ff0d4
(Effectively, we have the problem that the example serves both as a standalone example and to generate a figure for the narrative tutorial, but I don't think it's worth duplicating the code to have two separate versions for the two tasks.)
Thoughts?
PR Summary
PR Checklist