Reputation: 11
Arrival_Frequency Total_Arrival
0-1 2633586
2-4 223079
4-7 5281
7+ 1718
How to get bar plot for this. If use normal geom_bar()
it gives the count not the total.
Upvotes: 1
Views: 39
Reputation: 8176
Do you want this?
library(scales)
library(tidyverse)
ggplot(df, aes(x=Arrival_Frequency, y=Total_Arrival))+
geom_bar(position=position_dodge(), stat="identity") +
scale_y_continuous(labels = label_number()) +
ylab("Total Arrival") + xlab("Arrival Frequency")
Your values are wide apart. So, you can think of transforming the values like
ggplot(df, aes(x=Arrival_Frequency, y=Total_Arrival))+
geom_col() +
scale_y_continuous(trans = "log", labels = label_number()) +
ylab("log (Total Arrival)") + xlab("Arrival Frequency")
Upvotes: 1