title: ggplot with Strings on x-Axis
body: <p>I'm trying to draw a plot with several curves in it. The x-axis are not numerical values, but Strings.</p>
  
  <p>This works fine (like in <a href="https://stackoverflow.com/questions/4877357/how-to-plot-all-the-columns-of-a-data-frame-in-r">how to plot all the columns of a data frame in R</a>):</p>
  
  <pre><code>require(ggplot2)
  df_ok &lt;- rbind(data.frame(x=4:1,y=rnorm(4),d="d1"),data.frame(x=3:1,y=rnorm(3),d="d2"))
  ggplot(df_ok, aes(x,y)) + geom_line(aes(colour=d))
  </code></pre>
  
  <p>But my data looks like this:</p>
  
  <pre><code>require(ggplot2)
  df_nok &lt;- rbind(data.frame(x=c("four","three","two","one"),y=rnorm(4),d="d1"),data.frame(x=c("three","two","one"),y=rnorm(3),d="d2"))
  ggplot(df_nok, aes(x,y)) + geom_line(aes(colour=d))
  </code></pre>
  
  <p>I get the error <strong>geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?</strong>.
  Even though the graph lines do not appear, the axis are plotted, and the x-Axis contains the correct Labels - but also in <em>wrong order</em>.</p>
  
  <p>Any idea how to plot this as easy as possible? (Also note the missing x-values for some series).</p>