[Solved] ggplot Grouped barplot with R


You can try

library(tidyverse)
d %>% 
  gather(key, value, -PtsAgRdTm) %>% 
  ggplot(aes(x=PtsAgRdTm, y=value, fill=key)) +
   geom_col(position = "dodge")

enter image description here

You transform the data from wide to long using tidyr’s gather function, then plot the bars in a “dodge” or a “stack” way.

3

solved ggplot Grouped barplot with R