【python图像处理】python绘制饼状图
来源:互联网 发布:国内 阿里云 aws 优势 编辑:程序博客网 时间:2024/05/17 12:49
饼状图在统计分析中有着重要的应用,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 angleNote about the custom start angle:The default ``startangle`` is 0, which would start the "Frogs" slice on thepositive x-axis. This example sets ``startangle = 90`` such that everything isrotated counter-clockwise by 90 degrees, and the frog slice starts on thepositive y-axis."""import matplotlib.pyplot as plt# Pie chart, where the slices will be ordered and plotted counter-clockwise:labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'sizes = [15, 30, 45, 10]explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')fig1, ax1 = plt.subplots()ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90)ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.plt.show()
绘制结果如下图所示:
2017.09.19
阅读全文
0 0
- 【python图像处理】python绘制饼状图
- 【python图像处理】】python绘制散点图
- 【python图像处理】python绘制灰度直方图
- python图像处理——图像绘制
- python数字图像处理:图像的绘制
- matplotlib--python绘制图表 | PIL--python图像处理
- 【python图像处理】python绘制3D图形
- 【python图像处理】python绘制极坐标图
- 【python 图像绘制】图像绘制知识总结
- python数字图像处理(5):图像的绘制
- python数字图像处理(5):图像的绘制
- python数字图像处理(5):图像的绘制
- Python与图像处理(1):绘制图像,点和线,图像轮廓,直方图
- Python-Matplotlib绘制简单图像
- python matplotlib图像的绘制
- 【python图像处理】几何图形的绘制与文字的绘制(ImageDraw类详解)
- Python 图像处理详解
- python图像处理示例
- HDU1686 Oulipo
- Java中的关键字
- Redis 字符串(String)介绍以及操作
- 无法启动程序 系统找不到指定的文件
- HTTP请求代理
- 【python图像处理】python绘制饼状图
- 海量数据面试题目
- 有点累了?不如看看兵法三十六计。
- java-编码解密
- 在android系统中开发DLNA
- 3dMax第四章:三维物体修改操作
- java--继承(2)
- java脚本
- Jzoj1306 Sum