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 |