MATLAB: Alter axis size

change alter axis size figure plot

How do I alter the size of the current axis within a figure? I've tried set(gca,'Position',[.. .. .. ..]), but the axis just disappears.

Best Answer

Then the part "[.. .. .. ..]" moves the axes out of the visible area of the figure. It would be helpful, if you post the original command instead of masking the interesting part by dots. Try this:
figure('Units', 'pixels', 'Position', [100, 100, 600, 400]);
AxesH = axes;
pause(1);
set(AxesH, 'Units', 'pixels', 'Position', [10, 10, 200, 200]);
pause(1);
set(AxesH, 'Units', 'normalized', 'Position', [0.5, 0.5, 0.4, 0.4]);