擅长:python、mysql、java
<p>如果创建一个图形,则可以使用canvas对象获取可用的受支持文件格式:</p>
<pre><code>import matplotlib.pyplot as plt
fig = plt.figure()
print fig.canvas.get_supported_filetypes()
>>> {
'svgz': 'Scalable Vector Graphics',
'ps': 'Postscript',
'emf': 'Enhanced Metafile',
'rgba': 'Raw RGBA bitmap',
'raw': 'Raw RGBA bitmap',
'pdf': 'Portable Document Format',
'svg': 'Scalable Vector Graphics',
'eps': 'Encapsulated Postscript',
'png': 'Portable Network Graphics'
}
</code></pre>
<p>它将列出所有可以输出当前对象的格式。</p>