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 b528c7d

Browse filesBrowse files
committed
Use ax instead of axs when the object is clearly a single Axes
1 parent 75439d3 commit b528c7d
Copy full SHA for b528c7d

File tree

Expand file treeCollapse file tree

2 files changed

+19
-19
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-19
lines changed

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6439,15 +6439,15 @@ def test_secondary_formatter():
64396439
secax.xaxis.get_major_formatter(), mticker.ScalarFormatter)
64406440

64416441

6442-
def color_boxes(fig, axs):
6442+
def color_boxes(fig, ax):
64436443
"""
64446444
Helper for the tests below that test the extents of various axes elements
64456445
"""
64466446
fig.canvas.draw()
64476447

64486448
renderer = fig.canvas.get_renderer()
64496449
bbaxis = []
6450-
for nn, axx in enumerate([axs.xaxis, axs.yaxis]):
6450+
for nn, axx in enumerate([ax.xaxis, ax.yaxis]):
64516451
bb = axx.get_tightbbox(renderer)
64526452
if bb:
64536453
axisr = plt.Rectangle(
@@ -6459,23 +6459,23 @@ def color_boxes(fig, axs):
64596459

64606460
bbspines = []
64616461
for nn, a in enumerate(['bottom', 'top', 'left', 'right']):
6462-
bb = axs.spines[a].get_window_extent(renderer)
6462+
bb = ax.spines[a].get_window_extent(renderer)
64636463
spiner = plt.Rectangle(
64646464
(bb.x0, bb.y0), width=bb.width, height=bb.height,
64656465
linewidth=0.7, edgecolor="green", facecolor="none", transform=None,
64666466
zorder=3)
64676467
fig.add_artist(spiner)
64686468
bbspines += [bb]
64696469

6470-
bb = axs.get_window_extent()
6470+
bb = ax.get_window_extent()
64716471
rect2 = plt.Rectangle(
64726472
(bb.x0, bb.y0), width=bb.width, height=bb.height,
64736473
linewidth=1.5, edgecolor="magenta", facecolor="none", transform=None,
64746474
zorder=2)
64756475
fig.add_artist(rect2)
64766476
bbax = bb
64776477

6478-
bb2 = axs.get_tightbbox(renderer)
6478+
bb2 = ax.get_tightbbox(renderer)
64796479
rect2 = plt.Rectangle(
64806480
(bb2.x0, bb2.y0), width=bb2.width, height=bb2.height,
64816481
linewidth=3, edgecolor="red", facecolor="none", transform=None,

‎lib/matplotlib/tests/test_image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_image.py
+14-14Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ def test_imshow_antialiased(fig_test, fig_ref,
115115
A = np.random.rand(int(dpi * img_size), int(dpi * img_size))
116116
for fig in [fig_test, fig_ref]:
117117
fig.set_size_inches(fig_size, fig_size)
118-
axs = fig_test.subplots()
119-
axs.set_position([0, 0, 1, 1])
120-
axs.imshow(A, interpolation='antialiased')
121-
axs = fig_ref.subplots()
122-
axs.set_position([0, 0, 1, 1])
123-
axs.imshow(A, interpolation=interpolation)
118+
ax = fig_test.subplots()
119+
ax.set_position([0, 0, 1, 1])
120+
ax.imshow(A, interpolation='antialiased')
121+
ax = fig_ref.subplots()
122+
ax.set_position([0, 0, 1, 1])
123+
ax.imshow(A, interpolation=interpolation)
124124

125125

126126
@check_figures_equal(extensions=['png'])
@@ -131,14 +131,14 @@ def test_imshow_zoom(fig_test, fig_ref):
131131
A = np.random.rand(int(dpi * 3), int(dpi * 3))
132132
for fig in [fig_test, fig_ref]:
133133
fig.set_size_inches(2.9, 2.9)
134-
axs = fig_test.subplots()
135-
axs.imshow(A, interpolation='antialiased')
136-
axs.set_xlim([10, 20])
137-
axs.set_ylim([10, 20])
138-
axs = fig_ref.subplots()
139-
axs.imshow(A, interpolation='nearest')
140-
axs.set_xlim([10, 20])
141-
axs.set_ylim([10, 20])
134+
ax = fig_test.subplots()
135+
ax.imshow(A, interpolation='antialiased')
136+
ax.set_xlim([10, 20])
137+
ax.set_ylim([10, 20])
138+
ax = fig_ref.subplots()
139+
ax.imshow(A, interpolation='nearest')
140+
ax.set_xlim([10, 20])
141+
ax.set_ylim([10, 20])
142142

143143

144144
@check_figures_equal()

0 commit comments

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