【Python】绘制二维散点图 代码分享

2021-11-01 09:11:30 浏览数 (2)

import matplotlib.pyplot as plt

# 解决不能显示中文

plt.rcParams['font.sans-serif'] = ['SimHei']

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

plt.title("二维散点图", fontsize=24)

plt.xlim(xmax=9,xmin=0)

plt.ylim(ymax=9,ymin=0)

#点的坐标分别为[0, 0], [3, 8], [1, 1], [2, 2], [5, 3], [4, 8], [6, 3], [5, 4], [6, 4], [7, 5]

plt.plot([0,3,1,2,5,4,6,5,6,7],[0,8,1,2,3,8,3,4,4,5],'ro')

plt.savefig('testblueline.jpg')

0 人点赞