欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Matplotlib使用记录

程序员文章站 2022-03-19 10:44:49
...

Scatter Plot

import numpy as np
import matplotlib.pyplot as plt

height = [164, 170, 182, 175, 173, 163]
weight = [77, 88, 99, 57, 86, 88]

plt.scatter(height, weight, linewidths=10) #, alpha=0.2 ,s=5 ,c='r', marker = '*'
plt.show()

x,y  :输入的数组(n,1)维

alpha :控制画出点的透明度       取值:0~1

s        :控制画出点的面积           取值:可以接收(n, 1)数组

c       :控制点的颜色                 取值:rgb

marker:控制点的形状                 取值:见表

marker description
"." point
"," pixel
"o" circle
"v" triangle_down
"^" triangle_up
"<" triangle_left
">" triangle_right
"1" tri_down
"2" tri_up
"3" tri_left
"4" tri_right
"8" octagon
"s" square
"p" pentagon
"P" plus (filled)
"*" star
"h" hexagon1
"H" hexagon2
"+" plus
"x" x
"X" x (filled)
"D" diamond
"d" thin_diamond
"|" vline
"_" hline
……