Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colorbar values could take advantage of offsetting and/or scientific notation #5470

Closed
anntzer opened this issue Nov 12, 2015 · 4 comments
Closed

Comments

@anntzer
Copy link
Contributor

anntzer commented Nov 12, 2015

Currently, colorbars seem to label their values by simply printing them out (with str). It may be advantageous to use scientific notation and offset the values when needed (like axes do) instead.

Silly example:

from pylab import *; plt.imshow(np.random.rand(32, 32) / 1000); plt.colorbar(); plt.show()
@mdboom
Copy link
Member

mdboom commented Nov 12, 2015

Colorbars have a formatter like regular axes, so you can tweak this behavior through

c = plt.colorbar()
c.formatter.set_scientific(True)
c.formatter.set_powerlimits((-1, 1))
# etc...

@mdboom mdboom closed this as completed Nov 12, 2015
@anntzer
Copy link
Contributor Author

anntzer commented Nov 12, 2015

Fair enough. Consider this a vote for changing the default, then?

@efiring
Copy link
Member

efiring commented Nov 12, 2015

I think the default is already the same as for the x-axis and y-axis. In all cases it is the ScalarFormatter with powerlimits of [-7, 7].

@anntzer
Copy link
Contributor Author

anntzer commented Nov 13, 2015

I didn't realize that I tend to have x and y axes of the style "largenumber+[smallnumbers]" (which triggers scientific notation) but colorbars which are all (moderately) large numbers and therefore do not trigger scientific notation. I was confused, my apologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants