如何检索 Matplotlib savefig() 函数支持的文件格式列表?
要检索matplotlibsavefig()函数支持的文件格式列表,我们可以使用get_supported_filetypes().
脚步
首先获取当前数字。
设置包含图形的画布。
使用get_supported_filetypes()方法。
迭代文件类型项。
要显示图形,请使用show()方法。
示例
from matplotlib import pyplot as plt fs = plt.gcf().canvas.get_supported_filetypes() for key, val in fs.items(): print(key, ":", val)输出结果
eps : Encapsulated Postscript jpg : Joint Photographic Experts Group jpeg : Joint Photographic Experts Group pdf : Portable Document Format pgf : PGF code for LaTeX png : Portable Network Graphics ps : Postscript raw : Raw RGBA bitmap rgba : Raw RGBA bitmap svg : Scalable Vector Graphics svgz : Scalable Vector Graphics tif : Tagged Image File Format tiff : Tagged Image File Format
热门推荐
10 对转校同学祝福语简短
11 书法朋友祝福语简短精辟
12 祝女儿结婚简短祝福语
13 伴娘祝福语简短朋友的话
14 中秋祝福语简短带署名
15 自由 生日祝福语简短独特
16 朋友聚会结束祝福语简短
17 古风祝福语 唯美简短结婚
18 新婚宴祝福语简短大全