Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Know your problem
Know your data
Visualize your data – numerical variables
10. Plot your data
Work with your chart
Check yourself

Instruction

Let's plot our data on the scatter plot. To do that, we will use the R function geom_point() again. This will add one point for each observation in our dataset. You can use it by simply adding it to the ggplot function:

ggplot(data = dataset, aes( x = variable_x, y = variable_y)) + geom_point()

Exercise

Plot the alcohol_wealth data on a scatter plot using the above syntax. Set alcohol_wealth as the dataset, wealth_index as the x variable, and consumption as the y variable. When you're done, press Run and Check Code to check your code.

Stuck? Here's a hint!

You should write:

scatterplot <- ggplot(data = alcohol_wealth, aes(x = wealth_index, y = consumption)) + 
    geom_point()