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

相关推荐

  1. 将Matlab图窗视化保存为背景透明的矢量

    2024-03-14 06:52:04       62 阅读
  2. 实现编辑excel

    2024-03-14 06:52:04       62 阅读
  3. GNU nano编辑文件保存文件

    2024-03-14 06:52:04       29 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-14 06:52:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-14 06:52:04       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-14 06:52:04       87 阅读
  4. Python语言-面向对象

    2024-03-14 06:52:04       96 阅读

热门阅读

  1. 基于R语言APSIM模型应用

    2024-03-14 06:52:04       38 阅读
  2. CentOS安装MySQL详细教程

    2024-03-14 06:52:04       40 阅读
  3. Adb无线连接调试

    2024-03-14 06:52:04       39 阅读
  4. 在linux中关于R包devtools的安装

    2024-03-14 06:52:04       53 阅读
  5. 服务器中间件的种类和日常使用

    2024-03-14 06:52:04       41 阅读