How can I plot an array of data with different color?
Show older comments
I have a vector of numbers representing my data. Some of them are stable and some are not (based on my previous computations). Now how can I plot them on a same figure with different colours or symbols. I need a continuous curve. The stability information of each point is saved at another vector (consists of 0 for stable and 1 for unstable points). Number of data is high and the stability pattern is random.
Answers (1)
Azzi Abdelmalek
on 29 Aug 2013
x=0:0.01:20;
y=sin(x);
info=randi([0 1],numel(y),1);
y1=y;
y2=y;
y1(info==0)=nan
y2(info==1)=nan
plot(x,y1,'r')
hold on
plot(x,y2,'g')
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!