Reputation: 3961
How can I change the font size within the same matplotlib's y axis text. In the code below how put the unit (i.e., m4 kg-1 s-1) in smaller font below the name of the variable (i.e., Resistance)?
import matplotlib.pyplot as plt
plt.plot([1], [1])
plt.ylabel('Total resistance\nm$^{4}$ kg$^{-1}$s$^{-1}$', multialignment='center', fontsize=12, labelpad=5)
Upvotes: 3
Views: 2275
Reputation: 97261
How about use _
:
pl.plot([1], [1])
pl.ylabel('Total resistance\n$\\regular_{{m}^{4} kg^{-1}s^{-1}}$', fontsize=20)
Here is the output:
Upvotes: 8