Addresses issue #24618 "Road sign" boxstyle/annotation, alternative to #24697 by Abitamim · Pull Request #24744 · matplotlib/matplotlib · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 84 additions & 8 deletions lib/matplotlib/patches.py
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions lib/matplotlib/tests/test_arrow_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ def test_boxarrow():
bbox=dict(boxstyle=stylename, fc="w", ec="k"))


@image_comparison(['roadsign_test_image.png'])
def temp_test_boxarrow():

styles = mpatches.BoxStyle.get_styles()

n = len(styles)
spacing = 1.2

figheight = (n * spacing + .5)
fig = plt.figure(figsize=(4 / 1.5, figheight / 1.5))

fontsize = 0.3 * 72

for i, stylename in enumerate(sorted(styles)):
if stylename in ("larrow", "rarrow", "darrow"):
fig.text(0.5, ((n - i) * spacing - 0.5)/figheight, stylename,
ha="center",
size=fontsize,
transform=fig.transFigure,
bbox=dict(boxstyle=stylename+",head_width=1", fc="w",
ec="k"))


def __prepare_fancyarrow_dpi_cor_test():
"""
Convenience function that prepares and returns a FancyArrowPatch. It aims
Expand Down
10 changes: 5 additions & 5 deletions tutorials/text/annotations.py