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?
Matplotlib x-axis label boldPass the fontweight parameter to the xlabel() function to make the label bold.
Make Axis Title Text Bold Font with element_text() To make both x and y-axis's title text in bold font, we will use axis. title argument to theme() function with element_text(face=”bold”). Note now both x and y axis's title text are in bold font.
To make a text bold use \textbf command: Some of the \textbf{greatest} discoveries in science were made by accident.
The command fontweight='bold' can be used to make a textbox or label in figure bold.
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}"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With