set data point color based on y value

조회 수: 2 (최근 30일)
Robert Jones
Robert Jones 2012년 3월 5일
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개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by