matplotlib.pyplot.scatter()函数用法

参考地址:https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html?highlight=scatter#matplotlib.pyplot.scatter

函数原型:matplotlib.pyplot.scatter(xys=Nonec=Nonemarker=Nonecmap=Nonenorm=Nonevmin=Nonevmax=Nonealpha=Nonelinewidths=Noneverts=Noneedgecolors=None*data=None**kwargs)

参数解释:x,y:数据坐标

     s:散点的大小

                  c:散点的颜色 如果输入int就会自动生成指定数量种类的颜色给散点显示 如c=3就会生成3种不同颜色的散点

                  marker:散点的形状,参数对应表如下:

marker symbol description
"." m00 point
"," m01 pixel
"o" m02 circle
"v" m03 triangle_down
"^" m04 triangle_up
"<" m05 triangle_left
">" m06 triangle_right
"1" m07 tri_down
"2" m08 tri_up
"3" m09 tri_left
"4" m10 tri_right
"8" m11 octagon
"s" m12 square
"p" m13 pentagon
"P" m23 plus (filled)
"*" m14 star
"h" m15 hexagon1
"H" m16 hexagon2
"+" m17 plus
"x" m18 x
"X" m24 x (filled)
"D" m19 diamond
"d" m20 thin_diamond
"|" m21 vline
"_" m22 hline
0 (TICKLEFT) m25 tickleft
1 (TICKRIGHT) m26 tickright
2 (TICKUP) m27 tickup
3 (TICKDOWN) m28 tickdown
4 (CARETLEFT) m29 caretleft
5 (CARETRIGHT) m30 caretright
6 (CARETUP) m31 caretup
7 (CARETDOWN) m32 caretdown
8 (CARETLEFTBASE) m33 caretleft (centered at base)
9 (CARETRIGHTBASE) m34 caretright (centered at base)
10 (CARETUPBASE) m35 caretup (centered at base)
11 (CARETDOWNBASE) m36 caretdown (centered at base)
"None"" or ""   nothing
'$...$' m37 Render the string using mathtext. E.g "$f$" for marker showing the letter f.
verts   A list of (x, y) pairs used for Path vertices. The center of the marker is located at (0,0) and the size is normalized, such that the created path is encapsulated inside the unit cell.
path   Path instance.
(numsides, style, angle)  

The marker can also be a tuple (numsides, style, angle), which will create a custom, regular symbol.

numsides:
the number of sides
style:

the style of the regular symbol:

  • 0: a regular polygon
  • 1: a star-like symbol
  • 2: an asterisk
  • 3: a circle (numsides and angle is ignored); deprecated.
angle:
the angle of rotation of the symbol

    cmap:指定颜色映射

    norm,vmin,vmax..:都是亮度,外观相关设置详见顶部网址。

猜你喜欢

转载自www.cnblogs.com/ZengWeiHao/p/9992269.html