I want to change the fontsize of the exponent as marked on the picture
I cannot use the matplotlib.rc('font', **font) method since I have different plots that need different font sizes so I change every element individually. I can however not find the font properties of the exponent.
1 Answer
If the exponent is an offset computed by matplotlib you can do the following to change the font size of the exponent to 30
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(1,1.0001,100)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x)
t = ax.yaxis.get_offset_text()
t.set_size(30)
plt.show()
2 Comments
jonnybolton16
For the record, this also works if the exponent is a multiplier too
Youjun Hu
if it is a colorbar, use something like this:
t = cbar.ax.yaxis.get_offset_text() t.set_size(12)
offsetText? If not, how is computed?