x=[0:0.1:1];
plot(x,x.^2);

hl=legend('y(x)=x^2')

set(hl,'location','none')
set(hl,'position',[0.2 0.5 0.25 0.25])
% legend has the specified position
print -dpdfcrop tst_lgnd

get (hl, 'position')
