Building a Simple Plot Using Grammar of Graphics in R
📖 Scenario: You are a data analyst who wants to visualize the relationship between two variables in a small dataset. You will use the Grammar of Graphics concept to build a plot step-by-step in R.
🎯 Goal: Create a scatter plot using the Grammar of Graphics approach with ggplot2 in R. You will start by setting up the data, then configure the plot, add points, and finally display the plot.
📋 What You'll Learn
Create a data frame called
data with exact columns height and weight and given valuesCreate a
ggplot object called plot with data and aesthetic mapping for height and weightAdd a
geom_point() layer to plot to show pointsPrint the
plot object to display the scatter plot💡 Why This Matters
🌍 Real World
Data analysts and scientists use the Grammar of Graphics to build clear and customizable visualizations to understand data patterns.
💼 Career
Knowing how to use ggplot2 and the Grammar of Graphics is essential for roles in data analysis, data science, and reporting.
Progress0 / 4 steps