function [x,y] = pickpoints(n)

a = [ -.1 2.1 -.1 2.1];
x = zeros(n,1); y = zeros(n,1);
plot([0 2 2 0 0],[0 0 2 2 0],'color',[.8 .8 .8]); hold on
axis(a); axis equal; 
for i=1:n
  title(sprintf('Select point %i of %i',i,n))
  [x(i),y(i)] = ginput(1);
  if i>1
    plot(x([i-1 i]),y([i-1 i]),'o:')
  else
    plot(x(i),y(i),'o')
  end
  axis(a); axis equal;
end
title('')

hold off
