0

While running the following code:

import matplotlib.pyplot as plt

plt.rcParams['text.usetex'] = True

plt.plot(range(10))
plt.savefig("plot.pdf")

I get the very long error, finally saying FileNotFoundError: [Errno 2] No such file or directory: ''. The code was working fine some time ago. However, when using the backend="pgf" backend, the figure is saved as desired. What is the reason for this?

I cleared matplotlib config and cache before.

>>>!python -V
Python 3.9.10
>>>print(matplotlib.__version__)
3.5.1
gasar8
  • 306
  • 4
  • 12

1 Answers1

0

Alt. way: try to save as .svg, then convert online to .pdf.

I recommend this site.