I want to change fontsize of my matplotlib.pyplot graph and I figured out how to change fontsize of label, ticks. But I still don't know when y scale is so small, how to change scale fontsize (such as 1e-17 at the following image) which indicate the scale on the top left of the figure. Is any option to make this possible in matplotlib.pyplot?
here's my example code.
import numpy as np
a = np.arange(0, 1e-8, 1e-9)
plt.figure(figsize = (10,6))
plt.plot(a,a**2)
plt.xticks(fontsize = 30)
plt.yticks(fontsize = 30)
with several command, I can change fontsize of x, y ticks, but I cannot find the command for scale fontsize.
CodePudding user response:
You can simply do it by setting default font-size, as follows:
import matplotlib.pyplot as plt
import numpy as np
plt.rc('font', size=30) # This line makes it work!
a = np.arange(0, 1e-8, 1e-9)
plt.figure(figsize = (10,6))
plt.plot(a,a**2)
plt.xticks(fontsize = 30)
plt.yticks(fontsize = 30)
plt.show()