Home > Software engineering >  How to fill (color) bars in a bar chart a different color within the bar itself up to a certain numb
How to fill (color) bars in a bar chart a different color within the bar itself up to a certain numb

Time:12-31


groups <- data.frame(group = c("A", "B"),
                                Reels = c(155, 343),
                                Fish = c(41, 221))
groups %>% 
  ggplot(aes(x = group, y = Reels))   
  geom_col()  
  labs(
    x = "Group",
    y = "Count"
  ) 

I want to fill the bars in this graph up the amount of fish that were caught. So you can see the different color on the graph. I think I would use the fill argument but am having trouble getting that value to cut off at 41/155, for example.

Sort of like in enter image description here

  • Related