保存为可编辑文字的矢量图
import matplotlib.pyplot as plt
from matplotlib import rcParams
# 设置字体嵌入类型为42(可编辑文本)
rcParams['pdf.fonttype'] = 42
# 绘制图形并保存为PDF
plt.plot([1, 2, 3], [4, 5, 6])
plt.xlabel('X轴')
plt.ylabel('Y轴')
# 保存为PDF文件
plt.savefig("output.pdf", format="pdf")