Issue
In matplotlib
you can make the text of an axis label bold by
plt.xlabel('foo',fontweight='bold')
You can also use LaTeX with the right backend
plt.xlabel(r'$\phi$')
When you combine them however, the math text is not bold anymore
plt.xlabel(r'$\phi$',fontweight='bold')
Nor do the following LaTeX commands seem to have any effect
plt.xlabel(r'$\bf \phi$')
plt.xlabel(r'$\mathbf{\phi}$')
How can I make a bold $\phi$
in my axis label?
Solution
Unfortunately you can't bold symbols using the bold font, see this question on tex.stackexchange.
As the answer suggests, you could use \boldsymbol
to bold phi:
r'$\boldsymbol{\phi}$'
You'll need to load amsmath
into the TeX preamble:
matplotlib.rc('text', usetex=True)
matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
Answered By - Andy Hayden
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.