1. Home
  2. Data Science
  3. Matplotlib
  4. What function is used to set the x-axis limits in…

Added 24 Feb 2024

What function is used to set the x-axis limits in Matplotlib?

  1. plt.xlim() Correct answer
  2. plt.set_xlim()
  3. Both A and B
  4. None of the above

Correct answer

A. plt.xlim()

13 views

MCQSEXAM

Explanation

plt.xlim() gets or sets the x-axis limits: plt.xlim(0, 10).

set_xlim() is a method of an Axes object (ax.set_xlim(0, 10)), so plt.set_xlim() does not exist.

Want more practice? Try the full set of 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