Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug report
Bug summary
NOTE: This is only applicable for 3.0 as cbar.minorticks_on() is introduced in 3.0 only.
When the minorticks are turned on for a colorbar, a minor tick is found to be missing from the vmax end of the colorbar (the weird part is, this doesn't happen for all values of vmax).
@jklymak can you please have a look?
Code for reproduction
importnumpyasnpimportmatplotlib.pyplotasplt# setup some generic dataN=37x,y=np.mgrid[:N, :N]Z= (np.cos(x*0.2)+np.sin(y*0.3))fig,ax=plt.subplots(figsize=(4,3))im=ax.imshow(Z,cmap='RdBu',vmin=-1.2,vmax=1.2,interpolation='none')cbar=fig.colorbar(im,ax=ax,extend='both')cbar.minorticks_on()plt.show()
Actual outcome
The minor tick corresponding to the value +1.2 is missing!
Even if I increase the vmax by 10**-16 I get the same result i.e.
im=ax.imshow(Z,cmap='RdBu',vmin=-1.2,vmax=1.2+10**-16,interpolation='none')
Expected outcome
I get the expected outcome by increasing the vmax by 10**-15
im=ax.imshow(Z,cmap='RdBu',vmin=-1.2,vmax=1.2+10**-15,interpolation='none')
This issue doesn't show up if I use vmax=1.3
im=ax.imshow(Z,cmap='RdBu',vmin=-1.2,vmax=1.3,interpolation='none')
Matplotlib version
- Operating system: Mac OS 10.13.6
- Matplotlib version: '3.0.0rc2.post25+g68845f8e5'
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg - Python version: Python 3.7.0
P.S. I realized this when I was looking at the modification I made tohttps://github.com/matplotlib/matplotlib/blob/master/examples/color/colorbar_basics.py to show off cbar.minorticks_on()