Clear Filters
Clear Filters

Color individual data points

24 views (last 30 days)
I have this plot
plot(strain,Ystress,'LineWidth',2, "MarkerSize",5, "MarkerFaceColor",[0 0.4470 0.7410], "MarkerEdgeColor",[0 0.4470 0.7410] );
it plots all my data points (29 of them) blue
There is one data point (say strain(4), Ysress(4)) I want to be red and another data point (say strain(10), Ysress(10)) I want to be green how would I do this?

Accepted Answer

Image Analyst
Image Analyst on 16 Aug 2020
One way is to just stamp a new marker right on top of the existing one:
plot(strain,Ystress,'LineWidth',2, "MarkerSize",5, "MarkerFaceColor",[0 0.4470 0.7410], "MarkerEdgeColor",[0 0.4470 0.7410] );
hold on;
plot(strain(4),Ystress(4), 'r.', "MarkerSize", 25); % Big red dot.
plot(strain(10),Ystress(10), 'g.', "MarkerSize", 25); % Big green dot.
hold off;
  1 Comment
Claire Andreasen
Claire Andreasen on 17 Aug 2020
Thank you!!! (I was missing the hold on and off hahah)

Sign in to comment.

More Answers (0)

Categories

Find more on Colormaps in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!