Is there a way to set the style and scilimits to the colorbar axes? All my
attempts failed. For example, run the following script, I get the error
shown below:
### begin example script
import numpy
from matplotlib import pyplot
n = 5000000
x = numpy.random.standard_normal(n)
y = 2.0 + 3.0 * x + 4.0 * numpy.random.standard_normal(n)
xmin = x.min()
xmax = x.max()
ymin = y.min()
ymax = y.max()
hist, edges = numpy.histogramdd([y,x], bins=[25,25],
range=[[ymin,ymax], [xmin,xmax]])
extent = [xmin, xmax, ymin, ymax]
fig = pyplot.figure()
ax = fig.add_subplot(1,1,1)
plt = ax.imshow(hist,
extent = extent,
origin = 'lower',
interpolation = 'nearest',
aspect = 'auto')
cb = fig.colorbar(plt, ax=ax)
# This causes an AttributeError exception
cb.ax.ticklabel_format(style='sci', scilimits=(0,4))
pyplot.show()
### end example script
python cb_scilim_test.py
Traceback (most recent call last):
File "cb_scilim_test.py", line 25, in <module>
cb.ax.ticklabel_format(style='sci', scilimits=(0,4))
File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 2117,
in ticklabel_format
"This method only works with the ScalarFormatter.")
AttributeError: This method only works with the ScalarFormatter.
···
--
View this message in context: http://old.nabble.com/colorbar-and-scilimits-tp31201133p31201133.html
Sent from the matplotlib - users mailing list archive at Nabble.com.