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