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

StackOverflow https://stackoverflow.com/questions/19167115

  •  30-06-2022
  •  | 
  •  

質問

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

役に立ちましたか?

解決

Try adding to your ggplot

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

For x-intercepts, use:

geom_vline(xintercept = ...)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top