I am trying to save a matplotlib plot as a pdf page as shown in this example. Everything is fine until tex fonts are used. That is, I can display plots that use tex fonts, but not save them as a pdf. The error trace (shown below) indicates that I am lacking the font called
I am running under Ubuntu 16.04 LTS. I have checked that
gs are installed (and are at the latest version) and the directory where their executables appear is in
$PATH. The packages
texlive-latex-extra are installed as well, all as per this advice. How do I install the missing font(s)?
- After not succeeding to install
cmr12.ttxthrough the font viewer (see the reply of George and my comment there), I just copied it into
cmr10.ttxalready resided) and updated the cache as suggested here. I also cleaned
~/.cache/matplotlib/tex.cache. However, the error persists.
- I noticed that the file in the trace does not have the
.ttfextension... I also noticed that there are files
/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm. I tried copying these files into the directory from which the python script is run under the name
cmr12, but that was not liked...
Here is the trace:
Traceback (most recent call last): File "temp.py", line 45, in <module> d['ModDate'] = datetime.datetime.today() File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 2435, in __exit__ self.close() File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 2442, in close self._file.close() File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 547, in close self.writeFonts() File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 647, in writeFonts realpath, stat_key = get_realpath_and_stat(filename) File "/usr/lib/python2.7/dist-packages/matplotlib/cbook.py", line 1038, in __call__ stat = os.stat(realpath) OSError: [Errno 2] No such file or directory: '/home/meir/Dropbox/temp/cmr12'