Skip to content

Commit 42fe71e

Browse files
committed
Use ax.add_image rather than ax.images.append in NonUniformImage example
add_image sets up a few additional things on the artist (it makes `remove()` work and generates a label), and avoids directly manipulating the `.images` attribute, which may become read-only in the future.
1 parent 666e6cc commit 42fe71e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/images_contours_and_fields/image_nonuniform.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4),
3232
cmap=cm.Purples)
3333
im.set_data(x, y, z)
34-
ax.images.append(im)
34+
ax.add_image(im)
3535
ax.set_xlim(-4, 4)
3636
ax.set_ylim(-4, 4)
3737
ax.set_title(interp)
@@ -40,7 +40,7 @@
4040
im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4),
4141
cmap=cm.Purples)
4242
im.set_data(x2, y, z)
43-
ax.images.append(im)
43+
ax.add_image(im)
4444
ax.set_xlim(-64, 64)
4545
ax.set_ylim(-4, 4)
4646
ax.set_title(interp)
@@ -51,7 +51,7 @@
5151
im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4),
5252
cmap=cm.Purples)
5353
im.set_data(x, y, z)
54-
ax.images.append(im)
54+
ax.add_image(im)
5555
ax.set_xlim(-4, 4)
5656
ax.set_ylim(-4, 4)
5757
ax.set_title(interp)
@@ -60,7 +60,7 @@
6060
im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4),
6161
cmap=cm.Purples)
6262
im.set_data(x2, y, z)
63-
ax.images.append(im)
63+
ax.add_image(im)
6464
ax.set_xlim(-64, 64)
6565
ax.set_ylim(-4, 4)
6666
ax.set_title(interp)

0 commit comments

Comments
 (0)