本文主要是介绍plt保存PDF矢量文件中嵌入可编辑字体(可illustrator编辑),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
背景:
用默认 plt.savefig() 保存图片,图中文字是以瞄点保存,而不是以文字格式。在编辑矢量图中,无法调整文字大小和字体。
方法:
import matplotlib.pyplot as plt
import numpy as np# ------输出的图片为illustrator可编辑的字体---------
plt.rcParams['pdf.fonttype'] = 42
# plt.rcParams['ps.fonttype'] = 42 # 如果不行,就取消这个注释
# ---------------------------------------------xpoints = np.array([0, 6])
ypoints = np.array([0, 100])plt.plot(xpoints, ypoints)
plt.title("jjjjjkkklll")
# 保存pdf
plt.savefig("0.pdf", format="pdf")
这篇关于plt保存PDF矢量文件中嵌入可编辑字体(可illustrator编辑)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!