I am using the the latest version: 3.2.0, and am using the PGF backend, as described here:
https://matplotlib.org/3.2.0/tutorials/text/pgf.html
When I save the figure, I get a warning that says:
User warning: steamed pgf-code does not support raster graphics, consider using the pgf-to-pdf option.
I have no idea what that means, and I can’t find anything like that in the documentation. Can someone tell me what I might be doing wrong?
Hi @physkets, can you please post a minimal version of your code here? It might be a default argument to a plotting method problem.
You may use some file named file.dat
with two columns of data.
import matplotlib as mpl
mpl.use("pgf")
PGF_WITH_RC_FONTS = {
"font.family": "serif",
"font.serif": [],
"font.sans-serif": [],
}
mpl.rcParams.update(PGF_WITH_RC_FONTS)
import matplotlib.pyplot as plt
import numpy as np
AXES = plt.gca()
FNAMES = []
FNAMES.append('file.dat')
i = 0
for data_file in FNAMES:
try:
X, Y = np.loadtxt(data_file, unpack=True)
except OSError:
print("No file at ", data_file)
else:
i += 1
AXES.plot(X, Y, f'C1.')
AXES.set_ylabel(r'$y$', fontsize='xx-large')
AXES.set_xlabel(r'$x$', fontsize='xx-large')
plt.savefig('figure.pgf', bbox_inches='tight')
This was accidentally introduced by https://github.com/matplotlib/matplotlib/pull/14134, but is later fixed by https://github.com/matplotlib/matplotlib/pull/15969, which was not in 3.2; I’ll backport it for 3.2.1.
1 Like