How to add a text box in Matplotlib

You can add a text box in Matplotlib with the following code. If you want to learn Python then I will highly recommend you to read This Book.

How to add a text box in Matplotlib
How to add a text box in Matplotlib

Add a text box in Matplotlib

import matplotlib.pyplot as plt

x = [1,2,3,4,5]
y = [5,10,15,20,25]

plt.title("Numbers and their Products")
plt.xlabel("Numbers")
plt.ylabel("Products")

plt.text(2, 15, 'Line', fontsize = 25, bbox = dict(facecolor = 'wheat', alpha = 0.7))

plt.plot(x, y, color='blue')
plt.show()

People are also reading:

Best Python Books

What is Computer Vision? Examples, Applications, Techniques

Top 10 Computer Vision Books with Python

Books for Machine Learning (ML)

Free Learning Resources

Leave a Comment

Your email address will not be published.