How can I set different colors to the line and the marker of my plot?

12 views (last 30 days)
%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 ! :)

Accepted Answer

Rohan Shekhawat
Rohan Shekhawat on 24 May 2020
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.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!