我有一个图表,其中手动设置了标签和中断:
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()
)