I have an image:

Here on the y axis, I would like to get 5x10^-5 4x10^-5 , etc. instead of 0.00005 0.00004 .
I have tried so far:
fig = plt.figure() ax = fig.add_subplot(111) y_formatter = matplotlib.ticker.ScalarFormatter(useOffset=True) ax.yaxis.set_major_formatter(y_formatter) ax.plot(m_plot,densities1,'-ro',label='0.0<z<0.5') ax.plot(m_plot,densities2, '-bo',label='0.5<z<1.0') ax.legend(loc='best',scatterpoints=1) plt.legend() plt.show()
This does not work. The document page for tickers does not seem to give a direct answer.
python matplotlib axes ticker
user3397243
source share