Grouped Bar Plot issue

I'm trying to make a grouped bar plot. Not sure if my spreadsheet is set up right. I've got three columns: Dates, Cases, Org. The chart should show two repeating bars on the X axis for each day in September, one for Org1 and one for Org 2. The Y axis should be the daily # of COVID-19 cases. Not sure where I went wrong, but thanks for any help. I'm new to R.

Chico_Butte_Plot_df <- Butte_ChicoState_COVID %>%
  filter (D >= as.Date("2020-09-01") & D <= as.Date("2020-09-13"))
  select(D, Cases, Org) %>%
  spread(Org, Cases) %>%
  mutate(gap = `Butte` - `ChicoState`) %>%
  arrange(desc(gap)) %>%
  head(5)%>%
  gather(key = Org, value = Cases) %>%
        
       

Chico_Butte_Plot <- ggplot(Chico_Butte_Plot_df, aes(x = D, y = Cases, fill = as.factor(Org))) +
  geom_bar(stat="identity", position="dodge") +
  geom_hline(yintercept = 0, size = 1, colour="#333333") +
  bbc_style() +
  scale_fill_manual(values = c("#1380A1", "#FAAB18")) +
  labs(title="We're living longer",
      subtitle = "Biggest life expectancy rise, 1967-2007")
Chico_Butte_Plot

I'm receiving this error:

Error: Insufficient values in manual scale. 3 needed but only 2 provided.

The eroor tells you precisely what the problem is. You have specified two values for the fill, but Org has three factors. Just add another fill value or remove the scale_fill_manual() line.

Thank you! Much appreciated.

This topic was automatically closed 21 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.