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()
)
解决方案
推荐阅读
- python - 如何在 x 轴上绘制所有值
- python-newspaper - Newspaper3k 抓取几个网站
- apache-spark - 为什么 Spark 查询在第二次执行时运行得更快?
- json - Series 类型的对象不是 JSON 可序列化的
- java - Apache Camel:第一次请求时分块的 TCP 响应
- javascript - 如何使用nodejs fs将父目录文件复制到子目录?
- rust - 是否可以在 rust 中编写动态的“抽象/共享”特征
- python - 使用ajax和flask上传不同扩展名的文件
- python - Pandas 获取每组内的最大值,按组总和
- python - 使用beautifulsoup(未知的url类型)使用python遍历用于网络抓取的url列表