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
Milestone
Description
This is 1.5 regression, the following test script works in 1.4.3.
The bug only occurs when using a custom colormap.
import matplotlib.pyplot as pltimport numpy as npfrom matplotlib import mlab, cm, colors# make up fake data.delta = 0.5x = np.arange(-3.0, 4.001, delta)y = np.arange(-4.0, 3.001, delta)X, Y = np.meshgrid(x, y)Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)Z = (Z1 - Z2) * 20000 ; Z -= Z.min(); Z *= 0.5# levels to contourclevs = [0,2,5,10,20,50,100,300,500,700,1000,1500,2000,2500,3000,3500]# contour data, make colorbarfig = plt.figure(figsize=(9.,6.3))colorst =\['White','#E4FFFF','#C4E8FF','#8FB3FF','#D8F9D8','#A6ECA6','#42F742','Yellow','Gold',\ 'Orange','#FCD5D9','#F6A3AE','#FA5257','Orchid','#AD8ADB','#A449FF','LightGray']custom_cm = colors.ListedColormap(colorst, name='colorst', N=None)ax = fig.add_axes([0.03,.12,0.94,.83])cs = plt.contourf(X, Y, Z, clevs, colors=colorst)cax = fig.add_axes([0.1,0.05,0.8,0.03])cbar = fig.colorbar(cs,extend='neither', \ orientation='horizontal',cax=cax,drawedges=True,ticks=clevs)plt.show()
The resulting image
does not show all the colorbar labels.