November 2018
Beginner to intermediate
214 pages
5h 2m
English
To display the numerical values 78, 21, and 1, we will use the table method that Matplotlib provides and give the keyword argument cell data or cell text.
By inserting colLabels and rowLabels, we get a nice labeled table:
# Add a tablefracs = (78, 21, 1)labels = ('Nitrogen', 'Oxygen', 'Argon')plt.pie(fracs, labels=labels)plt.table(cellText=[fracs], colLabels=labels, rowLabels=["fraction"])plt.gca().set_aspect('equal')

This is a nice way to supplement data. If we have a plot where we have a couple of numbers to show alongside it, the plot table is the way to do this. You may recall that pandas provides a way to automatically do this. ...
Read now
Unlock full access