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

Skip to content

Commit fd41c9d

Browse files
committed
DOC: standardize plural Axes as axs
1 parent 02f673d commit fd41c9d

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

examples/images_contours_and_fields/barb_demo.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
data = np.array(data, dtype=[('x', np.float32), ('y', np.float32),
2323
('u', np.float32), ('v', np.float32)])
2424

25-
fig, axes1 = plt.subplots(nrows=2, ncols=2)
25+
fig1, axs1 = plt.subplots(nrows=2, ncols=2)
2626
# Default parameters, uniform grid
27-
axes1[0, 0].barbs(X, Y, U, V)
27+
axs1[0, 0].barbs(X, Y, U, V)
2828

2929
# Arbitrary set of vectors, make them longer and change the pivot point
3030
# (point around which they're rotated) to be the middle
31-
axes1[0, 1].barbs(data['x'], data['y'], data['u'], data['v'], length=8, pivot='middle')
31+
axs1[0, 1].barbs(data['x'], data['y'], data['u'], data['v'], length=8, pivot='middle')
3232

3333
# Showing colormapping with uniform grid. Fill the circle for an empty barb,
3434
# don't round the values, and change some of the size parameters
35-
axes1[1, 0].barbs(X, Y, U, V, np.sqrt(U * U + V * V), fill_empty=True, rounding=False,
36-
sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3))
35+
axs1[1, 0].barbs(X, Y, U, V, np.sqrt(U * U + V * V), fill_empty=True, rounding=False,
36+
sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3))
3737

3838
# Change colors as well as the increments for parts of the barbs
39-
axes1[1, 1].barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r',
40-
barbcolor=['b', 'g'],
41-
barb_increments=dict(half=10, full=20, flag=100), flip_barb=True)
39+
axs1[1, 1].barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r',
40+
barbcolor=['b', 'g'], flip_barb=True,
41+
barb_increments=dict(half=10, full=20, flag=100))
4242

4343
# Masked arrays are also supported
4444
masked_u = np.ma.masked_array(data['u'])

examples/images_contours_and_fields/contour_corner_mask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
z = np.ma.array(z, mask=mask)
2424

2525
corner_masks = [False, True]
26-
fig, axes = plt.subplots(ncols=2)
27-
for ax, corner_mask in zip(axes, corner_masks):
26+
fig, axs = plt.subplots(ncols=2)
27+
for ax, corner_mask in zip(axs, corner_masks):
2828
cs = ax.contourf(x, y, z, corner_mask=corner_mask)
2929
ax.contour(cs, colors='k')
3030
ax.set_title('corner_mask = {0}'.format(corner_mask))

examples/images_contours_and_fields/figimage_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Figimage Demo
44
=============
55
6-
This illustrates placing images directly in the figure, with no axes.
6+
This illustrates placing images directly in the figure, with no Axes objects.
77
88
"""
99
import numpy as np

examples/images_contours_and_fields/image_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
fig, ax = plt.subplots()
4747
ax.imshow(image)
48-
ax.axis('off') # clear x- and y-axes
48+
ax.axis('off') # clear x-axis and y-axis
4949

5050

5151
# And another image

examples/images_contours_and_fields/image_masked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# range to which the regular palette color scale is applied.
4343
# Anything above that range is colored based on palette.set_over, etc.
4444

45-
# set up the axes
45+
# set up the Axes objets
4646
fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(6, 5.4))
4747

4848
# plot using 'continuous' color map

examples/images_contours_and_fields/interpolation_methods.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828
grid = np.random.rand(4, 4)
2929

30-
fig, axes = plt.subplots(3, 6, figsize=(12, 6),
31-
subplot_kw={'xticks': [], 'yticks': []})
30+
fig, axs = plt.subplots(nrows=3, ncols=6, figsize=(12, 6),
31+
subplot_kw={'xticks': [], 'yticks': []})
3232

3333
fig.subplots_adjust(hspace=0.3, wspace=0.05)
3434

35-
for ax, interp_method in zip(axes.flat, methods):
35+
for ax, interp_method in zip(axs.flat, methods):
3636
ax.imshow(grid, interpolation=interp_method, cmap='viridis')
3737
ax.set_title(str(interp_method))
3838

examples/images_contours_and_fields/quiver_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Known problem: the plot autoscaling does not take into account
77
the arrows, so those on the boundaries are often out of the picture.
88
This is *not* an easy problem to solve in a perfectly general way.
9-
The workaround is to manually expand the axes.
9+
The workaround is to manually expand the Axes objects.
1010
"""
1111
import matplotlib.pyplot as plt
1212
import numpy as np

examples/images_contours_and_fields/shading_example.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@ def main():
3535

3636
def compare(z, cmap, ve=1):
3737
# Create subplots and hide ticks
38-
fig, axes = plt.subplots(ncols=2, nrows=2)
39-
for ax in axes.flat:
38+
fig, axs = plt.subplots(ncols=2, nrows=2)
39+
for ax in axs.flat:
4040
ax.set(xticks=[], yticks=[])
4141

4242
# Illuminate the scene from the northwest
4343
ls = LightSource(azdeg=315, altdeg=45)
4444

45-
axes[0, 0].imshow(z, cmap=cmap)
46-
axes[0, 0].set(xlabel='Colormapped Data')
45+
axs[0, 0].imshow(z, cmap=cmap)
46+
axs[0, 0].set(xlabel='Colormapped Data')
4747

48-
axes[0, 1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray')
49-
axes[0, 1].set(xlabel='Illumination Intensity')
48+
axs[0, 1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray')
49+
axs[0, 1].set(xlabel='Illumination Intensity')
5050

5151
rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='hsv')
52-
axes[1, 0].imshow(rgb)
53-
axes[1, 0].set(xlabel='Blend Mode: "hsv" (default)')
52+
axs[1, 0].imshow(rgb)
53+
axs[1, 0].set(xlabel='Blend Mode: "hsv" (default)')
5454

5555
rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='overlay')
56-
axes[1, 1].imshow(rgb)
57-
axes[1, 1].set(xlabel='Blend Mode: "overlay"')
56+
axs[1, 1].imshow(rgb)
57+
axs[1, 1].set(xlabel='Blend Mode: "overlay"')
5858

5959
return fig
6060

0 commit comments

Comments
 (0)