title: Need help on customizing my Odds Ratio (ggplot)!
body: <p>I'm assigned to create an Odds of Ratio ggplot in R. The plot I'm supposed to create is given below.</p>
  
  <p><a href="https://i.stack.imgur.com/NhKmB.png" rel="nofollow noreferrer">Given plot</a></p>
  
  <p>My job is to figure out codes which creates the exact plots in R. I've done most parts. Here is my work.</p>
  
  <p><a href="https://i.stack.imgur.com/xhLkn.png" rel="nofollow noreferrer">My work</a> </p>
  
  <p>Before jumping into my code, it is very important that I am not using the correct values for boxOdds, boxCILow, and boxCIHigh since I have not figured out the correct values. I wanted to figure out codes for ggplot first so I can enter the right values as soon as I find them.</p>
  
  <p><strong>This is the code I used</strong>: </p>
  
  <pre><code>library(ggplot2)
  
  boxLabels = c("Females/Males", "Student-Centered Prac. (+1)", "Instructor Quality (+1)", "Undecided / STM", 
                "non-STEM / STM", "Pre-med / STM", "Engineering / STM", "Std. test percentile (+10)", 
                "No previous calc / HS calc", "College calc / HS calc")
  
  df &lt;- data.frame(yAxis = length(boxLabels):1,
                   boxOdds = 
                     c(2.23189, 1.315737, 1.22866, 0.8197413, 0.9802449, 0.9786673, 0.6559005, 0.5929812, 0.6923759, 1.3958275),
                   boxCILow = 
                     c(.7543566,1.016,.9674772,.6463458,.9643047,.864922,.4965308,.3572142, 0.4523759, 1.2023275),
                   boxCIHigh = 
                     c(6.603418,1.703902,1.560353,1.039654,.9964486,1.107371,.8664225,.9843584, 0.9323759, 1.5893275) 
  )
  
  
  (p &lt;- ggplot(df, aes(x = boxOdds, y = boxLabels)) + 
      geom_vline(aes(xintercept = 1), size = 0.75, linetype = 'dashed') +
      geom_errorbarh(aes(xmax = boxCIHigh, xmin = boxCILow), size = .5, height = 
                       0, color = 'gray50') + 
      geom_point(size = 3.5, color = 'orange') +
      theme_bw() +
      theme(panel.grid.minor = element_blank()) +
      scale_x_continuous(breaks = seq(0,7,1) ) +
      ylab('') +
      xlab('Odds Ratio') + 
      annotate(geom = 'text', y =1.1, x = 3.5, label ='', 
               size = 3.5, hjust = 0) + ggtitle('Estimated Odds of Switching') + 
      theme(plot.title = element_text(hjust = 0.5, size = 30), 
            axis.title.x = (element_text(size = 15))) + 
      theme(panel.grid.minor = element_blank(), panel.grid.major = element_blank())
  )
  p
  </code></pre>
  
  <p><strong>Where I'm stuck at</strong>: </p>
  
  <ol>
  <li><p>Removing small vertical lines on the beginning and end of each row's CI). I was not sure what it's called so I was having hard time looking it up. <strong>SOLVED</strong></p></li>
  <li><p>I'm also stuck at coloring specific rows in different colors. </p></li>
  <li><p>The last part I'm stuck at is assigning proper order of each variable for y-axis. As you can see in my code ("boxLabels" part), I have put all the variables in order of given plot but it seems like the R didn't care about the order. So the varaible located at the very top is "Undecided / STM", instead of "Females / Males".</p></li>
  <li><p>How do I decrease the space from 0 to 1?  <strong>SOLVED</strong></p></li>
  </ol>
  
  <p>Any help would be appreciated!</p>