1. Home
  2. Data Science
  3. Matplotlib
  4. What function is used to add a colorbar to a plot in…

Added 24 Feb 2024

What function is used to add a colorbar to a plot in Matplotlib?

  1. plt.colorbar() Correct answer
  2. plt.add_colorbar()
  3. plt.create_colorbar()
  4. plt.show_colorbar()

Correct answer

A. plt.colorbar()

19 views

MCQSEXAM

Explanation

plt.colorbar() adds a colour scale beside a plot, showing how colours map to data values. It is typically used after imshow(), scatter() with a c argument, or contourf().

The other function names do not exist.

For more solved questions like this one, see Data Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Matplotlib MCQs

Practise all Matplotlib MCQs

Similar MCQs