matplotlib绘制散点图

  • 使用scatter()绘制散点图并设置其样式
    • import matplotlib.pyplot as plt
      
      
      xValue = [1, 2, 3, 4, 5]
      yValue = [1, 4, 9, 16, 25]
      
      # 要绘制单个点,可使用函数scatter(),并向她传递包含x值和y值的列表
      plt.scatter(xValue, yValue, s=100)  # s表示点的半径大小
      plt.show()
      

        

  • 使用scatter()绘制一系列点
    •   
      import matplotlib.pyplot as plt
      
      
      xValue = [1, 2, 3, 4, 5]
      yValue = [1, 4, 9, 16, 25]
      
      # 要绘制单个点,可使用函数scatter(),并向她传递包含x值和y值的列表
      plt.scatter(xValue, yValue)
      plt.show()
      

        

猜你喜欢

转载自www.cnblogs.com/endian11/p/9071037.html