如何检索 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 兄妹拍照祝福语简短的话