2005 Jul 11th
Logistic MapPythonでグラフ描きをする必要があって、PyChartを使おうと思っていたのですが、調べてみるとGnuplot.pyというのがあることを知った。基本的にはGnuplotを直接使うのと変わらないように使えるのですが、Python内の変数をいったんデータファイルとして吐き出したり、データファイル風にとかしなくてもタプルとかリストとかで渡したらそれでプロットしてくれるー。Gnuplotで大したグラフを描いたことはないけど、やっぱちょっとでも慣れてるものの方が使いやすいしなあと。

このグラフを吐くのはこんな感じ。
#!/usr/bin/env python

import Gnuplot

d = (0.9, 0.342, 0.8551368, 0.470735842486, 0.946745714523,
     0.19158941291, 0.58855505713, 0.920200407055, 0.27904014806,
     0.764471626556, 0.684208083238, 0.821056051865, 0.558307443932,
     0.937080919532, 0.224049025168, 0.660634026059, 0.851947496754,
     0.479305246208, 0.948372563229, 0.186055769265, 0.575468275956,
     0.928357249432, 0.252738254065, 0.717674190189, 0.769948198317,
     0.673086286856, 0.836156321749, 0.520595923922, 0.948388070088,
     0.186002926692, 0.575342184225, 0.92842951005, 0.25250298869,
     0.717231871692, 0.7706791929, 0.671584543218, 0.838123229209,
     0.515556191104, 0.94908041869, 0.183641754688, 0.569686350369,
     0.931546487775, 0.242316989779, 0.697677971726, 0.801508994079,
     0.60455084066, 0.908462662526, 0.316001362625, 0.821349105488,
     0.557592059129, 0.937395987956)

gp = Gnuplot.Gnuplot()
gp('set terminal png size 320, 240')
gp('set output "chaos.png"')
gp('set title "logistic map"')
gp('set data style lines')
gp('set xtics 10')
gp('set grid')
gp.plot(d)
Posted by setomits at 01:51 | Comments: 0
Leave a comment
Required fields are marked with *
search
calendar
Feb 2012
SunMonTueWedThuFriSat
   1234
567891011
12131415161718
19202122232425
26272829   
archives
photos on flickr
www.flickr.com