Unfortunately, ticks in colorbar axes work differently. Use something
like below instead.
cb.formatter.set_scientific(True)
cb.formatter.set_powerlimits((0,4))
cb.update_ticks()
Regards,
-JJ
On Mon, Mar 21, 2011 at 11:26 PM, johanngoetz jgo...@ucla.edu wrote:
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 = 500
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.
--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users