Skip to content

Commit f3564cd

Browse files
committed
Use axs.flat instead of ax.ravel()
1 parent b528c7d commit f3564cd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/color/custom_cmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
cmap_name = 'my_list'
8989
fig, axs = plt.subplots(2, 2, figsize=(6, 9))
9090
fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05)
91-
for n_bin, ax in zip(n_bins, axs.ravel()):
91+
for n_bin, ax in zip(n_bins, axs.flat):
9292
# Create the colormap
9393
cmap = LinearSegmentedColormap.from_list(cmap_name, colors, N=n_bin)
9494
# Fewer bins will result in "coarser" colomap interpolation

examples/images_contours_and_fields/contourf_demo.py

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

9797
fig, axs = plt.subplots(2, 2, constrained_layout=True)
9898

99-
for ax, extend in zip(axs.ravel(), extends):
99+
for ax, extend in zip(axs.flat, extends):
100100
cs = ax.contourf(X, Y, Z, levels, cmap=cmap, extend=extend, origin=origin)
101101
fig.colorbar(cs, ax=ax, shrink=0.9)
102102
ax.set_title("extend = %s" % extend)

examples/style_sheets/ggplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
np.random.seed(19680801)
2424

2525
fig, axs = plt.subplots(ncols=2, nrows=2)
26-
ax1, ax2, ax3, ax4 = axs.ravel()
26+
ax1, ax2, ax3, ax4 = axs.flat
2727

2828
# scatter plot (Note: `plt.scatter` doesn't use default colors)
2929
x, y = np.random.normal(size=(2, 200))

0 commit comments

Comments
 (0)