Skip to content

Replace some usages of plt.subplot() by plt.subplots() in tests #18554

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

Merged
merged 1 commit into from
Sep 25, 2020
Merged
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
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ def test_clipping():
star = mpath.Path.unit_regular_star(6).deepcopy()
star.vertices *= 2.6

ax1 = plt.subplot(121)
fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)

col = mcollections.PathCollection([star], lw=5, edgecolor='blue',
facecolor='red', alpha=0.7, hatch='*')
col.set_clip_path(clip_path, ax1.transData)
ax1.add_collection(col)

ax2 = plt.subplot(122, sharex=ax1, sharey=ax1)
patch = mpatches.PathPatch(star, lw=5, edgecolor='blue', facecolor='red',
alpha=0.7, hatch='*')
patch.set_clip_path(clip_path, ax2.transData)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5464,12 +5464,12 @@ def test_shared_axes_autoscale():
l = np.arange(-80, 90, 40)
t = np.random.random_sample((l.size, l.size))

ax1 = plt.subplot(211)
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True, sharey=True)

ax1.set_xlim(-1000, 1000)
ax1.set_ylim(-1000, 1000)
ax1.contour(l, l, t)

ax2 = plt.subplot(212, sharex=ax1, sharey=ax1)
ax2.contour(l, l, t)
assert not ax1.get_autoscalex_on() and not ax2.get_autoscalex_on()
assert not ax1.get_autoscaley_on() and not ax2.get_autoscaley_on()
Expand Down
14 changes: 4 additions & 10 deletions lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,13 @@ def test_imsave_pil_kwargs_tiff():

@image_comparison(['image_alpha'], remove_text=True)
def test_image_alpha():
plt.figure()

np.random.seed(0)
Z = np.random.rand(6, 6)

plt.subplot(131)
plt.imshow(Z, alpha=1.0, interpolation='none')

plt.subplot(132)
plt.imshow(Z, alpha=0.5, interpolation='none')

plt.subplot(133)
plt.imshow(Z, alpha=0.5, interpolation='nearest')
fig, (ax1, ax2, ax3) = plt.subplots(1, 3)
ax1.imshow(Z, alpha=1.0, interpolation='none')
ax2.imshow(Z, alpha=0.5, interpolation='none')
ax3.imshow(Z, alpha=0.5, interpolation='nearest')


def test_cursor_data():
Expand Down