How can I generically change the position of my ticklabels' offset value?
I prepare a routine that plots a multitude of datasets with a wide range of orders of magnitude. The presentation should look very similar for all, though. My issue is that for some datasets pyplot will introduce an offset to the ticklabels. This scaling factor is then having an overlay with the title instance to which I must not change the location.
Possible solutions could be the offset to appear
- at the bottom of my y-axis (prefered)
- as a y-label (okay)
- padded above the title (ugly, but would take it)
Here is a MWE:
import numpy as np
import matplotlib.pyplot as plt
from numpy.random import default_rng
rng = default_rng()
vals = rng.standard_normal(40)/1000
ydata=np.linspace(1000.1, 1000.5, 40)+vals
xdata=np.arange(40)
fig=plt.figure(figsize=(3,3))
plt.title(str(np.mean(ydata)), loc='left')
plt.plot(xdata, ydata)
plt.show()
matplotlib: format axis offset-values to whole numbers or specific number seems to be a related problem but I cannot make it work for me.