Hi there! I've attached a figure below which graphs changes in flux by season. Problem: Matlab is currently drawing lines in between the beginning and end of my seasons, making the graphs look odd. Is there a simple way to keep it from doing this?
Thanks a bunch!
subplot(2,2,3) plot(Fall(:,2),Fall(:,3)) title('Fall') subplot(2,2,4) plot(Wtr(:,2),Wtr(:,3)) title('Wtr') subplot(2,2,1) plot(Spr(:,2),Spr(:,3)) title('Spr') subplot(2,2,2) plot(Sum(:,2),Sum(:,3)) title('Sum')
The default line style for plot() is the draw a line between each pair of points. If it is OK to not have any of those lines, then you could plot just the data points, for example
However, if you want the lines except when it "backtracks", then probably need to split your data into separate series for plotting. You could do this by deftly inserting NaN into your vectors where the backtracking occurs. Here is a simple example of what I mean. Notice the difference between the two plots.
x1 = [1 2 3 1 2 3]; y1 = [1 2 3 3 4 5];
x2 = [1 2 3 nan 1 2 3]; y2 = [1 2 3 nan 3 4 5];