在做PAT的几何题是,为了方面看图,用一下python

读取文件x,y

python plt 画散点图

python plt 画散点图

import matplotlib.pyplot as plt
import numpy as np

with open("map.txt") as f:
    lines = f.readlines()
    n = int(lines[0])
    x = []
    y = []
    for i in range(n):
        line = lines[i+1].split(" ")
        x.append(int(line[0]))
        y.append(int(line[1]))

#                   记号形状       颜色           点的大小    设置标签
plt.scatter(x, y, marker = 'x',color = 'red', s = 40 ,label = 'First')

plt.legend(loc = 'best')    # 设置 图例所在的位置 使用推荐位置

plt.show()

相关文章:

  • 2022-12-23
  • 2021-08-05
  • 2021-06-24
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
猜你喜欢
  • 2021-12-09
  • 2021-04-29
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案