Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c3ca1c

Browse files
committed
Remove usage of plt.Axes from tests
Axes is considered private in pyplot. See also #26812.
1 parent 538bd83 commit 6c3ca1c

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

lib/matplotlib/tests/test_bbox_tight.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ def test_noop_tight_bbox():
141141
dpi = 100
142142
# make the figure just the right size up front
143143
fig = plt.figure(frameon=False, dpi=dpi, figsize=(x_size/dpi, y_size/dpi))
144-
ax = plt.Axes(fig, [0., 0., 1., 1.])
145-
fig.add_axes(ax)
144+
ax = fig.add_axes((0, 0, 1, 1))
146145
ax.set_axis_off()
147146
ax.xaxis.set_visible(False)
148147
ax.yaxis.set_visible(False)

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,8 @@ def test_image_preserve_size2():
800800
data = np.identity(n, float)
801801

802802
fig = plt.figure(figsize=(n, n), frameon=False)
803-
804-
ax = plt.Axes(fig, [0.0, 0.0, 1.0, 1.0])
803+
ax = fig.add_axes((0.0, 0.0, 1.0, 1.0))
805804
ax.set_axis_off()
806-
fig.add_axes(ax)
807805
ax.imshow(data, interpolation='nearest', origin='lower', aspect='auto')
808806
buff = io.BytesIO()
809807
fig.savefig(buff, dpi=1)

0 commit comments

Comments
 (0)