Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib: changing font size of exponent

Tags:

matplotlib

I want to change the fontsize of the exponent as marked on the picture pic 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.

like image 437
sonium Avatar asked Dec 21 '22 08:12

sonium


1 Answers

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()
like image 145
Francesco Montesano Avatar answered Feb 04 '23 05:02

Francesco Montesano