Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b477cf6

Browse filesBrowse files
authored
Merge pull request #9519 from dstansby/patch-tests
Increase patch test coverage
2 parents 0aaf239 + 3e51711 commit b477cf6
Copy full SHA for b477cf6

File tree

Expand file treeCollapse file tree

4 files changed

+30
-1
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+30
-1
lines changed
Loading
Loading

‎lib/matplotlib/tests/test_arrow_patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_arrow_patches.py
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,20 @@ def test_fancyarrow_dash():
119119
color='k')
120120
ax.add_patch(e)
121121
ax.add_patch(e2)
122+
123+
124+
@image_comparison(baseline_images=['arrow_styles'], extensions=['png'],
125+
style='mpl20', remove_text=True)
126+
def test_arrow_styles():
127+
styles = mpatches.ArrowStyle.get_styles()
128+
129+
n = len(styles)
130+
fig, ax = plt.subplots(figsize=(6, 10))
131+
ax.set_xlim(0, 1)
132+
ax.set_ylim(-1, n)
133+
134+
for i, stylename in enumerate(sorted(styles)):
135+
patch = mpatches.FancyArrowPatch((0.1, i), (0.8, i),
136+
arrowstyle=stylename,
137+
mutation_scale=25)
138+
ax.add_patch(patch)

‎lib/matplotlib/tests/test_patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_patches.py
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def test_multi_color_hatch():
335335

336336
for i in range(5):
337337
with mstyle.context({'hatch.color': 'C{}'.format(i)}):
338-
r = Rectangle((i-.8/2, 5), .8, 1, hatch='//', fc='none')
338+
r = Rectangle((i - .8 / 2, 5), .8, 1, hatch='//', fc='none')
339339
ax.add_patch(r)
340340

341341

@@ -350,3 +350,15 @@ def test_units_rectangle():
350350
ax.add_patch(p)
351351
ax.set_xlim([4*U.km, 7*U.km])
352352
ax.set_ylim([5*U.km, 9*U.km])
353+
354+
355+
@image_comparison(baseline_images=['connection_patch'], extensions=['png'],
356+
style='mpl20', remove_text=True)
357+
def test_connection_patch():
358+
fig, (ax1, ax2) = plt.subplots(1, 2)
359+
360+
con = mpatches.ConnectionPatch(xyA=(0.1, 0.1), xyB=(0.9, 0.9),
361+
coordsA='data', coordsB='data',
362+
axesA=ax2, axesB=ax1,
363+
arrowstyle="->")
364+
ax2.add_artist(con)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.