python plt图片保存emf类型_如何获得emf/wmf格式的matplotlib图形?

本文介绍了一个Python类SVG_WMF_Plot,该类利用matplotlib创建图形并借助Inkscape将其保存为WMF和SVG格式。通过调用TestPlot方法,可以自定义图形,然后使用SaveAndClosePlot方法保存为不同格式,包括高分辨率的JPG、SVG,并通过Inkscape转换为WMF。
摘要由CSDN通过智能技术生成

下面是我创建WMF和SVG的解决方案。您可以安装Inkscape并使用以下类,'SaveAndClosePlot'创建SVG,然后使用它转换为WMF的Inkscape。TestPlot函数可以根据您的需要进行定制。在import os

from pathlib import Path

from ConfigParserM import logging

import subprocess

from matplotlib import pyplot as plt

class SVG_WMF_Plot:

def __init__(self):

self.__folderNameGraph = 'Graphs'

self.__WMF_SVGSaving = True

self.__inkScapePath = "C://Program Files//inkscape//inkscape.exe"

self.__figureDPI = 500

def getRootDirectory(self):

try:

return Path(os.path.dirname(os.path.realpath('__file__')))

except Exception as e:

logging.exception(e)

raise

def getAddressTo(self, Main=None, FolderName=None, FileName=None, Extension=None):

try:

if Main is None:

Main = self.getRootDirectory()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值