How can I set different colors to the line and the marker of my plot?
78 次查看(过去 30 天)
显示 更早的评论
%Link P4 and P5 x,y cordinates%
axis([-2 2 -2 2])
x4 = [P4(1), P5(1)];
y4 = [P4(2), P5(2)];
plot(x4,y4, 'black','b- .','MarkerSize',20);
hold on
I am trying to set a black line with blue markers, but am unable to do so. May I be assisted please? thank you ! :)
0 个评论
采纳的回答
Rohan Shekhawat
2020-5-24
Use this to get the desired output:
plot(x4,y4, "k-s", "MarkerFaceColor","b","MarkerSize",20);
Here:
k- is used to assign black line.
s is used to assign square marker. ( You may try out other markers like * etc )
"MarkerFaceColor","b" is used to assign marker colour.
"MarkerSize",20 is used to assign marker weight.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!