0

GGPLOT GRAGH LINK

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.

1 Answer 1

2

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)

Sign up to request clarification or add additional context in comments.

2 Comments

hello , but i would like to set the initial y as 0 also
scale_y_continuous(breaks = seq(0, 45, 1), limits = c(0,45))

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.