I'm trying to specify the sizes of two MATLAB figures in such a way that the graphs appear to be the same size, regardless of extra space used outside the axes. Specifically, I'm want the white regions in the plots in the image below to be the same size. Currently the entire figures are the same size, and I'm not sure how to fix that.
Edit: I'm using this page as a resource. I suspect the issue is with specifying the cm dimensions of the figure rather than allowing it to resize to fit the plot, but I don't know enough about the inner workings of the figures to say for sure. Either size axis region is fine, I just want consistency.
These were generated with MATLAB R2016b using the code
fig1=figure(1);
ax1 = gca;
axis([0 2 0.625 1.375])
set(ax1,'XTick',1);
set(ax1,'YTick',1);
ax1.TickLabelInterpreter = 'latex';
set(ax1,'XTickLabel','$x$','Fontsize',15)
set(ax1,'YTickLabel',[])
xlabel('$x$','Interpreter','latex','Fontsize',15)
fig1.Units = 'centimeters';
fig1.Position(3) = 10;
fig1.Position(4) = 9;
set(ax1,'LooseInset', max(get(ax1,'TightInset'), 0.02))
fig2=figure(2);
ax2 = gca;
axis([0 2 0.625 1.375])
set(ax2,'XTick',1);
set(ax2,'YTick',1);
ax2.TickLabelInterpreter = 'latex';
set(ax2,'XTickLabel','$x$','Fontsize',15)
set(ax2,'YTickLabel','$y$')
xlabel('$x$','Interpreter','latex','Fontsize',15)
ylabel('$y$','Interpreter','latex','Fontsize',15)
fig2.Units = 'centimeters';
fig2.Position(3) = 10;
fig2.Position(4) = 9;
set(ax2,'LooseInset', max(get(ax2,'TightInset'), 0.02))
