title: How to use + geom_line() with a categorical x-variable and quantitative y-variable
body: <p>How can I create a <strong>line graph</strong> with ggplot 2 where the x variable is either categorical or a factor, the y variable is numeric and the group variable is categorical? I have tried just + geom_point() with the variables as stated above and it works, but + geom_line() does not.</p>
  
  <p>I have already reviewed posts such as:
  <a href="https://stackoverflow.com/questions/59827260/creating-line-graph-using-categorical-data">Creating line graph using categorical data</a>, 
  <a href="https://stackoverflow.com/questions/24895575/ggplot2-bar-plot-with-two-categorical-variables">ggplot2 bar plot with two categorical variables</a>, and <a href="https://stackoverflow.com/questions/31818264/no-line-in-plot-chart-despite-geom-line">No line in plot chart despite + geom_line()</a>, but none of them answer my question.</p>
  
  <p>Before I go into code and examples, (1) Yes I absolutely must have the x-variable and group variable as a character or factor, (2) No, I do not want a bar graph or just geom_point().</p>
  
  <p>The example below provides the coefficients of multiple independent variables from three different example regressions run using different variations on the dependent variable. While the code below shows a work around that I figured out (i.e. creating a int variable named 'test' to use in place of the chr variable containing the names of the independent variables form the regression), I need to instead be able to preserve the chr names of the independent variables.</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>library(dplyr)
  library(ggplot2)
  library(plotly)
  library(tidyr)
  
  var_names &lt;- c("ST1", "ST2", "ST3", 
                 "EFI1", "EFI2", "EFI3", "EFI4", 
                 "EFI5", "EFI6")
  
  ####Dataset1####
  reg &lt;- c(26441.84, 20516.03, 12936.79, 17793.22, 18837.48, 15704.31, 17611.14, 17360.59, 14836.34)
  r_adj &lt;- c(30473.17, 35221.43, 29875.98, 30267.31, 29765.9, 30322.86, 31535.66, 30955.29, 29828.3)
  a_adj &lt;- c(19588.63, 31163.79, 22498.53, 27713.72, 25703.89, 28565.34, 29853.22, 29088.25, 25213.02)
  
  df1 &lt;- data.frame(var_names, reg, r_adj, a_adj, stringsAsFactors = FALSE)
  df1$test &lt;- c(1:9)
  
  df2 &lt;- gather(df1, key = "series_type", value = "value", c(2:4))
  
  fig7 &lt;- ggplot(df2, aes(x = test, y = value, color = series_type)) + geom_line() + geom_point()
  fig7
  </code></pre>
  
  <p>Ultimately I want something that looks like the plot below, but with the independent variable names in place of the 'test' variable.</p>
  
  <p><a href="https://i.stack.imgur.com/ysIUq.png" rel="nofollow noreferrer">Example Plot</a></p>