Ggplots appearing as default R plots

Description of issue -
I have downloaded R and Rstudio on my work laptop and am trying to use ggplot for data visualizations. When I try to plot anything with ggplot, the resulting plot does not look like a ggplot, it looks like a regular R plot.
For instance, if I did
p <- ggplot(data=mtcars, aes(x=wt, y=mpg)) + geom_point()
print(p)

The resulting plot would look like if the code had been this
plot(mtcars$wt, mtcars$mpg)

There is no gray background or gridlines like you would expect to see in a ggplot. I tried uninstalling and reinstalling the package but nothing has worked.


Referred here from support.rstudio.com

Presuming you have the tidyverse package installed and loaded, your code works fine for me.

To help identify the problem, can you please share a reprex (reproducible example)? This will ensure we're all looking at the same data and code. A guide for creating a reprex can be found here.

1 Like

Yeah, with the code you've supplied, I'm unable to reproduce:

library(ggplot2)
p <- ggplot(data=mtcars, aes(x=wt, y=mpg)) + geom_point()
print(p)  # FYI, can just put p, no need for print()


plot(mtcars$wt, mtcars$mpg)

Created on 2018-09-05 by the reprex package (v0.2.0.9000).

It is actually a bizarre issue that has just been solved. It actually turns out the issue was not related to R at all...but rather my computer screen was not able to display the shade of grey that was present in the plots! I was trying to send a reprex and a screenshot when I removed the hdmi and the graphs appeared perfectly normal on my laptop screen. I tried adjusting the brightness and contrast of the monitor, but the shade of grey in the ggplot still is invisible.

Anyway, thank you all for your help, it appears this is an issue for my IT department.