set data point color based on y value
7 次查看(过去 30 天)
显示 更早的评论
I am trying to get the data on a plot colored. I would prefer to set the color but dont know how to set color for a range of data. I guess I could either plot point by point and check the y value and change color accordingly or just graph it all then set the color. Ultimately I would like to graph values less than one in red, values of 1.0-1.08 in green and values over 1.08 in yellow.
pctTarget = coilData(:,17);
plot(pctTarget,'g');
hold on
plot(pctTarget(1:66),'r');
plot(pctTarget(766:4775),'Color','y');
axis([1,4775,0.5,1.5])
hold off
Thanks, Bob
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!