python饼形图_Python | 饼形图

python饼形图

A pie plot or a pie chart is a circular statistical graphic technique, in which a circle is divided into slices with respect to numerical proportion. In a pie chart, the arc length, central angle, and area of each slice, is proportional to the quantity it represents. The sum of the total is always equal to 100 percent in the basic pie chart.

饼图或饼图是一种圆形统计图形技术,其中将一个圆形按数值比例分为多个切片。 在饼图中,每个切片的弧长,圆心角和面积与其表示的量成比例。 在基本饼图中,总数的总和始终等于100%。

The name pie in the pie plot is derived for its resemblance to a pie that has been sliced. Pie charts are very widely used in the different types of projects and business world. Matplotlib has a defined function in matplotlib.pyplot.pie() for plotting a pie chart.

饼图中的派饼名称是由于与切成薄片的饼相似而派生的。 饼图在不同类型的项目和商业环境中得到了广泛的使用。 Matplotlib在matplotlib.pyplot.pie()中具有定义的函数,用于绘制饼图。

matplotlib.pyplot.pie(sizes, labels=labels, autopct='%1.1f%%')
#Square textbox style

Python | Pie Chart

饼图的Python代码 (Python code for pie chart)

# Data Visualization using Python
# Pie Chart

import matplotlib.pyplot as plt

# Pie chart, where the slices will be ordered 
# and plotted counter-clockwise:
labels = 'A', 'B', 'C', 'D', 'E', 'F'
sizes = [15, 20, 10, 17, 1, 37]


plt.figure()
plt.pie(sizes, labels=labels, autopct='%1.1f%%')
# Equal aspect ratio ensures that pie is drawn 
# as a circle.
plt.axis('equal')  

plt.show()

Output:

输出:

Output is as figure


翻译自: https://www.includehelp.com/python/pie-chart.aspx

python饼形图

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值