Plot through bottom y-limit
Show older comments
How can I let a plot go through the bottm y-lim and connect to the next point at the oppisite (max) y-lim?
I have a x y matrix which y sapns from -180 to 180. Yet most of the data fluctuate around -180 and should then come back from the top of the plot rather than being connected going through 0.
Thanks.
Accepted Answer
More Answers (1)
Steven Lord
on 6 Aug 2019
If you want to make a "break" in your plot, include NaN in the X and/or Y vectors.
x = 0:0.25:10;
y = x.^2;
subplot(2, 1, 1)
plot(x, y)
title('No NaN values')
subplot(2, 1, 2)
y2 = y;
y2(mod(x, 1) == 0) = NaN;
plot(x, y2);
title('NaN values in y data for integer values of x')
Categories
Find more on Annotations 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!