Bird
0
0

Which Matplotlib function is commonly used to add a legend to a Seaborn plot?

easy📝 Conceptual Q2 of 15
Matplotlib - Seaborn Integration
Which Matplotlib function is commonly used to add a legend to a Seaborn plot?
Asns.set()
Bsns.legend()
Cplt.title()
Dplt.legend()
Step-by-Step Solution
Solution:
  1. Step 1: Identify legend functions in Seaborn and Matplotlib

    Seaborn does not have a legend function; Matplotlib uses plt.legend() to add legends.
  2. Step 2: Confirm correct function for legend

    Using plt.legend() after a Seaborn plot adds the legend correctly.
  3. Final Answer:

    plt.legend() -> Option D
  4. Quick Check:

    Legend function = plt.legend() [OK]
Quick Trick: Use plt.legend() to add legends after Seaborn plots [OK]
Common Mistakes:
  • Trying sns.legend() which does not exist
  • Confusing plt.title() with legend function
  • Using sns.set() which sets style, not legend

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes