GGplot background display

I'm having a strange problem. When I create ggplot plots, the background of the plots is white with no grid lines or background color (the default is usually gray) when I view the plots on my laptop. However, when I stream my display to a separate monitor the background, which appears white on my computer, appears with the normal gray background and axis lines. Does anybody have any clue as to what is going on?

The plot background appears white in the knit document as well.

Strange. What's your system setup (e.g. your OS, version of R, version of RStudio — see how to get that info in post below)?

Just so we can be sure we're running the same code, let's use this example (see reprex, below). Definitely start a fresh session to make sure you don't have anything funky going on in your environment that's somehow colliding.

library(ggplot2)
ggplot(mtcars) +
  geom_point(aes(mpg, hp))

Created on 2019-01-31 by the reprex package (v0.2.1.9000)

1 Like

So, I opened a fresh Rstudio session and ran the above code and the problem persisted. I am using R Studio Version 1.2.1206, R version 3.5.2, and Mac OS High Sierra (10.13.4 )

Do you have tried reinstalling xquartz?

https://www.xquartz.org/

1 Like

I'm not running r/rstudio on a linux box, so I don't believe that will help

Xquartz has nothing to do with a Linux box

From the CRAN web site

Note: the use of X11 (including tcltk) requires XQuartz to be installed since it is no longer part of OS X. Always re-install XQuartz when upgrading your macOS to a new major version.

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.