title: How to create geom_boxplot with large amount of continuous x-variables
body: <p>I have a data frame which contains x-axis numeric bins and continuous y-axis data across multiple categories. Initially, I created a boxplot by making the x-axis bins "factors", and doing a boxplot of the melted data. Reproducible data:</p>
  
  <pre><code>x &lt;- seq(1,10,by=1)
  y1 &lt;- rnorm(10, mean=3)
  y2 &lt;- rnorm(10, mean=10)
  y3&lt;- rnorm(10, mean=1)
  y4&lt;- rnorm(10, mean=8)
  y5&lt;- rnorm(10, mean=12)
  df &lt;- data.frame(x,y1,y2,y3,y4,y5)
  df.m &lt;- melt(df, id="x")
  </code></pre>
  
  <p>My code to create the x-axis data as a factor:</p>
  
  <blockquote>
    <p>df.m$x &lt;- as.factor(df.m$x)</p>
  </blockquote>
  
  <p>My ggplot:</p>
  
  <pre><code>ggplot(df.m, aes(x=x, y=value))+
   geom_boxplot(notch=FALSE, outlier.shape=NA, fill="red", alpha=0.1)+
   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
  </code></pre>
  
  <p>The resulting plot:
  <img src="https://i.imgur.com/R0enxw8.png" alt="The resulting plot">:</p>
  
  <p>The problem is that I cannot use x-axis numeric spacing because the x-axis is categorized as a factor, which has equal spacing. I want to be able to use something like scale_x_continuous to manipulate the axis breaks and spacing to, say, an interval of 2, rather than a boxplot every 1, but when I try to plot the data with the x-axis "as.numeric", I just get one boxplot of all of the data:</p>
  
  <p><img src="https://i.imgur.com/W3jlszM.png" alt="plot"></p>
  
  <p>Any suggestions for a way to get this continuous-looking boxplot curve (the first image) while still being able to control the numeric properties of the x-axis? Thanks!</p>