返回顶部
首页 > 资讯 > 后端开发 > Python >python-object-one
  • 526
分享到

python-object-one

pythonobject 2023-01-31 02:01:29 526人浏览 安东尼

Python 官方文档:入门教程 => 点击学习

摘要

#!/usr/bin/env python2.6 from reportlab.lib import colors from reportlab.graphics.shapes import * from r

#!/usr/bin/env python2.6

from reportlab.lib import colors
from reportlab.graphics.shapes import *
from reportlab.graphics import renderpdf
data = [
        (2007, 8, 113.2, 114.2, 112.2),
        (2007, 9, 112.8, 115.8, 109.8),
        (2007,10, 111.0, 116.0, 106.0),
        (2007,11, 109.8, 116.8, 102.8),
        (2007,12, 107.3, 115.3, 99.3),
        (2008, 1, 105.2, 114.2, 96.2),
        (2008, 2, 104.1, 114.1, 94.1),
        (2008, 3, 99.9,  110.9, 88.9),
        (2008, 4, 94.8,  106.8, 82.8),
        (2008, 5, 91.2,  104.2, 78.2)]
# Create Drawing mode
drawing = Drawing(200, 150)

pred = [row[2]-40 for row in data]
high = [row[3]-40 for row in data]
low = [row[4]-40 for row in data]
times = [200*((row[0]+row[1]/12.0) - 2007)-110 for row in data]
#
drawing.add(PolyLine(zip(times, pred), strokeColor=colors.blue))
drawing.add(PolyLine(zip(times, high), strokeColor=colors.red))
drawing.add(PolyLine(zip(times, low), strokeColor=colors.black))
drawing.add(String(65, 115, 'Sunspots', fontSize=18, fillColor=colors.red))

renderPDF.drawToFile(drawing, 'Tony_report1.pdf', 'Sunspots')
 

--结束END--

本文标题: python-object-one

本文链接: https://lsjlt.com/news/185245.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作