title: Making a static legend, independent of the actual plot
body: <p>I'm plotting two surfaces in Matlab, the ground level which is constant and the water level which is changing in time. </p>
  
  <p>I use an <code>if</code> statement to change the <code>colormap</code> of the water with increasing depth, determined by two thresholds (in the code below the thresholds are represented by the array <code>C</code>)</p>
  
  <pre><code>if max(C(:)) &lt; 2
      colormap([0.5 0.25 0 ; 0 0.8 1]);
  elseif max(C(:)) &gt;= 2 &amp;&amp; max(C(:)) &lt; 3
      colormap([0.5 0.25 0 ; 0 0.8 1 ; 0 0.5 0.65]);
  elseif max(C(:)) &gt;= 3
      colormap([0.5 0.25 0 ; 0 0.8 1 ; 0 0.5 0.65 ; 0 0.2 0.3]);
  end
  </code></pre>
  
  <p>The result is that when the water level is below threshold 1 it is a light blue, between the two thresholds it turns darker, and above threshold 2 it turns darker yet.</p>
  
  <p>My problem is that when I draw the legend</p>
  
  <pre><code>legend('ground','water');
  </code></pre>
  
  <p>... I only get one color representing the water, and it changes according to the max depth. How do I make a static legend showing all four categories with a color example:</p>
  
  <ol>
  <li>(brown)           Ground</li>
  <li>(light blue)      Water level beneath threshold 1</li>
  <li>(standard blue)   Water level between thresholds</li>
  <li>(dark blue)       Water level above threshold 2</li>
  </ol>
  
  <p>The only solution I can think of is making 3 neat little patches somewhere by the axis (where it won't be noticed) in the right blue colors and then making the legend point at them and not the water surface. But that would be a real crappy solution...</p>