Line plots (geom_line)
📖 Scenario: You are a data analyst working with monthly sales data for a small store. You want to create a simple line plot to see how sales change over the months.
🎯 Goal: Build a line plot using geom_line() in R with ggplot2 to visualize monthly sales data.
📋 What You'll Learn
Create a data frame called
sales_data with two columns: month and sales with exact values.Create a variable called
plot_title with the exact string 'Monthly Sales Over Time'.Use
ggplot() with geom_line() to create a line plot using sales_data.Add the title stored in
plot_title to the plot using ggtitle().Print the plot.
💡 Why This Matters
🌍 Real World
Line plots are used to show trends over time, like sales, temperature, or stock prices.
💼 Career
Data analysts and scientists use line plots to communicate changes and patterns clearly to others.
Progress0 / 4 steps