-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
Milestone
Description
To help us understand and resolve your issue, please fill out the form to the best of your ability. You can feel free to delete the sections that do not apply.
Bug report
Bug summary
When initialising AxesImage with numpy.zeros
array, changing the image with set_data
will have no effect on the displayed image (whereas the reverse is not true, i.e. initialise with non-zero arrays, change data to zero array).
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
shape = (10,10)
Z = np.zeros(shape)
R = np.random.rand(*shape)
fig, ax = plt.subplots(1,1)
img1 = ax.imshow(R)
img1.set_data(Z) # shows zero array
fig, ax = plt.subplots(1,1)
img2 = ax.imshow(Z)
img2.set_data(R) # also displays zero array, ...
# ..., even though img.get_array() returns the correct array
print np.all(np.isclose(img2.get_array(), R))
Actual outcome
Two blue images.
Expected outcome
First figure blue, second figure showing randomly coloured pixels.
Matplotlib version
matplotlib 2.0.0 (installed via pip), python 2.7, Ubuntu 14.04 LTS
<
496A
div class="CommentLoading-module__CommentLoadingContent--nb4e3">