rescale and normalize x axis numbers in python3.2 and matplotlib
Question: I am working in python 3.2 and matplotlib.

The numbers of x-axis are between 0 and 1000000.

In my plot, the numbers of x-axis are long and overlap each other.

I want to re-scale and normalize them between 0 and 10 and also show the unit
(such as 10^6) around the x-axis.

How can I do that?

Any help would be appreciated.


Answer: use `set_powerlimits()`:

    
    
    import pylab as pl
    x = np.linspace(0, 1000000, 100)
    y = x * 2
    
    pl.plot(x, y)
    ax = pl.gca()
    xaxis = ax.xaxis
    xaxis.major.formatter.set_powerlimits((0, 4))
    

