title: ggplot2 error : Discrete value supplied to continuous scale
body: <p>I have a dataset called &quot;merged&quot;, which contains 3 numeric columns &quot;pauseMedian&quot; and &quot;numTotalPauses&quot; and &quot;diff&quot;. I also have a splineHull dataset, which also contains numeric columns &quot;pauseMedian&quot; and &quot;numTotalPauses&quot;, plus a 6-level factor &quot;microstyle&quot;</p>
  <p>I have the following code, which works perfectly. It plots a scatter plop and then overlay it with splineHull polygons colored according to &quot;microstyle&quot;.</p>
  <p><strong>script 1:</strong></p>
  <pre><code>ggplot(data=merged,aes(x = pauseMedian, y = numTotalPauses)) 
         + geom_point()  
         + geom_polygon(data = splineHull, 
                        mapping=aes(x=pauseMedian, 
                                    y=numTotalPauses, 
                                    group=microstyle, 
                                    color = microstyle),
                         alpha=0)
  </code></pre>
  <p>Then, I also want to change the color of the points in the scatter plot by adding just one attribute color = diff.</p>
  <p><strong>script 2:</strong></p>
  <pre><code>ggplot(data=merged,aes(x = pauseMedian, y = numTotalPauses, color = diff)) 
         + geom_point()  
         + geom_polygon(data = splineHull, 
                        mapping=aes(x=pauseMedian, 
                                    y=numTotalPauses, 
                                    group=microstyle, 
                                    color = microstyle),
                         alpha=0)
  </code></pre>
  <p>I see the following error:</p>
  <blockquote>
  <p>Error: Discrete value supplied to continuous scale</p>
  </blockquote>
  <p>I don't know why I see this error. If I still want colored scatter plot but no polygons, I run the following code it works again.</p>
  <p><strong>script 3:</strong></p>
  <pre><code>ggplot(data=merged,aes(x = pauseMedian, y = numTotalPauses, color = diff)) 
         + geom_point()  
  </code></pre>
  <p>So, what happened with <strong>script 2</strong>, where is the error from, and how can I make it work?</p>