I am creating some plots using matplotlib.
For the plots I am using style='sci'
with scilimits=(0,0)
Here is the code:
for key in urbs_values.keys():
# y-Axis (values)
u[key] = np.array(urbs_values[key])
o[key] = np.array(oemof_values[key])
# draw plots
plt.plot(i, u[key], label='urbs_'+str(key), linestyle='None', marker='x')
plt.ticklabel_format(axis='y', style='sci', scilimits=(0, 0))
plt.plot(i, o[key], label='oemof_'+str(key), linestyle='None', marker='.')
plt.ticklabel_format(axis='y', style='sci', scilimits=(0, 0))
This is usually consistent, but sometimes I am getting values on the y-axis in the format x.x
and sometimes I am getting x.xx
, and I don't really find it elegant.
Is there a way to force matplotlib to give me always y values in a format like x.x
via dynamically scale the scitific notation?
Here is an example plot that I don't like: