matplotlib
中,您可以通过以下方式使轴标签的文本加粗:plt.xlabel('foo',fontweight='bold')
你也可以使用正确的后端与 LaTeX 配合使用
plt.xlabel(r'$\phi$')
然而,当它们结合在一起时,数学文本就不再是粗体了
plt.xlabel(r'$\phi$',fontweight='bold')
以下 LaTeX 命令似乎也没有任何作用。
plt.xlabel(r'$\bf \phi$')
plt.xlabel(r'$\mathbf{\phi}$')
如何在坐标轴标签中加粗符号 $\phi$
?
ValueError: \boldsymbol{\phi}^ Unknown symbol: \boldsymbol (at char 0), (line:1, col:1)
,也许需要加载amsmath
吗?你在你的机器上测试过吗? - Hookedmatplotlib.rc('text', usetex=True)
,matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
。不幸的是我还不能测试,等我有了结果会更新。 - Andy Hayden!LaTeX错误:找不到文件type1ec.sty。
- MRulesudo apt install cm-super
- 在 macOS 上:sudo tlmgr install cm-super
- 在其他系统上:请查看 https://repology.org/projects/?search=cmsuper 或 https://repology.org/projects/?search=cm-super 或 https://repology.org/projects/?search=fontsrecommended 中列出的软件包。 - Samuel Lelièvrematplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
对我没有用,但是matplotlib.rc('text.latex', preamble=r'\usepackage{amsmath}')
可行!感谢这篇文章。 - Mazeapt-get install cm-super
,我还需要执行apt-get install dvipng
。没有其他更改,这将提供\bf
符号,但不包括\mathbf
或\boldsymbol
。接下来添加rc('text', usetex=True); rc('text.latex',preamble=r"\usepackage{amsmath}")
就可以同时使用\mathbf
和\boldsymbol
了!成功了! - MRule