Ggpllots Not Showing in Pane in Rstudio

Trying to create a ggplot using standard diamonds data setup and the code runs without errors but the plot does not display.

I've tried re-starting RStudio, running dev.new() and dev.off() but the command ggplot(diamonds) still does not work

Code run:
install.packages("ggplot2")
library(ggplot2)
ggplot(diamonds)

System Information:

  • RStudio Edition: (Desktop)
  • RStudio Version: 1.4.1106

Referred here from support.rstudio.com

This is expected.

only creates a ggplot blank object, using the diamonds
data set. To display requires providing aesthetics indicating what variables to plot and geoms to specify how to plot them.

library(ggplot2)
p <- ggplot(diamonds,aes(carat,depth))
p + geom_point() + theme_minimal()

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.