Reputation: 241
question7 %>% ggplot(aes(x = year, y = n , group = state)) + geom_point(aes(color = state)) + geom_smooth(method = "loess", formula = y ~ x, level = 1, aes(color=state))+ labs(x = "Year", y = "No Visitors",#lab means labels title = "Number of Visitors by year by state", # title of title making interpretation subtitle = "Yearly comparison trend between NY and CA")
For the Y axis , i would like to label it as 1,2,3,4,5,6... all the way to 45.
Upvotes: 0
Views: 878
Reputation: 5489
Use scale_y_continuous()
with the breaks =
argument.
An example:
library(ggplot2)
p1 <- ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg))
p2 <- ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg)) +
scale_y_continuous(breaks = seq(10, 35, 1))
cowplot::plot_grid(p1, p2, ncol = 2)
Created on 2020-01-07 by the reprex package (v0.3.0)
Upvotes: 2