title: Update plot using hold on inside a for loop
body: <p>I'm combining two plots using this code</p>
  
  <pre><code>plot(x1,y1,'.','MarkerSize',20,'Color','r');
  hold on; grid on;
  plot(x2,y2,'x','MarkerSize',10,'Color','b');
  
  xlim([-a a]);
  ylim([-a a]);
  </code></pre>
  
  <p>Now I want to change the values of <code>x1</code>,<code>y1</code> and <code>x2</code>,<code>y2</code> in order to have more than one point and one cross inside my figure. I tried to use a for loop where I compute new values, but every iteration this code generates another figure - whereas I want just one figure with all the points in it.</p>
  
  <p>I did something like this:</p>
  
  <pre><code>for i=1:1:8
      % do things that compute x1,x2,y1,y2
      figure; hold on
      plot(x1,y1,'.','MarkerSize',20,'Color','r');
      hold on; grid on;
      plot(x2,y2,'x','MarkerSize',10,'Color','b');
      xlim([-a a]);ylim([-a a]);
      i=i+1;
  end
  </code></pre>
  
  <p>I also tried to put the <code>hold on</code> just before <code>i=i+1</code> but still give me a new figure.</p>