set data point color based on y value

5 visualizaciones (últimos 30 días)
Robert Jones
Robert Jones el 5 de Mzo. de 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

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by