Consider following code:
t=0:.01:(2*pi);
y=[sin(t);sin(t-pi/12);sin(t-pi/6);sin(t-pi/4)];
figure(1)
clf
subplot(6,1,5)
plot(t,y)
xlim([0 2*pi])
legend('1','2','3','4')
It produces following figure:
Is there a way to change the legend to a 2-column lay-out? So it would be
--- 1 --- 3
--- 2 --- 4
instead of
--- 1
--- 2
--- 3
--- 4
so the legend boundary lined would not cross the graph boundary lines.
I found the gridLegend
script, but I prefer to code it directly.