I often prefer to use light text on a dark colortheme background in the IDE. When I draw something in R, the default colors for the graphs are black text / borders / dots on a white background. I tried to change this by default, preferably for certain devices called from R by default ( X11cairo , RStudioGD ), while preserving the standard default values ββfor the "output" devices, such as pdf and png .
My question is twofold: (1) How to set the default graphics settings? and (2) Can I do this only for certain devices?
For example, I can easily set the color scheme in the current device using par :
par( bg = "black", col = "white", col.axis = "white", col.lab = "white", col.main = "white", col.sub = "white") plot(1)
Creates white on a black graph, as expected, and as expected, rebooting the device will revert to the default values:
dev.off() plot(1)
I tried putting the following in my .Rprofile :
graphics:::par( bg = "black", col = "white", col.axis = "white", col.lab = "white", col.main = "white", col.sub = "white") graphics:::plot(1,type="n",xlab="",ylab="",axes=FALSE) graphics:::text(1,1,"Plotting area")
Which works somewhat, except that it opens the plot window at startup, which can be annoying, and in RStudio it does not open the RStudio device, but the window is x11 . Also, if I close this window, the parameters reset again. I would rather have this default color scheme every time I open the graphing window, for example, using the default RStudio device.