Split the graph based on a specific value
Show older comments
I have a graph like this.

This image is the part of the plot and the mean of y(77449x1 array) is 0.4943.
I want to divide it into small graphs by cut the graph from the part where y is the average of y.
Is it possible? If so, can I know what to do?
Or is it simpler to plot after dividing the y-value array than dividing the graph?
Answers (1)
KSSV
on 15 Oct 2021
Let (x,y) be your data.
idx = knnsearch(y,mean(y)) ; % this will give index in y which is close to mean(y)
% plot
plot(x(1:idx),y(1:idx),'r')
hold on
plot(x(idx+1:end),y(idx+1:end),'b')
Categories
Find more on Directed Graphs 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!