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")
相关推荐
xy34531 天前
Axure 9.0 垂直菜单介绍
ui·产品经理·axure·原型设计
w3296362711 天前
飞书接单到月度结算:我用一个 DSH 插件跑通鞋类采购 WMS,附 22 项验收
pdf·node.js·飞书·后端开发·ai agent
Oll Correct3 天前
Adobe illustrator 案例十四:花元素标志草图绘制
笔记·ui·adobe·illustrator
小熊熊知识库4 天前
双层PDF转换软件
pdf·双层pdf转换
huaqianzkh4 天前
WinForm C#:循环修改控件UI闪烁卡顿?SuspendLayout / ResumeLayout 与 BeginUpdate 优化
开发语言·ui·c#
Oll Correct5 天前
Adobe illustrator 案例十三:adidas标志草图绘制
笔记·ui·adobe·illustrator
FungLeo5 天前
成为全栈·Vue 管理后台篇·Vue3 + Vite + Naive UI:后台工程基座怎么搭
前端·vue.js·ui·typescript·vite·前端工程化·biome
敲上瘾6 天前
Qt Widgets入门:项目模板解析与Hello World
开发语言·数据库·c++·qt·ui·qt6.3
Oll Correct7 天前
Adobe illustrator 案例十二:视频播放(Media & Video)图标绘制
笔记·ui·adobe·illustrator
行者-全栈开发8 天前
【鸿蒙心迹】国际化 i18n 与多语言资源管理实战(HarmonyOS 7.x)
ui·华为·重构·国际化·harmonyos·多语言