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")
相关推荐
ZC跨境爬虫18 小时前
跟着 MDN 学 HTML day_12:(HTML网页图片嵌入)
前端·javascript·css·ui·html
PaperData20 小时前
2000-2025年《中国县域统计年鉴》pdf+excel版(附赠面板数据)
数据库·人工智能·数据分析·pdf·经管
狐狐生风20 小时前
LangChain实现简易版-----PDF 文档问答机器人
人工智能·langchain·机器人·pdf·prompt
王莎莎-MinerU1 天前
从 PDF 到知识资产:MinerU 文档解析如何成为企业 RAG 系统的“数据基石”
大数据·人工智能·pdf·个人开发
molihuan1 天前
最新 将 MuPDF 编译到 Android 动态库 PDF解析渲染引擎
android·pdf
ZC跨境爬虫1 天前
跟着 MDN 学 HTML day_11:(语义化容器全站重构+独立CSS拆分+字体合规引入)
前端·css·ui·重构·html·edge浏览器
ZC跨境爬虫1 天前
跟着 MDN 学 HTML day_10:(超链接核心语法+路径规则)
前端·css·笔记·ui·html·edge浏览器
ZC跨境爬虫1 天前
跟着 MDN 学 HTML day_9:(信件语义标记)
前端·css·笔记·ui·html
Muyuan19982 天前
27.RAG 系统中的上下文充分性判断:从 Chunk 数量、FAISS 距离到 LLM Relevance Gate
python·django·pdf·fastapi·faiss
Avalon7122 天前
Unity3D响应式渲染UI框架UniVue
游戏·ui·unity·c#·游戏引擎