Can't change colour of bar chart in ggplot

Hi, I'm struggling to change the colour of the bars in my bar chart. I'm trying to use the viridis colour pallette but the chart keeps coming out grey.

I'd also like to have the values of each bar labeled on the chart as percentages using geom_text but I can't work out how to do that either!

library(ggplot2)
positions <- c("Yes", "No")
ggplot(data = H1) +
  geom_bar(mapping = aes(x = Volyesno, y = ..prop.., group = 1), stat = "count") +
  scale_y_continuous(labels = scales::percent_format()) +
  xlab("Have you volunteered within the last 12 months?") +
  ylab("Percentage of respondents") +
  labs(title = "Engagement of students in volunteering over the past 12 months") + 
  scale_x_discrete(limits = positions) +
  scale_fill_viridis_d(alpha = 1, begin =0, end = 1, direction = 1, option = "D", aesthetics = "fill")

You need to include the fill argument within the aes() function.

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.