-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
More cleanup to annotations tutorial. #20531
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
The following examples show how to plot boxes with different visual properties. | ||
""" | ||
|
||
import inspect | ||
|
||
import matplotlib.pyplot as plt | ||
import matplotlib.transforms as mtransforms | ||
import matplotlib.patches as mpatch | ||
|
@@ -15,17 +17,16 @@ | |
# First we'll show some sample boxes with fancybox. | ||
|
||
styles = mpatch.BoxStyle.get_styles() | ||
spacing = 1.2 | ||
|
||
figheight = (spacing * len(styles) + .5) | ||
fig = plt.figure(figsize=(4 / 1.5, figheight / 1.5)) | ||
fontsize = 0.3 * 72 | ||
|
||
for i, stylename in enumerate(sorted(styles)): | ||
fig.text(0.5, (spacing * (len(styles) - i) - 0.5) / figheight, stylename, | ||
ha="center", | ||
size=fontsize, | ||
bbox=dict(boxstyle=stylename, fc="w", ec="k")) | ||
ncol = 2 | ||
nrow = (len(styles) + 1) // ncol | ||
axs = plt.figure(figsize=(3 * ncol, nrow)).subplots(nrow, ncol) | ||
for ax in axs.flat: | ||
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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
transform=ax.transAxes, ha="center", va="center", | ||
bbox=dict(boxstyle=stylename, fc="w", ec="k")) | ||
|
||
|
||
############################################################################### | ||
|
This file was deleted.
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.