2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

matplotlib フォントのエラー対処法

Posted at

問題点(エラー)

Ubuntu20.04に入れたpythonでmatplotlibを利用しようとすると、Latexでエラーが生じる。


import matplotlib
from matplotlib import pyplot
from matplotlib.ticker import MaxNLocator

pyplot.rcParams['ps.useafm'] = True
pyplot.rcParams['pdf.use14corefonts'] = True
pyplot.rcParams['text.usetex'] = True # ここをコメントアウトするとエラーは消える


x_tmp = numpy.random.randn(10)
y_tmp = numpy.random.randn(10)

pyplot.plot(x_tmp, y_tmp, 'r.', ls='None')


LaTeX Error: File `type1cm.sty' not found.

これは、UbuntuにLatexのフォントがうまく入っていないことによるものらしい。

対処法


$ sudo apt-get install dvipng texlive-base texlive-latex-extra 
texlive-fonts-recommended cm-super

とくに最後の「cm-super」が必須だった。

参考・出典
https://tex.stackexchange.com/questions/158700/latex-cant-find-sty-files-altough-packages-are-installed-texlive-ubuntu-12

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?