Возьмем этот пример
library(ggplot2)
set.seed(1)
df <- data.frame(y=sample(1:15,1000, replace=TRUE), x=sample(0:200, 1000, replace=TRUE))
ggplot(df, aes(x=x, y=y)) + theme_bw() +
scale_y_continuous(breaks = seq(0,15,1)) +
scale_x_continuous(breaks = seq(0,160,20), limits=c(0,160))
Что дает
Однако, добавив geom_segment()
, получим
ggplot(df, aes(x=x, y=y)) + theme_bw() +
scale_y_continuous(breaks = seq(0,15,1)) +
scale_x_continuous(breaks = seq(0,160,20), limits=c(0,160)) +
geom_segment(aes(x=0, xend=160, y=8, yend=8))
Ожидаемый результат: