How can I create a break in the y-axis (looking like a flash; example below)?
Show older comments
Hello community members,
I would be glad to get some help in order to create a break in the y-axis looking like the example below.
I've seen related posts concerning this topic, yet I've not been able to achieve the desired result myself.
All the best,
Max

5 Comments
Hayden Garmon
on 2 Sep 2020
Try checking here
https://blogs.mathworks.com/pick/2008/11/21/breaking-a-plot-to-improve-visualization/#3
Adam Danz
on 2 Sep 2020
If your plots also do not contain any data below the break point, it might be easiest just to plot your, set the ylim so there's space at the bottom, and then change the y-tick-labels to represent the discontinuity. You can also add text at the break to indicate that there is a break.
J. Alex Lee
on 3 Sep 2020
Even if you did have data below the breakpoint, you could "fake it" by shifting those data up, keeping track of the shift, and "fake" the yticklabel strings to account for the shifts.
Adam Danz
on 3 Sep 2020
You may have to also vertically scale the data unless the tick intervals are the same below and above the break. If data are plotted below the break I would recommend using two axes that share a border. That way you don't have to deal with setting tick labels that don't match the actual ticks.
J. Alex Lee
on 3 Sep 2020
ah yes, that makes more sense Adam! An alternative is to use yyaxis. Of course at this point we're deviating a bit from the original request, and our combined advice seems to be to just set the lower y axis limit to some value other than zero.
Answers (1)
Bjorn Gustavsson
on 3 Sep 2020
0 votes
There are several options on the File Exchange that claims to do exactly what you want. Have a look:
Tust a lazy man's advice: start every matlab-programming task/project with a File Exchange search!
HTH
Categories
Find more on Graphics Performance 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!