使用Python Pychart画图
来源:互联网 发布:淘宝管控记录大促 编辑:程序博客网 时间:2024/06/04 19:46
1 安装python:
下载http://download.gna.org/pychart,解压定位到解压的目录,使用命令python setup.py install进行安装。
pychart的home:http://home.gna.org/pychart/
如:我下载的目录是C:\Documents and Settings\Administrator\My Documents\Downloads\PyChart-1.39.tar\PyChart-1.39\PyChart-1.39
安装:
C:\Documents and Settings\Administrator\My Documents\Downloads\PyChart-1.39.tar\PyChart-1.39\PyChart-1.39>python setup.py install
安装完后打开python 如果>>> import pychart不报错说明安装成功。
2学习文档和例子:
文档:http://home.gna.org/pychart/doc/index.html
例子:http://home.gna.org/pychart/examples/index.html
3 运行示例:
在Pychart的安装目录下有一系列的Demo:
C:\Documents and Settings\Administrator\My Documents\Downloads\PyChart-1.39.tar\PyChart-1.39\PyChart-1.39\demos.
本来以为直接运行就能画出图形,结果发现打印出来的是一些看不懂的数字,于是看文档,发现不是这么玩的。
To produce a PostScript chart, just feed the file to Python.
% python linetest.py >linetest.eps
Or, to produce a PDF chart, run python like below
% python linetest.py --format=pdf >linetest.pdf
结果发现生成的PDF根本就没有图片,或者打不开,于是在FAQ中看到需要下载Ghostscript
- Q: Does pychart support Windows?
- Yes. But you need to install Pythonand Ghostscriptbeforehand.
例子:
from pychart import *
import sys
theme.get_options()
theme.use_color = True
can = canvas.init('pic1.png')
data = [("foo", 10),("bar", 20), ("baz", 30), ("ao", 40)]
ar = area.T(size=(300,300), legend=legend.T(),
x_grid_style = None, y_grid_style = None)
plot = pie_plot.T(data=data, arc_offsets=[0,10,0,10],
shadow = (2, -2, fill_style.gray50),
label_offset = 25,
arrow_style = arrow.a3)
ar.add_plot(plot)
ar.draw()
运行结果:
如果要运行自带的例子,需要安装软件gsview
http://pages.cs.wisc.edu/~ghost/gsview/get49.htm
用法如:python linetest.py >foo.eps然后用gsview打开改文件就可以看到具体的图片。但是gsview仅仅支持ps,pdf,eps等,PNG的不支持,png的要怎么搞,还得再看看
- 使用Python Pychart画图
- Python之PyChart画图方法
- Python pychart画图几种常见的形式
- Python pychart画图几种常见的形式
- pychart的使用
- python pychart图表初安装
- Python使用ReportLab画图
- 使用python matplotlib画图
- python使用matplotlib画图
- 使用python画图
- Python 使用pycha画图表
- 使用python画图(2)
- 使用python画图(3)
- python matplotlib画图安装和使用
- nf使用 Python 的 turtle 模块画图
- python的turtle画图软件包的使用
- 【Python入门】使用ReporLab 画图 PDF存储
- Python 中画图工具的使用
- SIP与RTP综合应用
- ubuntu9.10下安装配置NFS服务
- js获取url参数值
- shell中的cut命令
- sql output ---插入时,一次得到批量插入的identit值
- 使用Python Pychart画图
- 2011中国十大房地产商
- 解析Apache FileUpload文件上传组件API
- 初涉网络
- Android知识点集结
- 编程技术面试的五大要点
- girdview分组,统计,排序的解决方案
- 手动清除sqlserver2005日志
- How to install flash plugin on Ubuntu