What function is used to set the x-axis limits in Matplotlib?
Correct answer
A. plt.xlim()
13 views
A. plt.xlim()
13 views
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.
Not sure why the answer is A? Ask here and get an explanation.