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

  • Post author:
  • Post category:python


下面是我创建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()



版权声明:本文为weixin_39721953原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。