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")

posted on 2024-10-27 22:56  yohozu  阅读(80)  评论(0)    收藏  举报