0
0
Data Analysis Pythondata~30 mins

Scatter plots in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Scatter plots
📖 Scenario: You are a data analyst working with a small dataset of students' study hours and their exam scores. You want to visualize the relationship between how much they studied and how well they scored.
🎯 Goal: Create a scatter plot to show the relationship between study_hours and exam_scores.
📋 What You'll Learn
Create two lists called study_hours and exam_scores with exact values
Create a variable called point_color to set the color of the scatter points
Use matplotlib.pyplot.scatter() to create the scatter plot with the given data and color
Use plt.xlabel() and plt.ylabel() to label the axes
Use plt.title() to add a title to the plot
Use plt.show() to display the plot
💡 Why This Matters
🌍 Real World
Scatter plots are used in many fields like education, business, and science to see how two things relate to each other visually.
💼 Career
Data analysts and scientists use scatter plots to quickly understand patterns and relationships in data, which helps in making decisions.
Progress0 / 4 steps
1
Create the data lists
Create two lists called study_hours and exam_scores with these exact values: study_hours = [1, 2, 3, 4, 5] and exam_scores = [50, 55, 65, 70, 80].
Data Analysis Python
Hint

Use square brackets to create lists and separate numbers with commas.

2
Set the color for scatter points
Create a variable called point_color and set it to the string 'blue' to use as the color for the scatter plot points.
Data Analysis Python
Hint

Use quotes around the color name to make it a string.

3
Create the scatter plot
Import matplotlib.pyplot as plt. Then use plt.scatter() with study_hours, exam_scores, and color=point_color to create the scatter plot. Add labels using plt.xlabel() with text 'Study Hours' and plt.ylabel() with text 'Exam Scores'. Add a title using plt.title() with text 'Study Hours vs Exam Scores'.
Data Analysis Python
Hint

Remember to import matplotlib.pyplot as plt before using it.

4
Display the scatter plot
Use plt.show() to display the scatter plot you created.
Data Analysis Python
Hint

Use plt.show() to display the plot window.