Problem: I'm trying to fix the y-axis limits and their scale in my bar chart using ggplot.
What I have Tried: Stackover flow code,s scale_y_continuous function to set limits but with this, it shows no values on the chart.
with ylim(min, max) it either shows a warning if removing specific rows it shows value in form of e for eg: 2e+05, 3e+05, and so on.
Output I want: I want the y-axis to show values in a simpler format like 20000,30000.
Code:
all_trips_v2 %>%
mutate(weekday = wday(start_time, label = TRUE)) %>%
group_by(usertype, day_of_week) %>%
summarise(number_of_rides = n()
,average_duration = mean(ride_length)) %>%
arrange(usertype, day_of_week) %>%
ggplot(aes(x = day_of_week, y = number_of_rides, fill = usertype)) +
ylim(0,500000) +
labs(title ="Number of Ride w.r.t Usertype") +
geom_col(position = "dodge")
all_trips_v2 %>%
mutate(weekday = wday(start_time, label = TRUE)) %>%
group_by(usertype, day_of_week) %>%
summarise(number_of_rides = n()
,average_duration = mean(ride_length)) %>%
arrange(usertype, day_of_week) %>%
ggplot(aes(x = day_of_week, y = number_of_rides, fill = usertype)) +
scale_y_continuous(name="Number of Rides", limits=c(0, 60000))
labs(title ="Number of Ride w.r.t Usertype") +
geom_col(position = "dodge")
Ps: It's my first time asking a question so please guide me if I did something wrong.