Putting newline in matplotlib label with TeX in Python?
Posted
by user248237
on Stack Overflow
See other posts from Stack Overflow
or by user248237
Published on 2010-04-17T22:32:17Z
Indexed on
2010/04/17
22:43 UTC
Read the original article
Hit count: 188
How can I add a newline to a plot's label (e.g. xlabel or ylabel) in Matplotlib? For example,
plt.bar([1, 2], [4, 5])
plt.xlabel("My x label")
plt.ylabel(r"My long label with $\Sigma_{C}$ math \n continues here")
Ideally i'd like the y-labeled to be centered too. Is there a way to do this? It's important that the label have both tex (enclosed in '$') and the newline.
thanks.
© Stack Overflow or respective owner