It seems that this question fist appeared around 2007.
The question is this:
How to change gridline and background color when plotting with ggplot2 in R? I add two pictures as an example on what I mean by background and gridline color.
Back in 2007, Hadley Wickham said that appearance functionalities were missing (this included changing the color of background). Does anybody knows if there's an update that allows to change the background color and the color of gridlines?
Thanks in advance
Red colour is used in the topographical map to show grid lines and their numbering.
Understanding Excel Gridlines Gridlines are displayed in a workbook using a grey color that is applied automatically. If you want o change the gridline colors, Go to the File tab, Options, Advanced and then click Grid Color. Select the color you want to use and then go back to the worksheet.
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window. 3. And then save and close the code window, now, when you fill a color for a range of cells, the gridlines will be showed automatically.
Note: Since version 0.9.2 this is done using theme
:
theme(panel.background = element_rect(colour = "white"))
Additionally, there are panel.grid.major
and panel.grid.minor
options. See here for a full list of options and some examples. There is also documentation at ?theme
.
In older version of ggplot2 this was done via:
opts(panel.background=theme_rect(colour="white"),...)
You can also switch to more traditional theme using theme_bw()
.
You can also find information on themes and opts() on this SO thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With