importmatplotlib.pyplotaspltimportnumpyasnp# 生成数据x=np.linspace(0,10,100)y=np.sin(x)# 绘制线条和Markerplt.plot(x,y,color='blue',label='Sine Wave',linewidth=2)# 设置线条颜色plt.scatter(x,y,color='red',label='Data Points',marker='o')# 设置Marker颜色# 添加图例plt.legend()# 添加...
plt.plot(x, y, lineStyle = 'dashdot') 1. ④设置标注类型: marker属性 有不同的marker可以选择,比如’o’,’*’,‘x’。 plt.plot(x, y ,marker='x') 1. ⑤设置图例: label属性。 plt.plot(x, y ,marker='o',label='语文成绩') plt.plot(x, y ,marker='*',label='数学成绩') plt.p...
markeredgecolor='r' 设置标志marker的边线颜色,marker的内心颜色随线走保持一直,marker的边框颜色可以在这里单独设置 markeredgewidth=1.5 设置标志marker的边框(边线)的粗细 另外再给出一个例子: importmatplotlib.pyplot as plt plt.plot([0,1, 2, 3, 4, 5], [0.1, 0.2, 0.3, 0.4, 0.5, 0.6],\ color=...
plt.plot(b,b*1.0,'g.-',b,b*1.5,'rx',b,b*2.0,'b') plt.show() **kwargs: 第二组或更多(x,y,format_string) color: 控制颜色, color='green' linestyle: 线条风格, linestyle='dashed' marker: 标记风格, marker='o' markerfacecolor: 标记颜色, markerfacecolor='blue' markersize: 标记尺寸...
常用颜色: 'b' 蓝色 'g' 绿色 'r' 红色 'c' 青色 'm' 品红 'y' 黄色 'k' 黑色 'w' 白色 更多颜色: plt.plot(x, y, marker='+', color='coral') color 常用标记点形状: ‘.’:点(point marker) ‘,’:像素点(pixel marker)
plt.plot(x,y,linestyle='--',linewidth=1,color='blue',marker='o',markersize=6,markeredgecolor='black') plt.xlabel('你的状态',fontsize=20,color='green') plt.ylabel('对象心中你的重要程度',fontsize=20,color='green') plt.xticks([0.0,0.2,0.4,0.6,0.8,1.0],['找借口认识她的你','约她...
python绘图库matplotlib:画线的标志marker的设置——类型/size/空心/边线颜色及大小/显示marker超出边界部分 如题,最近有绘图的工作,要求就是使用python绘图库来画线并打上坐标点的标志,这时候就遇到了问题,这个线上的标志如果是实心的话就难以有区分度,但是设置为空心就需要考虑标志的边线粗细等问题,于是便有了本文...
plot(x,y,color,marker,linestyle) x, y:横坐标和纵坐标 color:颜色,取值:b(blue), g(green), r(red), c(cyan), m(magenta), y(yellow), k(black), w(white) marker:标记形状,取值:. , o v ^ < > 1 2 3 4 s p * h H + x D d | _ ...
3. plot支持多个参数,如color(颜色),marker(标记点),linestyle(线条风格),linewidth(线宽),markersize(标记点大小)等。 把这些参数都加进去看一下效果。 plt.plot(x_labels, y_data1, color='green', marker='o', linestyle='dashed',linewidth=2, markersize=12) ...