WorksheetsMatplotlib + Seaborn
Total questions: 15
Worksheet time: 11mins
In plt.figure(figsize=(8,5)), what does (8,5) mean?
(rows, columns) in subplot
(width, height) in inches
(x-limit, y-limit)
(font-size, line-width)
To plot multiple graphs in one figure, which is used?
plt.groupplot()
plt.subplots()
plt.multiplot()
plt.subplot()
Seaborn is built on top of which library?
NumPy
Pandas
Matplotlib
Plotly
Which plot is best for showing relationship between 2 numerical variables?
sns.boxplot()
sns.scatterplot()
sns.countplot()
sns.barplot()
Which plot is used for categorical vs numeric comparison?
sns.barplot()
sns.lineplot()
sns.regplot()
sns.kdeplot()
Which Matplotlib function is best for visualizing distribution as histogram + KDE-like smoothing?
plt.hist()
plt.kde()
plt.smooth_hist()
Matplotlib cannot do KDE directly
When using subplots, what does fig, ax = plt.subplots(2,2) return?
fig and a list of 2 axes
fig and a 2x2 NumPy array of Axes
only figure
only axes
Which Seaborn plot is best for showing relationship + regression line?
sns.scatterplot()
sns.regplot()
sns.regression()
sns.relationship()
What is the major difference between sns.barplot() and sns.countplot()?
Both count frequency
countplot works only for numeric data
barplot cannot show confidence intervals
barplot shows mean/estimator while countplot shows counts
What does hue do in Seaborn plots?
Changes axis label
Splits data into subclass categories with colors
Adds 3D effect
Adds grid automatically
In sns.boxplot(), what do the whiskers represent by default?
Min and max always
Mean and std
1.5 * IQR range
Median and mode
Which plot is best to detect outliers in categorical vs numeric data?
sns.lineplot()
sns.boxplot()
sns.heatmap()
sns.countplot()
If you want to plot distribution of a numeric variable split by category, best choice is:
sns.histplot(data=df, x="salary", hue="gender")
sns.countplot(data=df, x="salary", hue="gender")
sns.scatterplot(data=df, x="salary", y="gender")
sns.heatmap(df["salary"])
Which is TRUE about plt.subplot(221)?
(2 rows, 2 cols, 1st plot)
(2 rows, 2 cols, 2nd plot)
(221 rows, 1 col)
Error
In sns.boxplot(), the line inside the box represents:
Mean
Median
Mode
Standard deviation
