n = 1;
figure (1)
clf ()
subplot (3, 2, n)
plot (rand (3))
legend show

n = n + 1;
subplot (3, 2, n)
plot (rand (3))
legend location south

n = n + 1;
subplot (3, 2, n)
plot (rand (3))
legend left

n = n + 1;
subplot (3, 2, n)
plot (rand (3))
legend right

n = n + 1;
subplot (3, 2, n)
h = plot (rand (3));
legend (h([1,end]))

orient tall
print -dpdf test.pdf
