0

I need to change the color of the background of a plot, but I am having problems in doing it. I am able to change the color of the area of the plot, but I cannot change the color of all the plot. Lets say I have the following data:

genderDistribution <- data.frame(gender = c('males','females'),
                       distribution = c(75,25))

Then I create the plot:

ggplot(genderDistribution, aes(x=gender, y=distribution)) +
  geom_bar(stat = 'identity') +
  ggtitle("Gender distribution") +
  theme(panel.background = element_rect(colour = "gray87", fill = "gray87"))

enter image description here

What I need is that all the area (including the title , axis titles) is in color "gray87". How can I do this?

Bruno Guarita
  • 767
  • 10
  • 21

0 Answers0