Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: How can you add text annotations to a Matplotlib plot?
Answer: Use the `plt.text()` function to add text annotations at specified coordinates on the plot.

Example:

plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.text(2, 15, 'Annotation')
plt.show()
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook