title: How do I keep the axes from changing dynamically when I plot an animation in Matlab?
body: <p>I'm plotting an animation of a function dx/dt and I've set the axes, but when the animation runs, the axes change dynamically, according to the plot. How do I fix this problem?</p>
  
  <pre><code>clear all;
  
  %Equation variables:
  s = 0;
  r = 0.4;
  
  %axes limits:
  xmin = 0;
  xmax = 2;
  ymin = -.05;
  ymax = .2;
  
  %s limits:
  smin = 0;
  smax = 1;
  s_steps = 100;
  
  %our x-space:
  x = linspace(xmin, xmax, 100);
  
  %Let's try different s-values and plot as an animation:
  for s=linspace(smin, smax, s_steps)
      counter = counter + 1;
  
      %dx/dt:
      dxdt = s - r.*x + (x.^2)./(1 + x.^2);
  
      figure(1),    
      subplot(2,1,1)
      axis([xmin xmax ymin ymax]);    
      plot(x, dxdt);
  
  
      title(strcat('S-value:', num2str(s)));
  
      hold on;
      y1 = line([0 0], [ymin ymax], 'linewidth', 1, 'color', [0.5, 0.5, 0.5], 'linestyle', '--');
      x1 = line([xmin xmax], [0 0], 'linewidth', 1, 'color', [0.5, 0.5, 0.5], 'linestyle', '--');
      hold off;
  end
  </code></pre>