matplotlib display axis in scientific notation 1

matplotlib display axis in scientific notation

plt.ticklabel_format(axis="x", style="sci", scilimits=(0,0))

Here is what the above code is Doing:
1. We’re creating a figure object called fig, and an axis object in that figure called ax.
2. We’re plotting our data on that axis, with the label “Our Data” and then plotting a line plot of the mean on the same axis.
3. We’re setting the axis labels by passing in a list as such: [xlabel, ylabel].
4. We’re saving the current figure as “lineplot.png” to the “results” directory.
5. We’re changing the scale of the x-axis to be scientific notation.

Similar Posts