Consider the y ticks in this small example:
import matplotlib.pyplot as plt
plt.plot([200,400,600,800])
plt.ticklabel_format(axis='y',style='sci',scilimits=(0,0))
plt.show()
I would like the y tick labels to have a fixed format with one decimal, i.e., 1.0
instead of 1
, etc. How can I do that while keeping the exponent for the scientific notation on top of the plot?
All solutions I've found so far (most using FormatStrFormatter
instead of ScalarFormatter
) make the exponent repeat on all tick labels, like 1.0e2
, 2.0e2
, etc., which is not what I want.
Thank you in advance.