python - 如何使用 matplotlib 在 python 中保存绘图?

标签 python matplotlib

使用时:

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

它返回:

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

但我看不到任何文件,它也没有显示。

我今天开始学习Python。 有人可以帮助我吗?

最佳答案

您可以使用savefig :

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

关于python - 如何使用 matplotlib 在 python 中保存绘图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31226180/

相关文章:

python 请求 GET 返回 HTTP 204

Python:单击带有 urllib 或 urllib2 的按钮

python - 如何使用 python 获取程序 PID

python - 如何从python中的随机分布中找到指数曲线(和曲线)下的面积?

python - 理解 "item for item in list_a if ..."Python

python - 将注释文本与颜色条标签文本对齐

python - Xaxis-Tick 标签已经消失,用 pandas 绘制到子图上,但仍被存储

Python 绘图簇 : high data dimension

python - 清除 matplotlib 图像上的叠加散点图

python - Pandas :按日期和另一个变量的中位数分组