The following code
fig = figure;
alist = [-0.1 1 4];
cp = 0;
for counter = 1:3
a = alist(counter);
fp = [(1+sqrt(1+4*a))/(-2*a) (1-sqrt(1+4*a))/(-2*a)];
fpmin = (abs(fp(1)-cp) < abs(fp(2)-cp))*fp(1) + (abs(fp(1)-cp) >= abs(fp(2)-cp))*fp(2);
fpmax = (abs(fp(1)-cp) >= abs(fp(2)-cp))*fp(1) + (abs(fp(1)-cp) < abs(fp(2)-cp))*fp(2);
ax = axes('Position',[.1+(counter-1)*0.3 0 0.25 1]);
axis equal;
hold on;
fplot(@(x) 1-a*x.^2,'color','k');
fplot(@(x) x,'--','color','b');
plot([fpmax -fpmax -fpmax fpmax fpmax],[fpmax fpmax -fpmax -fpmax fpmax],'color','r');
padding = .4*abs(fpmax);
axis([-abs(fpmax)-padding abs(fpmax)+padding -abs(fpmax)-padding max(abs(fpmax),1)+padding]);
end
produces this image: MATLAB pic
The issue is that MATLAB didn't place the third image correctly. The line of code
ax = axes('Position',[.1+(counter-1)*0.3 0 0.25 1]);
supposedly tells MATLAB to position the bottom left corner of each new axis at a height of 0. But this isn't happening in the third image. I also tried using subplots but that produces the same behavior as seen above. How do I vertically align the three axes along their bottoms, if the 'Position' thing I tried doesn't work?