Is there any way in matplotlib that I can specify the number of digits to be used in the tick labels of an axis when there is a common exponent?
To be more specific, I have ticks on y-axis at [-3e-5, 0.0, 3e-5], and I want the label to be shown as -3.0, 0.0, 3.0 with the common factor 1e-5 shown at the top left outside. My matplotlib sets these labels as -3, 0, and 3 by omitting .0 from the string.
I tried using matplotlib.ticker.FormatStrFormatter as in this answer,
A. Matplotlib: Specify format of floats for tick lables
like,
ax.yaxis.set_major_formatter(FormatStrFormatter('%.1f'))
but then I can't get the common factor 1e-5.
I tried using
matplotlib.ticker.ScalarFormatter(useOffset=True)
to get the common factor, but then it looks I can specify the number of digits to be shown.
I would appreciate any help.