I have a chart and need to expand the x-axis scale to accommodate labels which go past my maximum value (1 as the x-axis represents a percentage).
I am able to do this using the limits
argument in scale_x_continuous
, but I still can see the associated gridlines at 1.1. Is there any way to remove just this gridline (bordered by the red box in the image below), but keep the expanded plot?
library(dplyr)
library(ggplot2)
data.frame(val1 = seq(0, 1, 0.1),
val2 = seq(0, 1, 0.1)) %>%
ggplot(aes(x = val1, y = val2)) +
scale_x_continuous(limits = c(0, 1.05),
breaks = seq(0, 1, 0.1))