Is there a way to get the colorbar to work with an axes instance.
ax2 = axes([0.2, 0.1, 0.6, 0.8], axisbg=‘w’)
ax2.fill([x1,x2,x2,x1], [y1,y1,y2,y2], fc=‘None’, ec=‘r’)
ax2.pcolormesh(X, Y, newa, shading=‘flat’, cmap=cm.YlOrRd)#gray_r)
ax2.axvline(x=0, color=‘gray’, linestyle=’–’)
ax2.axhline(y=0, color=‘gray’, linestyle=’–’)
ax2.plot([offaxisX], [offaxisY], ‘r+’, mew=1)
ax2.colorbar()
AttributeError: ‘Axes’ object has no attribute ‘colorbar’
colorbar()
, line 499, in
colorbar()
File “C:\Python25\Lib\site-packages\matplotlib\pyplot.py”, line 1129, in colorbar
ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 956, in colorbar
cb = cbar.Colorbar(cax, mappable, **kw)
File “C:\Python25\Lib\site-packages\matplotlib\colorbar.py”, line 558, in init
mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: ‘NoneType’ object has no attribute ‘autoscale_None’
I am not sure how the mappable, ax, and cax options work.
···
–
“The game of science can accurately be described as a never-ending insult to human intelligence.” - João Magueijo
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. " -Albert Einstein