
使用matplotlib.pyplot进行绘图和保存的示例
5星
- 浏览量: 0
- 大小:None
- 文件类型:None
简介:
本教程展示了如何运用Python中的matplotlib.pyplot库来创建各种图表,并将这些图表保存为图片文件。适合初学者学习基本绘图技巧。
直接上代码:
```python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
bar_positions=[1,2,3,4]
bar_heights=[1,2,3,4]
print(np.arange(len([2, 2, 3, 4, 5])+1))
ax.bar(np.arange(len([2, 2, 3, 4, 5])), [1, 2, 3, 4, 5], 0.5)
# 设置x,y数据,区间
ax.set_xticks([1,2,3,4,5,6])
# 设置x轴刻度
```
全部评论 (0)
还没有任何评论哟~


