'Specify ggplot bar chart 2 category colors [duplicate]

The following ggplot code perfectly produces the look and feel I want for a series of bar charts comparing side-by-side populations by some factor.

EXCEPT...I want to be able to select my own colors for the bar fills in lieu of the default colors. I want to do this while keeping the other theme customizations shown in the code.

I'm a newbie and a bit lost, as it appears using out-of-the-box themes, like Brewer=Set1, overrides the various formatting tweaks I have done.

Thanks in advance.

agPlot <- ggplot(dfPopSummary, aes(p_age_group, p_perc, fill = pop_source)) +
  geom_bar(stat = "identity", position = "dodge") +
  scale_y_continuous(labels = scales::percent) +
  labs(x = "Age Group", 
       y = "Percentage",
       title = "Age Distribution: Membership vs. Survey Respondents"
       ) +
  scale_fill_discrete(name = "Population") +
  theme(
    plot.title = element_text(face = "bold", size = 22),
    panel.background = element_rect(fill = "white", color = "white"),
    axis.ticks = element_line(color = "grey70", size = 0.2),
    axis.text.x = element_text(size = 14),
    axis.title.y = element_text(size = 18),
    axis.text.y = element_text(size = 14),
    axis.title.x = element_text(size = 18),
    panel.grid.major = element_line(color = "grey70", size = 0.2),
    panel.grid.minor = element_blank()
    ) 

see link to the current plot rendering with "Pepto Bismal" colors



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source