【问题标题】:Failing to export properly to svg and pdf with matplotlib无法使用 matplotlib 正确导出到 svg 和 pdf
【发布时间】:2013-05-09 11:33:37
【问题描述】:

我正在尝试从基于此示例的交互式路径编辑器中保存.svg 图像:path_editor.py。保存 PNG 图像效果很好,但是当我保存为 SVG 或 PDF 时,路径不会导出。

fig.savefig('out.svg')   # missing paths
fig.savefig('out.pdf')   # missing paths
fig.savefig('out.png')   # ok

在这种情况下,为了获得一个工作的 SVG 文件,是否需要做任何额外的步骤?

我将 matplotlib 1.2.1 与 Python 2.7 一起使用。

PNG 文件

SVG 文件

更新

这显然是 matplotlib 中的一个错误。我按照@tcaswell 的建议在他们的 github 项目上创建了an issue

【问题讨论】:

  • 你使用的是什么版本的mpl
  • 我正在使用 matplotlib 1.2.1 和 Python 2.7。
  • 闻起来像个 bug,我可以确认它存在于 master 上。我会在 github 上创建一个问题。
  • @tcaswell: pdf 应该支持 alpha,它是 eps 不支持

标签: python pdf svg matplotlib interactive


【解决方案1】:

这确实是matplotlib 中的一个错误。已创建patch,问题已解决。已合并到master1.2.x

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-28
    • 2023-03-06
    • 1970-01-01
    • 2018-05-10
    • 1970-01-01
    • 2018-06-28
    • 2017-04-11
    • 2023-03-13
    相关资源
    最近更新 更多