0

I'm thinking is it possible to change the background color of plot using ggplot2?like white or something else? instead of the color in the following

enter image description here

rmunn
  • 34,942
  • 10
  • 74
  • 105
Burry Xie
  • 85
  • 9
  • 2
    http://stackoverflow.com/questions/6736378/how-do-i-change-the-background-color-of-a-plot-made-with-ggplot2 I think this is a duplicate question – Dung Tran Nov 06 '15 at 06:22
  • try adding `+ theme_bw()` it's much nicer than the nasty grey. For more builtin themes just go into your editor, write `theme` and get it to autocomplete – Rorschach Nov 06 '15 at 06:32

1 Answers1

0

To change the panel's background color, use the following code:

myplot + theme(panel.background = element_rect(fill = 'green', colour = 'red'))

To change the color of the plot (but not the color of the panel), you can do:

myplot + theme(plot.background = element_rect(fill = 'green', colour = 'red'))

See here for more theme details https://groups.google.com/forum/#!topic/ggplot2/AfTB5ijyUIE

Jayesh Dhandha
  • 1,983
  • 28
  • 50