plt保存PDF矢量文件中嵌入可编辑字体(可illustrator编辑)

背景:

用默认 plt.savefig() 保存图片,图中文字是以瞄点保存,而不是以文字格式。在编辑矢量图中,无法调整文字大小和字体。

方法:

python 复制代码
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")
相关推荐
敲上瘾7 小时前
Qt Widgets入门:项目模板解析与Hello World
开发语言·数据库·c++·qt·ui·qt6.3
Oll Correct1 天前
Adobe illustrator 案例十二:视频播放(Media & Video)图标绘制
笔记·ui·adobe·illustrator
行者-全栈开发2 天前
【鸿蒙心迹】国际化 i18n 与多语言资源管理实战(HarmonyOS 7.x)
ui·华为·重构·国际化·harmonyos·多语言
AI导出鸭PC端2 天前
Perplexity批量导出没有PDF模式?AI导出鸭插件补上最后一块拼图
人工智能·pdf·c#·ai导出鸭
Ravenq~2 天前
无头转换:把 .docx 变成 PDF,不打开编辑器
pdf·编辑器
寂寞的船3 天前
【Unity知识速递】第5期 Unity 6.2 深度解析:AI Assistant 登场,World Space UI 与 Sentis 全面升级
人工智能·ui·unity
联犀3 天前
纯 Go 的 CAD 开源库 go-cad:直接解析 DWG/DXF,现在也能导出 PDF
开发语言·golang·pdf
秋名山小白3 天前
Playwright UI 自动化测试实战教程
python·ui
wuyk5554 天前
PyQt6-第15讲-数据可视化QChart
python·ui·信息可视化·pyqt
Autumn_ing6 天前
Pixso AI 如何按团队设计规范生成 UI?以消息设置页说明选库与验收
人工智能·ui·设计规范·pixso