|
From: Nils W. <ni...@go...> - 2013-10-11 06:52:12
|
Hi all,
I tried to add a colorbar to a bar plot
coolwarm = cm = plt.get_cmap('coolwarm')
values = range(100)
cNorm = colors.Normalize(vmin=0, vmax=values[-1])
scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=coolwarm)
colours = []
for value in values:
colorVal = scalarMap.to_rgba(value)
colours.append(colorVal)
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
hist,bin_edges = np.histogram(efratio,bins=100,range=(0.,1.),density=False)
width = 0.7*(bin_edges[1]-bin_edges[0])
center = (bin_edges[:-1]+bin_edges[1:])/2
heatmap = ax.bar(center, hist, zs=z, zdir='y', align = 'center', width =
width,color=colours)
plt.colorbar(heatmap)
mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'BarContainer' object has no attribute 'autoscale_None'
How can I fix the problem ?
Nils
|