MATLAB: Plot through bottom y-limit

MATLABplot

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.

Best Answer

not totally obvious what you mean. if you want to avoid the automatic joining of points through the x-axis that you want to sshow as 'wrapping' around over the axes limits (i assume the ±180 is a rotational thing), you can just plot another matched series one rotation 'higher', and fixing the y-limits will give the illusion of them being a single series.
% data that crosses -180
dat = [-163 -162 -172 -168 -186 -194 -169 -163 -144 -177 -168 -171 -189 -174 -168];
DAT = dat+360; % additional rotation data
figure;
plot(1:15, dat, 'ro-'); % actual data will be clipped in figure < -180
hold on;
plot(1:15, DAT, 'bo-'); % colour just to show different series
ylim([-180 180]);
Screenshot 2019-08-06 at 17.47.10.png