title: ggplot2: uniform color scale across many plots
body: <p>I need to make several plots with the same color scale across all the plots.  Is there any way to tell the scale_color_gradientn that, for example, -10 maps to green and 10 maps to red, even if the data don't contain those values?</p>
  
  <p>Here's an example that shows the problem.  In the first plot green indicates 5, in the second plot green is 15.  I want green to indicate the same value, say 10, in both plots.</p>
  
  <pre><code>library( ggplot2)
  
  xa &lt;- ya &lt;- za &lt;- 0:9
  xb &lt;- yb &lt;- zb &lt;- 10:19
  
  fma &lt;- data.frame( xa, ya, za)
  fmb &lt;- data.frame( xb, yb, zb)
  
  ggplot( fma) +
    geom_point( aes( xa, ya, col=za), size=5) +
    scale_colour_gradientn(
      name='someName',
      colours=c('#0000ff', '#00ff00', '#ff0000'))
  
  dev.new()
  
  ggplot( fmb) +
    geom_point( aes( xb, yb, col=zb), size=5) +
    scale_colour_gradientn(
      name='someName',
      colours=c('#0000ff', '#00ff00', '#ff0000'))
  </code></pre>
  
  <p>Here is a kluge to work around the problem:</p>
  
  <pre><code># Have fmlim contain the overall min,max, and
  # plot fmlim using geom_blank.
  
  library( ggplot2)
  
  xa &lt;- ya &lt;- za &lt;- 0:9
  xb &lt;- yb &lt;- zb &lt;- 10:19
  
  fma &lt;- data.frame( xa, ya, za)
  fmb &lt;- data.frame( xb, yb, zb)
  
  fmlim &lt;- data.frame(
    xa=rep(xa[1], 2),
    ya=rep(ya[1], 2),
    xb=rep(xb[1], 2),
    yb=rep(yb[1], 2),
    zlims=c( min( za, zb), max( za, zb)))
  
  ggplot( fma) +
    geom_point( aes( xa, ya, col=za), size=5) +
    geom_blank( aes( xa, ya, col=zlims), data=fmlim) +
    scale_colour_gradientn(
      name='someName',
      colours=c('#0000ff', '#00ff00', '#ff0000'))
  
  dev.new()
  
  ggplot( fmb) +
    geom_point( aes( xb, yb, col=zb), size=5) +
    geom_blank( aes( xb, yb, col=zlims), data=fmlim) +
    scale_colour_gradientn(
      name='someName',
      colours=c('#0000ff', '#00ff00', '#ff0000'))
  </code></pre>
  
  <p>Now green indicates 10 in both plots, which is great.  But it's a kluge.</p>
  
  <p>Is there a way to tell scale_colour_gradientn that specific data values map to specific colors?  I tried using "values", but that mapping changes with the data values being plotted.</p>
  
  <p>Thanks!</p>