代码示例:

from matplotlib import pyplot as plt
x = range(1,10) #x轴的位置
y = [6,7,12,12,15,17,15,20,18] #y轴的位置
#传入x,y,通过plot画图,并设置折线颜色、透明度、折线样式和折线宽度  标记点、标记点大小、标记点边颜色、标记点边宽
plt.plot(x,y,color='red',alpha=0.3,linestyle='--',linewidth=5,marker='o'
         ,markeredgecolor='r',markersize='20',markeredgewidth=10)
plt.show()

效果截图:

标记类型:

markersymboldescription
"."m00point
","m01pixel
"o"m02circle
"v"m03triangle_down
"^"m04triangle_up
"<"m05triangle_left
">"m06triangle_right
"1"m07tri_down
"2"m08tri_up
"3"m09tri_left
"4"m10tri_right
"8"m11octagon
"s"m12square
"p"m13pentagon
"P"m23plus (filled)
"*"m14star
"h"m15hexagon1
"H"m16hexagon2
"+"m17plus
"x"m18x
"X"m24x (filled)
"D"m19diamond
"d"m20thin_diamond
"|"m21vline
"_"m22hline
0 (TICKLEFT)m25tickleft
1 (TICKRIGHT)m26tickright
2 (TICKUP)m27tickup
3 (TICKDOWN)m28tickdown
4 (CARETLEFT)m29caretleft
5 (CARETRIGHT)m30caretright
6 (CARETUP)m31caretup
7 (CARETDOWN)m32caretdown
8 (CARETLEFTBASE)m33caretleft (centered at base)
9 (CARETRIGHTBASE)m34caretright (centered at base)
10 (CARETUPBASE)m35caretup (centered at base)
11 (CARETDOWNBASE)m36caretdown (centered at base)
"None"" " or "" nothing
'$...$'m37Render 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, 0, angle) A regular polygon with numsides sides, rotated by angle.
(numsides, 1, angle) A star-like symbol with numsides sides, rotated by angle.
(numsides, 2, angle) An asterisk with numsides sides, rotated by angle.

 

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐