饼状图在统计分析中有着重要的应用,python中用于绘制饼状图是matplotlib中的pyplot类,这里就介绍一下,如何绘制饼状图。
直接看下面的代码
"""
===============
Basic pie chart
===============
Demo of a basic pie chart plus a few additional features.
In addition to the basic pie chart, this demo shows a few optional features:
* slice labels
* auto-labeling the percentage
* offsetting a slice with "explode"
* drop-shadow
* custom start angle
Note about the custom start angle:
The default ``startangle`` is 0, which would start the "Frogs" slice on the
positive x-axis. This example sets ``startangle = 90`` such that everything is
rotated counter-clockwise by 9