set data point color based on y value

5 vues (au cours des 30 derniers jours)
Robert Jones
Robert Jones le 5 Mar 2012
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

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by