I am using a simple code to map a graph from mpg database:
library(ggplot2)
ggplot(data=mpg)
geom_point (mapping=aes(x=displ, y= hwy)
when I type this, there is no error but but graph is plot in blank
Can anyone help me?
thanks
I am using a simple code to map a graph from mpg database:
library(ggplot2)
ggplot(data=mpg)
geom_point (mapping=aes(x=displ, y= hwy)
when I type this, there is no error but but graph is plot in blank
Can anyone help me?
thanks
You need to add a "+" between ggplot()
and geom_point()
(or any other ggplot element) . The code below works:
library(ggplot2)
ggplot(data=mpg) +
geom_point (mapping=aes(x=displ, y= hwy))
Thanks a lot! Now it is working. Im starting with R so I really appreciate any help!
Preceptor’s Primer for Bayesian Data Science: Using the Cardinal Virtues for Inference
https://ppbds.github.io/primer/
Adam Fleischhacker
github_url <- "https://raw.githubusercontent.com/PPBDS/primer.tutorials/master/inst/tutorials/033-data-files/data/"
This topic was automatically closed 42 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.