From: Mark T. <m.t...@uc...> - 2005-05-06 15:45:46
|
I have been producing 2d arrays in python containing z values that I would like to plot then turn into animated gifs. Up until now I have been using gist (pli) to plot them. However, gist is very limited in the output file formats and I can't get any of the output file formats into for example Python Imaging Library in order to make animated gifs. So I decided to try drawing plots with Gnuplot in python. I have tried various examples that work in gnuplot but not when I try to put them into python. An example is below (adapted from http://gnuplot.sourceforge.net/demo/pm3d.html): import Gnuplot import numarray as N g = Gnuplot.Gnuplot(debug=1) # set terminal png transparent nocrop enhanced font arial 8 size 420,320 # set output 'pm3d.9.png' g('set border 4095 lt -1 lw 1.000') g('set view map') g('set samples 30, 30') #g('set isosamples 30, 30') g('unset surface') g('set style data pm3d') g('set style function pm3d') g('set ticslevel 0') g('set title "colour map, using default rgbformulae 7,5,15 ... traditional pm3d (black-blue-red-yellow)" 0.000000,0.000000 font ""') g('set xlabel "x" 0.000000,0.000000 font ""') g('set xrange [0:30] ') g('set ylabel "y" 0.000000,0.000000 font ""') g('set yrange [ 0:30]') g('set y2range [ * : * ] reverse nowriteback # (currently [-10.0000:10.0000] )') g('set zrange [ 0.0001 : 1.00000 ] noreverse nowriteback') g('set pm3d at b') a = N.zeros([30,30]) +.3 a[5:10,1:22] = .9 g.splot(a) Any thoughts would be greatly appreciated. -- Dr Mark Thomas Department of Biology University College London Gower Street London WC1E 6BT Tel: (020) 7 679 2654 Fax: (020) 7 679 7096 Mobile: 07973 725955 Email: m.t...@uc... Web: www.ucl.ac.uk/tcga/ |