Page 304 - Ai_V3.0_c11_flipbook
P. 304
# Equal aspect ratio ensures that pie is drawn as a circle.
plt.axis('equal')
# Show plot
plt.show()
Output:
This code will generate a pie chart with slices representing the number of books read in a month for each category:
Fiction, Murder Mystery, Comic Books, and Self-help books. The first slice (Fiction) is exploded to highlight it explode
parameter. The ‘autopct’ parameter displays the percentage value of each slice (each label will show the percentage
value of the corresponding slice, rounded to zero decimal place), and ‘shadow’ adds a shadow effect. The ‘startangle’
parameter rotates the start of the pie chart to 140 degrees for better visual appeal.
Task #Experiential Learning
1. Scan the QR code or visit the given link to watch the video:
https://www.youtube.com/watch?v=9cFsCfKLyrQ
Now create the pie chart on your own.
2. Next take a quiz on Matplotlib. Scan the QR code or go to the website:
https://runestone.academy/ns/books/published/py4e-int/viz/Exercises.html
How much did you score?
Introduction to Matrices
The knowledge of matrices is necessary in all branches of Mathematics. Matrix is one of the most powerful tools in
Mathematics. Compared to other methods, it greatly simplifies the calculations.
In mathematics, a matrix (plural matrices) is a rectangular arrangement of numbers. The numbers are arranged in
tabular form as rows and columns.
Let us understand with the help of an example:
Ganga bought 12 oranges and 5 apples.
Hemant bought 10 oranges and 7 apples.
Gargi bought 5 oranges and 2 apples.
302 Touchpad Artificial Intelligence (Ver. 3.0)-XI

