November 2018
Beginner to intermediate
214 pages
5h 2m
English
To change the appearance of the preceding table so that Nitrogen is blue, Oxygen is green, and Argon is red, we will pass some arguments in the following code:
# Cell colours w/ rowColours, cellColours & colColoursfracs = (78, 21, 1)labels = ('Nitrogen', 'Oxygen', 'Argon')plt.pie(fracs, labels=labels)plt.table(cellText=[fracs], rowLabels=['Fraction'], colLabels=labels, colColours=['b','g','r'])plt.gca().set_aspect('equal')
The column labels will change. The output is as follows:

To change the color of the Fraction row, change callColors to cellColors. Since it has to match the same dimensions, we can give ...
Read now
Unlock full access