Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make the abscissa (i.e. the grid line y=0) appear darker or bolder in ggplot2?

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)?

like image 528
Chthonic Project Avatar asked Dec 28 '25 01:12

Chthonic Project


1 Answers

Try adding to your ggplot

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

For x-intercepts, use:

geom_vline(xintercept = ...)
like image 98
Ricardo Saporta Avatar answered Dec 30 '25 17:12

Ricardo Saporta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!