博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python 每n个切片_Python | 分离饼图中的每个切片
阅读量:2530 次
发布时间:2019-05-11

本文共 2464 字,大约阅读时间需要 8 分钟。

python 每n个切片

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. In this tutorial, we are going to separate all the slices of the pie chart for different distances. The following example is an illustration of the same.

饼图中的派饼名称是由于与切成薄片的饼相似而派生的。 饼图在不同类型的项目和商业环境中得到了广泛的使用。 Matplotlib在matplotlib.pyplot.pie()中具有定义的函数,用于绘制饼图。 在本教程中,我们将饼图的所有部分分开以实现不同的距离。 以下示例是对它的说明。

distance = 0.2separate = (distance, distance, distance, distance, distance, distance)matplotlib.pyplot.pie(sizes, labels=labels, explode=saperate, autopct='%1.1f%%')
Python | Separating Each Slice in Pie Plot (1)
Python | Separating Each Slice in Pie Plot (2)
Python | Separating Each Slice in Pie Plot (3)

用于在饼图中分离每个切片的Python代码 (Python code for separating each slice in pie plot)

# Data Visualization using Python# Separating each Slice in Pie Plotimport 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]# Illustration 1distance = 0.2separate = (distance, distance, distance, distance, distance, distance)plt.figure()plt.pie(sizes, labels=labels, explode=separate, autopct='%1.1f%%')# Equal aspect ratio ensures that # pie is drawn as a circle.plt.axis('equal')  plt.title('saperation diatance = 0.4')plt.show()# Illustration 2distance = 0.1separate = (distance, distance, distance, distance, distance, distance)plt.figure()plt.pie(sizes, labels=labels, explode=separate, autopct='%1.1f%%')# Equal aspect ratio ensures that # pie is drawn as a circle.plt.axis('equal')  plt.title('saperation diatance = 0.2')plt.show()# Illustration 3distance = 0.4separate = (distance, distance, distance, distance, distance, distance)plt.figure()plt.pie(sizes, labels=labels, explode=separate, autopct='%1.1f%%')# Equal aspect ratio ensures that # pie is drawn as a circle.plt.axis('equal')  plt.title('saperation diatance = 0.8')plt.show()

Output:

输出:

Output is as figure

翻译自:

python 每n个切片

转载地址:http://yzozd.baihongyu.com/

你可能感兴趣的文章
P3384 【模板】树链剖分
查看>>
Thrift源码分析(二)-- 协议和编解码
查看>>
考勤系统之计算工作小时数
查看>>
4.1 分解条件式
查看>>
Equivalent Strings
查看>>
flume handler
查看>>
收藏其他博客园主写的代码,学习加自用。先表示感谢!!!
查看>>
H5 表单标签
查看>>
su 与 su - 区别
查看>>
C语言编程-9_4 字符统计
查看>>
在webconfig中写好连接后,在程序中如何调用?
查看>>
限制用户不能删除SharePoint列表中的条目(项目)
查看>>
【Linux网络编程】使用GDB调试程序
查看>>
feign调用spring clound eureka 注册中心服务
查看>>
ZT:Linux上安装JDK,最准确
查看>>
LimeJS指南3
查看>>
关于C++ const成员的一些细节
查看>>
《代码大全》学习摘要(五)软件构建中的设计(下)
查看>>
C#检测驱动是否安装的问题
查看>>
web-4. 装饰页面的图像
查看>>