I am trying to plot data in matlab that doesn't (as far as I can tell) contain vertical lines. However when I plot it I get lots of vertical lines. I'm guessing there's some little syntax thing that I don't know about but I can't find any similar questions.
>> whos t
Name Size Bytes Class Attributes
t 1x33715 269720 double
>> whos nascent_ts
Name Size Bytes Class Attributes
nascent_ts 4x6x33715 6473280 double
plot(t,squeeze(squeeze(nascent_ts(1,1,:))))
Here is the plot:
I've tried transposing both sides but that had no effect. I just can't see how this could even happen. Here's some more info about what's actually going into the plot.
>> tmp=squeeze(squeeze(nascent_ts(1,1,:)));
>> whos tmp
Name Size Bytes Class Attributes
tmp 33715x1 269720 double
The "vertical lines" that you are seeing is simply the result of MATLAB's plot
functionality connecting all of your data points with lines. The vertical lines are where you have a low-valued data point followed by a high value data point.
To get around this, you can either specify a non-line (marker-only) style to plot
plot(t,squeeze(squeeze(nascent_ts(1,1,:))), '.')
Or you can set the LineStyle
property of your existing line object
h = plot(t,squeeze(squeeze(nascent_ts(1,1,:))));
set(h, 'LineStyle', 'none', 'Marker', '.')