问题
So I am looking to simply format the offset string (at least that is what i think it is called, see image) that matplotlib places along with an axis that has been set to show tick labels in scientific notation, but where the range is less than one order of magnitude (power of 10).
here is what I am talking about: Essentially, how do I make it bigger/coloured?
回答1:
you can use ax.yaxis.get_offset_text() to access the offset text. You can then set the size and color on that Text object. For example:
import matplotlib.pyplot as plt
import numpy as np
fig,ax = plt.subplots()
ax.plot(range(10),np.linspace(0,1e11,10))
offset_text = ax.yaxis.get_offset_text()
offset_text.set_size(20)
offset_text.set_color('red')
plt.show()
来源:https://stackoverflow.com/questions/33748347/matplotlib-format-offset-string