0

I want to group the full names of the characters by month_release which is binary (released, unreleased) such that the legend has two groups. If possible as well, it could reset the color schema for each group:

Code:

starting_vs_jp <- mutate(ur_characters, month_release = month(global_release)) %>%
  select(full.name, total.stats, month_release) %>%
  filter(month_release == 3| is.na(month_release)) %>%
  mutate(month_release = ifelse(is.na(month_release), 'Unreleased', "Released")) %>%
  arrange(month_release)

ggplot(starting_vs_jp) +
  geom_bar(aes(x=month_release, y=total.stats, fill=full.name), position='dodge', stat='identity')
  

Result at the moment:

enter image description here

Thank you for the help.

  • I think another way to ask this question is how do I make two legends. – Chase Sariaslani Aug 21 '20 at 03:05
  • I somewhat found a solution that works for this. I am going to use patchwork and then just add the plots. This sounds like the easiest and most efficient method. If there are better answers than this, then please post it. – Chase Sariaslani Aug 21 '20 at 03:17
  • 1
    `patchwork` is fine. Another option to achieve this in one plot would be the `ggnewscale` package. See my answers https://stackoverflow.com/questions/62718912/two-legends-when-plot-is-built-from-two-data-frames/62719068#62719068 or https://stackoverflow.com/questions/63493795/r-ggplot-heatmap-with-multiple-rows-having-separate-legends-on-the-same-graph/63494226#63494226 – stefan Aug 21 '20 at 07:11

0 Answers0