Colouring different regions on a graph.

조회 수: 1 (최근 30일)
Bhavick Singh
Bhavick Singh 2021년 5월 26일
댓글: Bhavick Singh 2021년 5월 27일
I have time series data which is non linear. It has really high and really low areas which I need to represent using different colours. Its a line graph. Please assist.

채택된 답변

Jakob B. Nielsen
Jakob B. Nielsen 2021년 5월 26일
Plot stepwise segments of your data? For example:
data=1000*rand(1000,1);
data=sort(data);
x=1:1:1000;
start=1;
figure
for i=1:100
if mean(data(start:start+10)) > 500
cc='r';
else
cc='b';
end
plot(x(start:start+10),data(start:start+10),cc);
hold on
start=i*10;
end
  댓글 수: 1
Bhavick Singh
Bhavick Singh 2021년 5월 27일
Hello, thanks for the answer. I have data in a excel spreadsheet. I have to draw a voltage vs time graph, and label the trends according to different colour. Please assist

댓글을 달려면 로그인하십시오.

추가 답변 (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