How can I stop ggplot2 stacking value when using geom_col() ?

I used this code to create a plot:

ggplot(avg_monthly_2020) + 
  geom_col(aes(x=month,y=mean_time,fill = customer_type)) + 
  scale_y_continuous(limit=c(0.0,180.0),breaks = c(0,20,40,60,80,100,120,140,160,180))+
  labs(title="Average Traveling Time Per Month",
       subtitle = "Record of average traveling time by 2 groups of customer each month",
       caption = "Data collected by Cyclistic from January 2020 to December 2020",
       y = "Average Time (Minutes)",x= "Month") +
        plot.subtitle = subtitle_style,
        plot.caption = caption_style,
        legend.position = "top",
        legend.title = element_blank(),

It produced this plot :

How do separate "customer" and "member" into 2 columns for the same month?

Thank you

FAQ: Barplots • ggplot2 (


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.