3

I have a line graph with some points with positive value, and others with negative value (I am plotting odds ratios). I would like to make the y=0 grid line appear darker or bolder so as to make the visuals more apparent. How can I do this with ggplot2?

As an extension of this, I would also like to ask this: is there a way I can make particular grid lines darker or bolder (say, y=5 or a vertical grid line x=-2)?

Chthonic Project
  • 7,687
  • 1
  • 39
  • 85

1 Answers1

4

Try adding to your ggplot

 geom_hline(yintercept = 0, size = 4) # or whichever size needed

For x-intercepts, use:

geom_vline(xintercept = ...)
luda
  • 183
  • 1
  • 5
Ricardo Saporta
  • 51,025
  • 13
  • 129
  • 166
  • Thanks! I repeatedly face a problem with R: I know what I want, and it's usually something simple, but I don't know what term to search with. Once again, thank you :-) – Chthonic Project Oct 03 '13 at 19:26
  • no problem. I find that googline "ggplot geom " and a term related to what I want to accomplish helps me find it – Ricardo Saporta Oct 03 '13 at 20:06
  • 1
    @ChthonicProject, you may also check [these docs](http://docs.ggplot2.org/current/). I think it is basically the help texts for all the `ggplot` functions, but with the output of all examples. It usually doesn't take so much clicking and scrolling before you stumble over something that resembles what you are looking for. – Henrik Oct 03 '13 at 22:21