将matplotlib barplot打印到txt文件

时间:2018-08-15 07:52:36

标签: python matplotlib

我已经创建了条形图,并希望将其写入txt文件。 与其使用仅显示图像的plt.show()或使用plt.savefig()保存它,不如将条形图写入我的文件中

我当前正在打开txt文件,并想像下面那样将marplot添加到其中

with open('filename', 'w') as f: 
  f.write(some lines) 
  somehow write bar plot here 
  f.write(some more lines)

0 个答案:

没有答案