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
Bug summary
I am puzzled by the following behavior. Is this intended or a bug?
After creating a colorbar, if setting the limits of the color range with a shorter range of vmin,vmax results in a shrunken colorbar
Code for reproduction
fig, ax=plt.subplots()
data=np.random.random(size=(50,50))
img=ax.imshow(data)
cb=plt.colorbar(img)
# the colorbar is the same height as the plot at this point#img.set_clim([0.25,0.75]) # running this line will produce a shrunken colorbar#img.set_clim([-0.25,1.25]) # running this line will change the limits of the colorbar# and return the colorbar to its original size
Actual outcome
This is the result of a small animation where vmax is increased from 0.5 to 1.5 then back
Expected outcome
I was expecting the colorbar to stay the same size, and only the tick range to change. Certainly the colorbar does not grow when setting a larger range of vmin,vmax but shrinks when using a smaller range, which seems inconsistent.
Thanks for reporting this. This is a bug introduced in #9903
and fixed by #12159. It will not occur any more in matplotlib 3.0.1 which is available since 6 days ago.
I will close this. If you find some undesired behaviour concerning colorbar limits in version 3.0.1 feel free to reopen.
Bug report
Bug summary
I am puzzled by the following behavior. Is this intended or a bug?
After creating a colorbar, if setting the limits of the color range with a shorter range of
vmin,vmax
results in a shrunken colorbarCode for reproduction
Actual outcome
This is the result of a small animation where vmax is increased from 0.5 to 1.5 then back
Expected outcome
I was expecting the colorbar to stay the same size, and only the tick range to change. Certainly the colorbar does not grow when setting a larger range of
vmin,vmax
but shrinks when using a smaller range, which seems inconsistent.Matplotlib version
print(matplotlib.get_backend())
): nbAggThe text was updated successfully, but these errors were encountered: