I created this plot using Matlab
Using matplotlib, the x-axies draws large numbers such as 100000, 200000, 300000. I would like to have something like 1, 2, 3 and a 10^5 to indicate that it's actually 100000, 200000, 300000.
Is there a simple way to create such scale in matplotlib?
import matplotlib.pyplot as plt ... plt.ticklabel_format(style='sci', axis='x', scilimits=(0,0))
This applies scientific notation (i.e.
a x 10^b) to your x-axis tickmarks
This is not so much an answer to your original question as to one of the queries you had in the body of your question.
A little preamble, so that my naming doesn't seem strange:
import matplotlib from matplotlib import rc from matplotlib.figure import Figure ax = self.figure.add_subplot( 111 )
As has been mentioned you can use ticklabel_format to specify that matplotlib should use scientific notation for large or small values:
You can affect the way that this is displayed using the flags in rcParams (from matplotlib import rcParams) or by setting them directly. I haven't found a more elegant way of changing between '1e' and 'x10^' scientific notation than:
ax.xaxis.major.formatter._useMathText = True
This should give you the more Matlab-esc, and indeed arguably better appearance. I think the following should do the same: