上QQ阅读APP看书,第一时间看更新
How it works...
The following is the explanation of the code:
- labels and sizes are Python lists representing genre and the percentage of the total of the movies released in a year. The order of the labels in the input list is plotted counter clockwise in the pie chart.
- The explode argument specifies which slice of the chart is to be exploded outwards.
- The autopct argument depicts the number of decimal points to be shown in the percentage data points. If this argument is omitted, slices will not show the actual percentage (%) data.
- The shadow argument specifies whether each slice should be shown with a shadow.
- The startangle arguments specifies the angle in which the first slice should start, and it goes anticlockwise to represent all other slices in the pie chart.
- plt.pie() draws the pie plot.
- plt.axis(equal) indicates that the chart should be shown in a circle (equal x and y axes). The default shape is an ellipse: