Python第三方库之openpyxl(7)

散点图

散点或xy图表类似于一些折线图。主要的区别在于,一个系列的值被绘制在另一个值上。当值未排序时,这是有用的。

from openpyxl import Workbook
from openpyxl.chart import (
ScatterChart,
Reference,
Series,
) wb = Workbook()
ws = wb.active rows = [
['Size', 'Batch 1', 'Batch 2'],
[2, 40, 30],
[3, 40, 25],
[4, 50, 30],
[5, 30, 25],
[6, 25, 35],
[7, 20, 40],
] for row in rows:
ws.append(row) chart = ScatterChart()
chart.title = "Scatter Chart"
chart.style = 13
chart.x_axis.title = 'Size'
chart.y_axis.title = 'Percentage' xvalues = Reference(ws, min_col=1, min_row=2, max_row=7)
for i in range(2, 4):
values = Reference(ws, min_col=i, min_row=1, max_row=7)
series = Series(values, xvalues, title_from_data=True)
chart.series.append(series) ws.add_chart(chart, "A10") wb.save("scatter.xlsx")

运行结果

最新文章

  1. Java代码规范
  2. 解决R速度太慢问题
  3. zw版【转发·台湾nvp系列Delphi例程】HALCON Component Histogram
  4. 【Unity Shaders】初探Surface Shader背后的机制
  5. CDH hadoop的安装
  6. Windows Server 2012远程刷新客户端组策略,IE代理设置
  7. HDU 4405-Aeroplane chess(概率dp)
  8. Composer使用笔记
  9. J-Link固件烧录以及使用J-Flash向arm硬件板下载固件程序
  10. RabbitMQ在windows系统安装部署文档
  11. [LeetCode] Score After Flipping Matrix 翻转矩阵后的分数
  12. yarn查询/cluster/nodes均返回localhost
  13. localhost和127.0.0.1及ip区别
  14. macOS Sierra WiFi connecting problem
  15. PyQt5信号、定时器及多线程
  16. Flash and Scalform CLIK
  17. Python中常见字符串去除空格的方法总结
  18. mingw 搭建Emscripten 环境
  19. 2017年最新cocoapods安装教程(解决淘宝镜像源无效以及其他源下载慢问题)
  20. No supported encrypter found. The cipher and / or key length are invalid.

热门文章

  1. IE如何实现text-shadow文字阴影效果呢?
  2. asp.net excel导出红色字体
  3. PHP 常用的无限遍历方法
  4. iphone之打开pdf、doc、xls文件用UIWebView
  5. PG extract 函数示例
  6. COGS 788. 昵称
  7. 最近在准备面试,总结了几个java中面向对象的几个问题,问题本事还不够全面,要想知道还是要自己去找,但是在面试上应该是没多大问题了
  8. Python 学习日志9月18日
  9. graphviz layer 教程(非布局)
  10. 计算机应用第七次作业 html制作个人音乐播放站点