Display full number in ticks

Dear Matplotlib users/developers,

The default behaviour of matplotlib.pyplot is to display large (e.g. 2452298.7554547498 as a small number 0.25545474980026484 + 2.4522985e6) I would like to be able to do one of the following.

- Set the number to be subtracted manually (I know I can just subtract a number from the input array but then matplotib still subtracts another number if it thinks it is still to big to display).
- Force matplotlib to display the full number (and display the numbers slanted so they do not overlap). This is my preferred option. I would like to see this as a simple option in pyplot, perhaps as an extra parameter in the xticks/yticks functions (for the y axis the numbers don't need to be slanted).

I tried a manual formatter but I think there should be an easy way to set this in pyplot and I could not figure out how to display the tick numbers slanted.

Kind regards,

Pim Schellart

P.S. In the example number 2452298.7554547498 I also need to subtract 2440000 in order for the plot to render correctly. Otherwise all y values end up at the same x position which is a bug in the latest matplotlib release because it did not happen before.

Pim Schellart wrote:

Dear Matplotlib users/developers,

The default behaviour of matplotlib.pyplot is to display large (e.g. 2452298.7554547498 as a small number 0.25545474980026484 + 2.4522985e6) I would like to be able to do one of the following.

- Set the number to be subtracted manually (I know I can just subtract a number from the input array but then matplotib still subtracts another number if it thinks it is still to big to display).

I don't know if there's a straightforward way to do this... Maybe someone more familiar with the ticking code can comment.

- Force matplotlib to display the full number (and display the numbers slanted so they do not overlap). This is my preferred option. I would like to see this as a simple option in pyplot, perhaps as an extra parameter in the xticks/yticks functions (for the y axis the numbers don't need to be slanted).

You can do "xticks(rotation=45)" Does that do what you want?

Cheers,
Mike

···

I tried a manual formatter but I think there should be an easy way to set this in pyplot and I could not figure out how to display the tick numbers slanted.

Kind regards,

Pim Schellart

P.S. In the example number 2452298.7554547498 I also need to subtract 2440000 in order for the plot to render correctly. Otherwise all y values end up at the same x position which is a bug in the latest matplotlib release because it did not happen before.
------------------------------------------------------------------------

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom wrote:

Pim Schellart wrote:

Dear Matplotlib users/developers,

The default behaviour of matplotlib.pyplot is to display large (e.g.
2452298.7554547498 as a small number 0.25545474980026484 +
2.4522985e6) I would like to be able to do one of the following.

- Set the number to be subtracted manually (I know I can just subtract
a number from the input array but then matplotib still subtracts
another number if it thinks it is still to big to display).

I don't know if there's a straightforward way to do this... Maybe
someone more familiar with the ticking code can comment.

You can do
"ax.xaxis.set_major_formatter(ticker.FormatStrFormatter("%s"))" and then
the normal Python "%s"%myvar format handler will convert your datum to a
string.

The default formatter is pretty ugly in my opinion, as well. Someone
(me, probably) should endeavor to make rcParams out of this, as the
above code, or a variation of it, permeates my files.

···

- Force matplotlib to display the full number (and display the numbers
slanted so they do not overlap). This is my preferred option. I would
like to see this as a simple option in pyplot, perhaps as an extra
parameter in the xticks/yticks functions (for the y axis the numbers
don't need to be slanted).

You can do "xticks(rotation=45)" Does that do what you want?

Cheers,
Mike

I tried a manual formatter but I think there should be an easy way to
set this in pyplot and I could not figure out how to display the tick
numbers slanted.

Kind regards,

Pim Schellart

P.S. In the example number 2452298.7554547498 I also need to subtract
2440000 in order for the plot to render correctly. Otherwise all y
values end up at the same x position which is a bug in the latest
matplotlib release because it did not happen before.
------------------------------------------------------------------------

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options