3

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)
2
  • 2
    there is way too much code here. Please reduce this to the minimum amount of code needed to demonstrate your problem. Commented Aug 26, 2014 at 23:21
  • thanks for the comment @tcaswell I've greatly reduced the code. Commented Aug 27, 2014 at 13:01

1 Answer 1

8

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:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.