Which function is used to set the title of a plot in Matplotlib?
Correct answer
B. title()
15 views
B. title()
15 views
title() sets the title of the current plot: plt.title("Sales 2026").
In the object-oriented interface the equivalent is ax.set_title(). Mixing up these two forms is the usual trap in this question.
Want more practice? Try the full set of Data Science MCQs on MCQsExam.com.
Not sure why the answer is B? Ask here and get an explanation.