Sunday 15 August 2010

python - How can I exponentially scale the Y axis with matplotlib -



python - How can I exponentially scale the Y axis with matplotlib -

i'm trying create matplotlib plot exponential(?) y axis false 1 i've mocked below. info want spread values out approach max y value. , i'd compress values y gets close zero.

all normal 'log' examples opposite: compress values away zero. 'log' of course. how can create exponential(?) scaling instead?

i assume mean x axis because in mock figure, x axis exponential, not y axis.

you can this:

... ax = plt.subplot(111) ax.plot(xs,ys,color='blue',linewidth=2) .... xlabs = [pow(10,i) in range(0,6)] ax.set_xticklabels(xlabs) ax.set_xticks(xlabs)

what doing here manually creating list of 6 xs each represented 10^i, i.e., 10^1,10^2,.... set x tick marks, , label them correctly, @ [1, 10, 100, 1000, 10000, 100000]. if need more labels, alter 6.

python matplotlib

No comments:

Post a Comment