上一篇转载<python绘图工具reportlab介绍>,直接运行代码有些问题,慢慢解决了,记录下.
1,坐标图
百度资料:
http://blog.sina.com.cn/s/blog_53a8a9d40101krae.html
http://hulianwang2014.iteye.com/blog/2048674
改代码如下:
#coding:utf-8
"""
http://blog.sina.com.cn/s/blog_53a8a9d40101krae.html
http://hulianwang2014.iteye.com/blog/2048674
"""
from urllib import urlopen
from reportlab.graphics.shapes import *
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.graphics.charts.textlabels import Label
from reportlab.graphics import renderPDF
# URL = 'http://www.swpc.noaa.gov/ftpdir/weekly/Predict.txt' #将文件URL保存在变量URL中
# COMMENT_CHARS = '#:' #变量COMMENT_CHARS设定为“#:”
#
#
drawing = Drawing(400, 200) # 创建一个400*20