How to get matplotlib and latex work together?

后端 未结 1 1090
旧巷少年郎
旧巷少年郎 2021-01-13 05:19

I have the following problem and I am totally new to matplotlib and python: To produce high qualitiy plots for my thesis I want to use matplotlib and I want to use the latex

1条回答
  •  抹茶落季
    2021-01-13 05:58

    Your problem has been seen before as reported here on the matplotlib-user mailing list. The resolution is here and the confirmation that it works is here.

    In summary, you need to clear the tex.cache directory.

    To find where that directory is - go into python and execute matplotlib.get_cachedir()

    For a standard Ubuntu 14.04 install - you should get something like the following:

    ~$ python3
    Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
    [GCC 4.8.2] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import matplotlib as mpl
    >>> mpl.get_cachedir()
    '/home//.cache/matplotlib'
    

    Then do rm /tex.cache/* and then re-run and it should all work.


    Docs issue

    Some tips like this are available in the usetex troubleshooting docs section, which lead to here to locate the directory, but they unfortunately don't mention get_cachedir()

    Edit Pull Request generated based on this question and merged into the matplotlib docs.

    0 讨论(0)
提交回复
热议问题