Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
You're offline
Unit 12 MCQsData visualization
ECAP776 ·
60 questions. Pick an option to check it.
Seaborn offers high-level functions such as boxplot, violinplot, and barplot for common statistical comparisons.
Question 26 of 60 · Seaborn vs matplotlib · Medium
After creating ax = sns.scatterplot(...), how should a custom title be added using Matplotlib's object-oriented interface?
Not quite. Try another option.
Answer: ax.set_title("Results")
Most axes-level Seaborn functions return a Matplotlib Axes, so Matplotlib methods such as set_title() remain available.
Question 27 of 60 · Seaborn vs matplotlib · Medium
Which statement correctly compares sns.scatterplot() and sns.relplot(kind="scatter")?
Not quite. Try another option.
Answer: scatterplot() is axes-level; relplot() is figure-level
scatterplot() draws on one Axes, while relplot() manages a figure-level grid and supports faceting.
Question 28 of 60 · Seaborn vs matplotlib · Medium
A chart requires individually positioned annotations, custom arrows, and precise control of every axis element. Which approach is generally most suitable?
Not quite. Try another option.
Answer: Use Matplotlib's lower-level API
Matplotlib provides detailed control over individual artists, annotations, axes, and figure layout.
Question 29 of 60 · Seaborn vs matplotlib · Medium
Why can Matplotlib commands usually customize a chart created by Seaborn?
Not quite. Try another option.
Answer: Seaborn builds its charts on Matplotlib
Seaborn is a high-level visualization library built on Matplotlib, so their APIs can be used together.
Question 30 of 60 · Data visualization using seaborn · Medium
A scatter plot must distinguish species by both color and marker shape. Which call performs this mapping?
relplot() is a figure-level function that supports faceting through parameters such as col and row.
Question 40 of 60 · Data visualization using seaborn · Medium
A table contains columns month, city, and temperature, with one observation per city-month pair. What should be done before creating a heatmap with months as rows and cities as columns?
Not quite. Try another option.
Answer: Pivot the table into a month-by-city matrix
A heatmap requires a two-dimensional matrix, so the long-form table should be pivoted using months and cities as its axes.
Question 41 of 60 · Seaborn vs matplotlib · Hard
A figure already contains two Matplotlib subplots created by fig, axs = plt.subplots(1, 2). Which call draws a Seaborn histogram specifically on the second subplot without creating another figure?
histplot is an axes-level function and accepts an ax argument. displot is figure-level, creates its own figure, and does not embed itself using ax.
Question 42 of 60 · Seaborn vs matplotlib · Hard
A dataset contains repeated measurements of score at each time. Which capability most directly distinguishes sns.lineplot from a basic plt.plot call?
Not quite. Try another option.
Answer: It estimates a central tendency and uncertainty from repeated observations.
sns.lineplot can aggregate repeated observations at each independent-variable value and visualize uncertainty. With Matplotlib, those statistics generally must be computed explicitly.
Question 43 of 60 · Introduction to seaborn · Hard
What object is returned by ax2 = sns.scatterplot(data=df, x="x", y="y") when no ax argument is supplied?
Not quite. Try another option.
Answer: The Matplotlib Axes containing the plot
scatterplot is an axes-level function. It uses the current axes when ax is omitted and returns that Matplotlib Axes object.
Question 44 of 60 · Introduction to seaborn · Hard
An Axes and several artists have already been created before sns.set_theme(style="darkgrid") is called. Which statement best describes the effect?
Not quite. Try another option.
Answer: It changes global defaults but does not rewrite existing artist properties.
set_theme updates Matplotlib configuration defaults. It primarily affects subsequently created plot elements; properties already assigned to existing artists are not retroactively replaced.
Question 45 of 60 · Data visualization using seaborn · Hard
A table has columns control, low_dose, and high_dose, with one measurement per row in each column. You need sns.relplot with treatment mapped to both hue and col. Which transformation is most appropriate?
Not quite. Try another option.
Answer: Melt the columns into treatment and measurement variables.
Figure-level semantic mappings work naturally with long-form data. Melting creates one treatment column for hue and col, plus one measurement column for the plotted value.
Question 46 of 60 · Data visualization using seaborn · Hard
Under current Seaborn defaults, what happens when sns.lineplot(data=df, x="time", y="response") receives many response observations at each time value?
Not quite. Try another option.
Answer: It plots the mean response with a bootstrapped 95% confidence interval.
By default, lineplot uses the mean estimator and displays a 95% confidence interval obtained through bootstrapping. These behaviors can be changed with estimator and errorbar.
Question 47 of 60 · Data visualization using seaborn · Hard
A longitudinal dataset contains subject, time, and score. Which call draws one trajectory per subject without adding every subject identifier to the legend?
units creates separate lines for sampling units without legend entries. Aggregation must be disabled with estimator=None so each subject's observations remain a distinct trajectory.
Question 48 of 60 · Data visualization using seaborn · Hard
In sns.histplot(data=df, x="value", hue="group", stat="density", common_norm=True), how are overlaid group densities normalized?
Not quite. Try another option.
Answer: Their combined area is normalized to one.
With common_norm=True, normalization uses all semantic subsets together, so their density areas sum to one collectively. Setting it to False normalizes each subset independently.
Question 49 of 60 · Data visualization using seaborn · Hard
Consider sns.histplot(data=df, x="amount", bins=10, log_scale=True) where amount includes zero and positive values spanning several orders of magnitude. Which interpretation is correct?
Not quite. Try another option.
Answer: Bins are spaced in log coordinates, while nonpositive values cannot be represented.
Seaborn accounts for the logarithmic axis when defining bins, producing logarithmic spacing in data coordinates. Zero and negative values are invalid on a logarithmic axis and are not automatically shifted.
Question 50 of 60 · Introduction to seaborn · Hard
What does g = sns.catplot(data=df, x="group", y="score", col="site", kind="box") return, and where should facet-wide customization be applied?
Not quite. Try another option.
Answer: A FacetGrid; use methods such as g.set_axis_labels().
catplot is figure-level and returns a FacetGrid. Grid methods coordinate labels, titles, legends, and other changes across all facets.
Question 51 of 60 · Data visualization using seaborn · Hard
A custom plotting function expects a facet subset as data and receives column names through x and y. Which FacetGrid method is designed for this interface?
map_dataframe passes each facet's long-form subset through the data keyword and supports variable-name keyword arguments. map instead passes selected columns as positional vectors.
Question 52 of 60 · Data visualization using seaborn · Hard
A categorical scatter plot uses numeric years 2000, 2005, and 2020 on the categorical axis. Which setting preserves the unequal numeric spacing instead of placing the years at ordinal positions 0, 1, and 2?
Not quite. Try another option.
Answer: Set native_scale=True.
Categorical functions normally assign fixed ordinal positions to category levels. native_scale=True retains the original numeric or datetime coordinate scale and therefore preserves unequal spacing.
Question 53 of 60 · Data visualization using seaborn · Hard
A heatmap contains values from to and is drawn with sns.heatmap(data, center=0, cmap="vlag") but without vmin or vmax. What should be expected?
Not quite. Try another option.
Answer: Zero uses the colormap's central color, but limits need not be symmetric.
center=0 centers a divergent colormap on zero, but it does not guarantee symmetric displayed limits. Set symmetric vmin and vmax explicitly when equal-magnitude color scaling is required.
Question 54 of 60 · Data visualization using seaborn · Hard
For a square correlation matrix corr, which mask hides only the entries strictly above the main diagonal while retaining the diagonal and lower triangle?
np.triu(..., k=1) marks positions one diagonal above the main diagonal and higher. Since True cells are hidden by heatmap, the diagonal and lower triangle remain visible.
Question 55 of 60 · Seaborn vs matplotlib · Hard
Which statement correctly describes sns.clustermap when integrating it into an existing Matplotlib layout?
Not quite. Try another option.
Answer: It creates its own figure and returns a ClusterGrid.
clustermap is a figure-level interface that manages a heatmap, dendrogram axes, and color-related axes itself. It returns a ClusterGrid rather than accepting a normal target ax.
Question 56 of 60 · Seaborn vs matplotlib · Hard
You need separate regression panels by region, with a regression line and scatter plot in each panel. Which choice uses Seaborn's appropriate abstraction directly?
lmplot is a figure-level regression interface built on a facet grid and supports col and row. regplot is axes-level and does not directly create facets.
Question 57 of 60 · Data visualization using seaborn · Hard
A FacetGrid maps sns.histplot over subsets with very different ranges. Automatic bin selection produces different bin edges in each panel, making heights hard to compare. What is the most reliable correction?
Not quite. Try another option.
Answer: Compute global bin edges once and pass the same bins to every facet.
Shared axis limits do not ensure shared histogram boundaries. Precomputing edges from the full dataset and passing them to every facet makes corresponding bars represent identical intervals.
Question 58 of 60 · Data visualization using seaborn · Hard
Two separate scatter plots map the same numeric variable to hue, but each plot contains a different subset of its range. How can identical values be guaranteed to receive identical colors across both plots?
Not quite. Try another option.
Answer: Use the same continuous palette and the same explicit hue_norm limits.
Separate calls otherwise normalize numeric hue values against their local ranges. A shared palette and explicit hue_norm, such as the global minimum and maximum, establish one common color mapping.
Question 59 of 60 · Data visualization using seaborn · Hard
In sns.boxplot(data=df, x="group", y="value", whis=(5, 95)), what do the whisker endpoints represent?
Not quite. Try another option.
Answer: The 5th and 95th percentiles within each group
Passing a two-element percentile tuple to whis places whiskers at those percentiles. This differs from the usual scalar rule based on multiples of the interquartile range.
Question 60 of 60 · Data visualization using seaborn · Hard
A box plot and strip plot are overlaid on the same axes, both using hue="treatment". The legend contains duplicate entries. Assuming the box-plot legend should be retained, what is the cleanest preventive approach?
Not quite. Try another option.
Answer: Pass legend=False to the overlaid strip-plot call.
Both layers can independently add entries for the same hue mapping. Disabling legend generation on the second layer prevents duplication while preserving the first layer's legend.
That's unit 12
Answer a few questions and your score shows up here.
Nearly through. Did unit 12 of ECAP776 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 12 of ECAP776 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.