matplotlib.pyplot.scatter()函式用法
阿新 • • 發佈:2018-11-20
參考地址:https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html?highlight=scatter#matplotlib.pyplot.scatter
函式原型:matplotlib.pyplot.
scatter
(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None , verts=None, edgecolors=None, *, data=None, **kwargs)
引數解釋:x,y:資料座標
s:散點的大小
c:散點的顏色 如果輸入int就會自動生成指定數量種類的顏色給散點顯示 如c=3就會生成3種不同顏色的散點
marker:散點的形狀,引數對應表如下:
marker | symbol | 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 | |
0 (TICKLEFT ) |
tickleft | |
1 (TICKRIGHT ) |
tickright | |
2 (TICKUP ) |
tickup | |
3 (TICKDOWN ) |
tickdown | |
4 (CARETLEFT ) |
caretleft | |
5 (CARETRIGHT ) |
caretright | |
6 (CARETUP ) |
caretup | |
7 (CARETDOWN ) |
caretdown | |
8 (CARETLEFTBASE ) |
caretleft (centered at base) | |
9 (CARETRIGHTBASE ) |
caretright (centered at base) | |
10 (CARETUPBASE ) |
caretup (centered at base) | |
11 (CARETDOWNBASE ) |
caretdown (centered at base) | |
"None" , " " or "" |
nothing | |
'$...$' |
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 | A Path instance. |
|
(numsides, style, angle) |
The marker can also be a tuple
|
cmap:指定顏色對映
norm,vmin,vmax..:都是亮度,外觀相關設定詳見頂部網址。