matplotlibでbmやboldsymbolを使う
各versionは以下の通り.
- Python 3.8.13
- matplotlib 3.6.2
Latex環境の構築
apt-get install texlive texlive-latex-extra texlive-fonts-recommended dvipng cm-super pip3 install latex
bm
を使う場合のコード例.
import matplotlib.pyplot as plt plt.rcParams['text.usetex'] = True plt.rc('text.latex', preamble=r'\usepackage{bm}') plt.title(r'Bold $\bm{A}$')
boldsymbol
を使う場合のコード例.
import matplotlib.pyplot as plt plt.rcParams['text.usetex'] = True plt.rc('text.latex', preamble=r'\usepackage{amsmath}') plt.title(r'Bold $\boldsymbol{A}$')