1、运用matplotlib绘图保留要领:
起首,import头文件以下:
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.pyplot import plot,savefig
绘图:
fig, ax = plt.subplots(figsize=(12, 12)) ax.imshow(im, aspect='equal') #im是要显现的图象
保留图片:
savefig("D:/1.jpg")
展现图片:
plt.show()
2、turtle生成图片保留
代码示例以下:
from Tkinter import * from turtle import * import turtle forward(100) ts = turtle.getscreen() ts.getcanvas().postscript(file="duck.eps") #.eps文件即postscript剧本
更多Python相干技术文章,请接见Python教程栏目举行进修!
以上就是python绘图后怎样保留的细致内容,更多请关注ki4网别的相干文章!