Which function is used to add a shape to a plot in Matplotlib?
Correct answer
D. plt.add_patch()
17 views
D. plt.add_patch()
17 views
Shapes such as rectangles, circles and polygons are "patches" in Matplotlib and are added with add_patch(), normally as ax.add_patch(Rectangle(...)) on an Axes object.
The classes are found in matplotlib.patches.
Want more practice? Try the full set of Data Science MCQs on MCQsExam.com.
Not sure why the answer is D? Ask here and get an explanation.