Matplotlib绘图并保存图像但不显示图形

转自http://blog.csdn.net/rumswell/article/details/7342479

import numpy as np

import matplotlib
matplotlib.use('Agg')

from matplotlib.pyplot import plot,savefig

x=np.linspace(-4,4,30)
y=np.sin(x);

plot(x,y,'--*b')

savefig('D:/MyFig.jpg')

你可能感兴趣的:(Matplotlib绘图并保存图像但不显示图形)