How to set the unit (scale factor, x1e5) on x axis?

Googled, looked for documentation, even tried the source code but couldn't
find it.

···


View this message in context: http://www.nabble.com/How-to-set-the-unit-(scale-factor%2C-x1e5)-on-x-axis--tp19475592p19475592.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

fernandof wrote:

Googled, looked for documentation, even tried the source code but couldn't
find it.

You may need to be more precise in describing what you want to do; it is far from clear to me from your subject line.

Eric

Hi Eric,

Reading it one day after I can tell it’s really unclear, sorry about that…

So, I want to plot a line, but controlling the labels on the tickers of the x axis. For instance, if I’m plotting (1000, 5), (2000, 10), (3000, 10), the ticks on the x axis might show 1000 2000 3000 or 1 2 3 x1e3. I want to control it, set it to 1 and obtain the first example, and set to 1000 and obtain the second one.

Thanks,
Fernando.

···

On Sun, Sep 14, 2008 at 8:53 PM, Eric Firing <efiring@…202…> wrote:

fernandof wrote:

Googled, looked for documentation, even tried the source code but couldn’t

find it.

You may need to be more precise in describing what you want to do; it is far from clear to me from your subject line.

Eric

Hi Fernando,

So, I want to plot a line, but controlling the labels on the tickers of the x axis. For instance, if I'm plotting (1000, 5), (2000, 10), (3000, 10), the ticks on the x axis might show 1000 2000 3000 or 1 2 3 x1e3. I want to control it, set it to 1 and obtain the first example, and set to 1000 and obtain the second one.

I not 100% clear what you want to achieve, however look into your matplotlib distribution for ticker.py

There is Formatter classes that control such things.

For example the existing ScalarFormatter, has a method set_scientific() to enable /disable scientific formatting. My reading of your description suggests this is what you are after or you might get some joy out of set_powerlimits() or the argument useOffset.

If your requirements are different you may need to create your own formatter class.

Steve

Stephen George wrote:

Hi Fernando,

So, I want to plot a line, but controlling the labels on the tickers of the x axis. For instance, if I'm plotting (1000, 5), (2000, 10), (3000, 10), the ticks on the x axis might show 1000 2000 3000 or 1 2 3 x1e3. I want to control it, set it to 1 and obtain the first example, and set to 1000 and obtain the second one.

I not 100% clear what you want to achieve, however look into your matplotlib distribution for ticker.py

There is Formatter classes that control such things.

For example the existing ScalarFormatter, has a method set_scientific() to enable /disable scientific formatting. My reading of your description suggests this is what you are after or you might get some joy out of set_powerlimits() or the argument useOffset.

If your requirements are different you may need to create your own formatter class.

The only thing I can add at this point is that there is also an Axes.ticklabel_format() method that calls set_scientific, and doesn't require you to dig around to figure out how to access the formatter.

Eric

···

Steve

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users