如何删除ggplot2中的特定水平网格线

时间:2021-06-15 13:33:58

标签: r ggplot2

我有一个图表,其中手动设置了标签和中断:

library(ggplot2)
library(tibble)

df <- tibble(date = c(2010, 2015, 2020, 2025, 2030),
         value = c(10, 15, 20, 30, 40))

BREAKS = c(10, 20, 30, 35, 40)
LABELS = c('10', '20', '30', '35', '40')

ggplot()+
  geom_path(data = df,
         aes(date, value))+
  scale_y_continuous(
    breaks = BREAKS,
    labels = LABELS)+
  theme(
    panel.grid.minor = element_blank()
  )

enter image description here

如何去掉35对应的网格线?像这样: enter image description here

0 个答案:

没有答案