Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Description
Bug summary
When creating a LogNorm imshow plot with more than 9 orders of magnitude of dynamic range the automatically generated colorbar from plt.colorbar() has no automatically generated tick marks or labels.
Code for reproduction
This generates a plot with colorbar tick labels
importnumpyasnpfrommatplotlibimportpyplotaspltfrommatplotlib.colorsimportLogNormdata=np.zeros((800,800))+1data[50,51]=1e9print(np.log10(data.max()/data.min()))image=plt.imshow(data,origin='lower',interpolation='nearest',norm=LogNorm())plt.colorbar(image)plt.savefig('labels.png')
While this script generates a plot with no colorbar tick labels:
importnumpyasnpfrommatplotlibimportpyplotaspltfrommatplotlib.colorsimportLogNormdata=np.zeros((800,800))+1data[50,51]=2e9print(np.log10(data.max()/data.min()))image=plt.imshow(data,origin='lower',interpolation='nearest',norm=LogNorm())plt.colorbar(image)plt.savefig('no-labels.png')
Expected outcome
I would expect the second plot to also have colorbar tick labels.
Matplotlib version
- Operating system: Mac OS High Sierra
- Matplotlib version: 2.1.1 (installed via pip)
- Matplotlib backend (
print(matplotlib.get_backend())
): MacOSX - Python version: 3.6