当前位置:网站首页>openpyxl 绘制雷达图
openpyxl 绘制雷达图
2022-07-16 23:57:00 【奋斗中的打工人】
效果

代码
from openpyxl import Workbook
from openpyxl.chart import (
RadarChart,
Reference,
)
wb = Workbook() # 新建wb对象
ws = wb.active # 活跃的单元表
rows = [
['Month', "Bulbs", "Seeds", "Flowers", "Trees & shrubs"],
['Jan', 0, 2500, 500, 0, ],
['Feb', 0, 5500, 750, 1500],
['Mar', 0, 9000, 1500, 2500],
['Apr', 0, 6500, 2000, 4000],
['May', 0, 3500, 5500, 3500],
['Jun', 0, 0, 7500, 1500],
['Jul', 0, 0, 8500, 800],
['Aug', 1500, 0, 7000, 550],
['Sep', 5000, 0, 3500, 2500],
['Oct', 8500, 0, 2500, 6000],
['Nov', 3500, 0, 500, 5500],
['Dec', 500, 0, 100, 3000],
]
# 数据写入到单元表中
for row in rows:
ws.append(row)
chart = RadarChart()
chart.type = "filled"
labels = Reference(ws, min_col=1, min_row=2, max_row=13)
data = Reference(ws, min_col=2, max_col=5, min_row=1, max_row=13) # 绘图的数据区域
chart.add_data(data, titles_from_data=True)
chart.set_categories(labels)
chart.style = 26
chart.title = "Garden Centre Sales" # 图表标题
chart.y_axis.delete = True
ws.add_chart(chart, "A17") # 把图标添加到A17的位置
wb.save("radar.xlsx") # 保存excle表文件
边栏推荐
- Coordinate solution of rectangular coordinate system rotation (n*90 °) (1 ≤ n ≤ 4)
- 简单聊聊最近遇到的两个面试题
- Leetcode-5 longest palindrome substring
- SAP ABAP excel export (multiple sheet pages)
- [paper notes] - feature visualization - zfnet - 2014-eccv
- 64位中断汇编不能使用
- [untitled]
- QT opens external program and embeds QT interface
- 乐观锁和悲观锁在kubernetes中的应用
- Deep and detailed understanding of matrix (addition, subtraction, multiplication, transpose, conjugate, conjugate transpose of matrix)
猜你喜欢

【著色器實現Wave效果_Shader效果第一篇】

Deep learning - multidimensional data and tensor

LeetCode 242:有效的字母异位词

【深度学习】(二)深度学习基础学习笔记

“husky install“ command already exists in prepare script, skipping./Users/982471938qq.com/Desktop

See the application of comparative learning in recommendation from 22 top meetings

Hcia-r & s self use notes (6) (network layer) ICMP, IP protocol foundation and fragmentation

从22顶会看对比学习在推荐的应用

prometheus+grafana可视化实时jvm监控工具

NiO three board axe buffer, a double-edged sword to improve program efficiency
随机推荐
【着色器实现Wave效果_Shader效果第一篇】
[sort] insert sort, Hill sort and heap sort
Hcia-r & s self use notes (6) (network layer) ICMP, IP protocol foundation and fragmentation
uml类图浅录
MySQL常用命令
Greenplum common
Greenplum 6.x client connection
Solution to the problem of creating file permissions in golang
See the application of comparative learning in recommendation from 22 top meetings
我的创作纪念日
SAP ABAP excel export (multiple sheet pages)
Leetcode 242: valid Letter ectopic words
Greenplum常用
baomidou Page 这个page是从1 开始的 ,jpa的是从0 开始的
Acquisition of network security B module coding information of national vocational college skills competition
UVA11362 Phone List 题解
交换机与路由器技术:链路聚合、生成树协议STP和生成树协议配置
[paper notes] - feature visualization - zfnet - 2014-eccv
Greenplum6.x客户端连接
Briefly talk about two interview questions encountered recently