I have a button in my Matlab GUI to open up an axes plot in a new figure, here is my code:
fig=figure;
set(fig, 'Position', [100, 100, 1049, 895]);
h=handles.axes2;
copyobj(h,fig);
set(gca,'units','pix')
set(gca,'units','norm')
However, the axes is quite small in the new figure:
But when I try to add this line at the bottom of the previous code:
set(gca,{'Position',[100, 100, 1049, 895]}); % [left bottom right top]
nothing changes... I have tried changing the numbers as well but the axes does not get resized...
Can anyone tell me what I'm doing wrong?
Thanks
Use axis command :
% whatever code you have
plot(x,y,'-o');
% now add limits for the axisX and axisY
% that combined with the position limit should zoom your picture automatically
% x1, x2, y1, y2 should be actual values like 0.5, 1, -4 etc. whatever you find appropriate
% if it doesnt zoom as you expect - remove the Position setting and see how it looks.
axis([x1 x2 y1 y2]);
for more info see example from the matlab site: http://www.mathworks.com/help/matlab/ref/axis.html