Reputation: 109
I'm a heavy user of ggplot2 but somehow I'm struggling to solve this problem.
For example, I have a plot like following from ggplot2
Here I want to remove x-axis labels and add "start" and "end" respectively at 0 and 100. I've seen some posts here on how to add custom labels to ggplot2 but it didn't help me to solve my problem. I was wondering is it possible yet all somehow.
Thanks a lot.
Upvotes: 2
Views: 2374
Reputation: 26343
We can use scale_x_continuous
's arguments breaks
and labels
here.
set.seed(1)
DF <- data.frame(x = -10:110,
y = rnorm(121))
ggplot(DF, aes(x, y)) +
geom_line() +
geom_point() +
scale_x_continuous(breaks = c(0, 100),
labels = c("start", "end"))
Upvotes: 5