如何检索 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 姐妹生日二十祝福语简短