| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -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 | ||
| Expand All | @@ -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)}", | ||
|
Comment thread
Copy link
Copy Markdown
Member
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI'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, something went wrong.
All reactions
|
||
| transform=ax.transAxes, ha="center", va="center", | ||
| bbox=dict(boxstyle=stylename, fc="w", ec="k")) | ||
|
|
||
|
|
||
| ############################################################################### | ||
| Expand Down | ||
This file was deleted.
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.