# Colouring different regions on a graph.

2 views (last 30 days)
Bhavick Singh on 26 May 2021
Commented: Bhavick Singh on 27 May 2021
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.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Accepted Answer

Jakob B. Nielsen on 26 May 2021
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 CommentShow -1 older commentsHide -1 older comments
Bhavick Singh on 27 May 2021
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

Sign in to comment.

### Categories

Find more on Discrete Data Plots in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!