Bird
0
0

What will be displayed when running the following code?

medium📝 Predict Output Q4 of 15
Matplotlib - Seaborn Integration
What will be displayed when running the following code?
import seaborn as sns
import matplotlib.pyplot as plt

sns.lineplot(x=[0,1,2], y=[3,2,1])
plt.ylabel('Values')
plt.show()
AA scatter plot with y-axis labeled 'Values' and default x-axis label
BA line plot with y-axis labeled 'Values' and default x-axis label
CA line plot with both x and y axes labeled 'Values'
DAn error because plt.ylabel() is used incorrectly
Step-by-Step Solution
Solution:
  1. Step 1: Understand sns.lineplot()

    Seaborn's lineplot creates a line graph connecting points.
  2. Step 2: Check axis labeling

    plt.ylabel('Values') sets the y-axis label; x-axis label remains default.
  3. Final Answer:

    A line plot with y-axis labeled 'Values' and default x-axis label -> Option B
  4. Quick Check:

    Line plot + y-label only [OK]
Quick Trick: sns.lineplot creates line graphs; plt.ylabel sets y-axis label [OK]
Common Mistakes:
  • Confusing lineplot with scatterplot
  • Assuming plt.ylabel sets x-axis label
  • Expecting error from plt.ylabel usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes