I have this dataframe:
df <- structure(list(x = c(2L, 3L, 4L, 5L, 1L), y = c(24L, 27L, 18L,
23L, 28L)), class = "data.frame", row.names = c("1", "2", "3",
"4", "5"))
x y
1 2 24
2 3 27
3 4 18
4 5 23
5 1 28
I want to set the y axis limits to 0
and 39
but I get 0
and 40
.
Here is my code:
library(ggplot2)
ggplot(df, aes(x, y))+
geom_point()+
ylim(0,39)