What is the purpose of the plt.tight_layout() function in Matplotlib?
Correct answer
A. To adjust the subplot spacing automatically
13 views
A. To adjust the subplot spacing automatically
13 views
plt.tight_layout() automatically adjusts subplot spacing so that titles, axis labels and tick labels do not overlap or get cut off.
Call it after creating all the subplots and before savefig() or show().
For more solved questions like this one, see Data Science MCQs on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.