Scatter Plot
Sample Dataset
Exercises
Create a scatter plot of height_cm
vs. weight_kg
where the points’ size represents the age_years
variable.
Create a scatter plot of height_cm
vs. weight_kg
and color the points based on the gender
variable.
Create a bubble plot where point color represents the gender
variable and size represents age_years
.
Create a scatter plot of height_cm
vs. weight_kg
and add a linear regression line using geom_smooth(method = "lm")
.
Create a scatter plot of height_cm
vs. weight_kg
and add a smooth line using geom_smooth()
with the default method.
Create a scatter plot of height_cm
vs. weight_kg
and facet the plot by city
using facet_grid
.
Create a scatter plot of height_cm
vs. weight_kg
and change the point shape based on the gender
variable.
Create a scatter plot where height_cm
vs. weight_kg
points are colored by gender
and point shape varies based on the city
.
Create a scatter plot of height_cm
vs. weight_kg
with points colored by gender
, add a regression line, and use facet_grid
to separate by city
.
Solution: