why am I using a simple code that doesn´t work?

I am using a simple code to map a graph from mpg database:

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?

You need to add a "+" between ggplot() and geom_point() (or any other ggplot element) . The code below works:


ggplot(data=mpg) + 
  geom_point (mapping=aes(x=displ, y= hwy))
1 Like

Thanks a lot! Now it is working. Im starting with R so I really appreciate any help!

David Kane

Preceptor’s Primer for Bayesian Data Science: Using the Cardinal Virtues for Inference

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.