■ Assignment: Boxplot and Scatter Plot in Data
Visualization
1■■ Boxplot
When to Use:
• A Boxplot is used for numerical (continuous) data.
• It shows the distribution, spread, and outliers in a dataset.
• It’s ideal for comparing distributions of a numerical variable across different categories.
Example:
Suppose we have students’ marks in Math from three different classes (Class A, Class B, Class C).
We can use a Boxplot to compare how marks vary across classes.
[Link](x='Class', y='Marks', data=df)
Interpretation:
• The box shows the interquartile range (middle 50% of data).
• The line inside the box shows the median.
• Dots outside the whiskers represent outliers (unusual values).
2■■ Scatter Plot
When to Use:
• A Scatter Plot is used when we have two numerical variables.
• It helps to visualize the relationship or correlation between those variables.
Example:
We have data of students’ Hours of Study and their Exam Scores.
[Link](x='Hours_of_Study', y='Exam_Score', data=df)
Interpretation:
• Each point represents one student.
• Upward pattern → Positive correlation (more study → higher score).
• Downward pattern → Negative correlation.
3■■ Difference Between 1D and 2D Scatter Plots
Feature 1D Scatter Plot 2D Scatter Plot
Number of Variables One numerical variable Two numerical variables
Axes Used Only X-axis Both X and Y axes
Purpose Shows distribution or spread of one variable
Shows relationship between two variables
Example Plot of students’ marks along one axisPlot of Hours of Study (x) vs Exam Score (y)
■ Summary:
• Boxplot → Distribution and outliers of numerical data.
• Scatter plot → Relationship between two numerical variables.
• 1D scatter plot → One variable.
• 2D scatter plot → Two variables.