简体   繁体   English

如何使用matplotlib在python中保存一个图?

[英]How can I save a plot in python using matplotlib?

When using: 使用时:

In [42]: tz_counts[:10].plot(kind='barh', rot=0)

it return: 它返回:

Out[42]: <matplotlib.axes._subplots.AxesSubplot at 0x7fa216b464d0>

But I can't see any file, it isn't showing either. 但我看不到任何文件,它也没有显示。

I start learning python today. 我今天开始学习python。 Can someone help me? 有人能帮我吗?

You can use savefig : 你可以使用savefig

import matplotlib.pyplot as plt
plt.plot(range(10), range(10))
plt.savefig('a.pdf')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Python matplotlib绘制带有4个象限的图形或图形? - How can I draw a graph or plot with 4 quadrants using Python matplotlib? 我如何在 Python 中使用 matplotlib plot 一条最佳拟合线? - How can I plot a line of best fit using matplotlib in Python? 我无法使用Matplotlib将其以pdf格式保存 - I can not save a plot in pdf format using Matplotlib 如何保存 matplotlib plot 即 output 的 output in jupyC425268E68385D1AB507 - How can I save a matplotlib plot that is the output of a function in jupyter? 如何在 Python 中使用 matplotlib 将第二个子 plot 放在第一个子 plot 之上? - How can I bring second sub plot on top of first sub plot using matplotlib in Python? python matplotlib保存图 - python matplotlib save plot 在python下使用pandas,如何使用matplotlib绘制日期? - Using pandas under python, how can I plot dates using matplotlib? 如何使用 Matplotlib 在 1 个 plot 中进行 plot 2 个映射? (Python) - How to plot 2 maps in 1 plot using Matplotlib? (Python) 如何在 Python 中使用 pandas 和 matplotlib 绘制条形图时删除条形之间的空间? - How can I remove space between bars while plotting bar plot using pandas and matplotlib in Python? 如何使用 Matplotlib 在 Python 中自动订购堆叠条 plot? - How can I automate the ordering of a Stacked Bar plot in Python using Matplotlib?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM