You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I reported on the mailing list that a call to im.set_clim to change the color scale on a NonUniformImage changes the colorbar but not the plot itself. It was pointed out that a further call to im.set_data fixes it, but it would be useful if that wasn't necessary.
Here is some test code. I set up an image plot as follows (using ipython --pylab=qt):
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import NonUniformImage
x=y=np.linspace(0,2*np.pi,101)
X,Y=np.meshgrid(x,y)
z=np.sin(X)*np.sin(Y)
ax=plt.gca()
extent = (x[0],x[-1],y[0],y[-1])
im = NonUniformImage(ax, extent=extent, origin=None)
im.set_data(x,y,z)
ax.images.append(im)
ax.set_xlim(x[0],x[-1])
ax.set_ylim(y[0],y[-1])
plt.colorbar(im)
plt.gcf().canvas.draw()
After that, I try to change the color scale using:
im.set_clim(0,0.5)
plt.gcf().canvas.draw()
The colorbar changes scale, but the plot is untouched. Is that the expected behavior?
The text was updated successfully, but these errors were encountered:
This is actually a result not of a bug in the ordinary sense, but of NonUniformImage being only half-baked. It has never been incorporated as an Axes method (not to mention pyplot), and it has not been updated to support caching or any colormap changes. I think it makes sense to do this whole update, which should not be very difficult, in the master branch.
I reported on the mailing list that a call to im.set_clim to change the color scale on a NonUniformImage changes the colorbar but not the plot itself. It was pointed out that a further call to im.set_data fixes it, but it would be useful if that wasn't necessary.
Here is some test code. I set up an image plot as follows (using ipython --pylab=qt):
After that, I try to change the color scale using:
The colorbar changes scale, but the plot is untouched. Is that the expected behavior?
The text was updated successfully, but these errors were encountered: