Trend lines on scatter plots
📖 Scenario: You are a data analyst working with sales data. You want to see if there is a trend between the number of hours spent on advertising and the sales revenue.
🎯 Goal: Build a scatter plot showing advertising hours vs sales revenue and add a trend line to see the relationship clearly.
📋 What You'll Learn
Create a dictionary with advertising hours and sales revenue data
Create a variable for the degree of the polynomial for the trend line
Calculate the polynomial fit and generate the trend line values
Plot the scatter plot and the trend line using matplotlib
Display the plot
💡 Why This Matters
🌍 Real World
Trend lines help businesses see if more advertising hours lead to higher sales, guiding marketing decisions.
💼 Career
Data analysts and scientists often use scatter plots with trend lines to find patterns and make predictions.
Progress0 / 4 steps