0
点赞
收藏
分享

微信扫一扫

Python折线图详细绘制讲解

捡历史的小木板 2022-04-04 阅读 118
数据分析
import matplotlib.pyplot as plt

# 中文乱码和坐标轴负号处理。
plt.rc('font', family='SimHei', weight='bold')

plt.rcParams['axes.unicode_minus'] = False


y = [71, 94.1, 47.1, 72.4, 86.1, 79, 71, 73.3, 55, 39.1]

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

plt.figure(figsize=(7,4)) #画布大小

plt.plot(x, y, 'b', lw = 1.5) # 蓝色的线

plt.plot(x, y, 'ro') #离散的点

plt.grid(True)

plt.axis('tight')

plt.xlabel('排名')

plt.ylabel('价格')

plt.title('前10名价格走势')

plt.show()
举报

相关推荐

0 条评论