保存为png图片
fig = plt.gcf()
print "ImageSave Done!"
fig.savefig(outPut)
保存为base64文件
先保存为png图片,然后将其转化为base64文件
figfile = BytesIO()
fig.savefig(figfile, format='png')
figfile.seek(0) # rewind to beginning of file
figdata_png = base64.b64encode(figfile.getvalue())