Monday, March 30, 2009

Graphs with PyXPlot

These are the contents of mydata.dat file:
--------------------------------------
8 4.3950
16 7.7879
24 11.0650
32 14.4312
40 17.3884
48 21.6769
56 23.7509
64 27.7398
72 31.5975
80 35.7720
88 39.2403
96 44.0992
----------------------------
Note: The separation between numbers is a tab space.
-------------------------------------------
$ pyxplot

____ __ ______ _ _ PYXPLOT
| _ \ _ _\ \/ / _ \| | ___ | |_ Version 0.6.3.1
| |_) | | | |\ /| |_) | |/ _ \| __| 26/02/2007
| __/| |_| |/ \| __/| | (_) | |_
|_| \__, /_/\_\_| |_|\___/ \__| Copyright (C) 2006-7 Dominic Ford
|___/

With thanks to Joerg Lehmann and Andre Wobst for writing PyX, and to
Ross Church for his many helpful suggestions along the way.

Send comments, bug reports, feature requests and coffee supplies to:
coders@pyxplot.org.uk

pyxplot> set ylabel 'Average'
pyxplot> set xlabel 'n'
pyxplot> plot 'mydata.dat'
pyxplot> exit

Goodbye. Have a nice day.

coders@pyxplot.org.uk
------------------------------------
Other examples:
Bar Charts

Script

set multiplot
set nodisplay
set samples 25
width=7
gold_ratio = 1/((1+sqrt(5))/2)

set width width
set xrange [-10.9:10.9]
set yrange [-1.2:1.2]
set nokey

# Plot 0 (bottom left)
set xlabel 'x'
set ylabel 'y'
set label 1 '(a)' at -9,0.8
set label 2 'histeps' -3.7,0.8
plot 'example6.dat' with histeps, 'example6.dat' with points

# Plot 1 (bottom right)
set origin 1*width, 0*width*gold_ratio
set xlabel 'x'
set ylabel 'linkaxis 0'
set label 1 '(b)' at -9,0.8
set label 2 'boxes' -3.7,0.8
plot 'example6.dat' with boxes, 'example6.dat' with points

# Plot 2 (middle left)
set origin 0*width, 1*width*gold_ratio
set xlabel 'linkaxis 0'
set ylabel 'y'
set label 1 '(c)' at -9,0.8
set label 2 'fsteps' -3.7,0.8
plot 'example6.dat' with fsteps, 'example6.dat' with points

# Plot 3 (middle right)
set origin 1*width, 1*width*gold_ratio
set xlabel 'linkaxis 1'
set ylabel 'linkaxis 2'
set label 1 '(d)' at -9,0.8
set label 2 'steps' -3.7,0.8
plot 'example6.dat' with steps, 'example6.dat' with points

# Plot 4 (top left)
set origin 0*width, 2*width*gold_ratio
set xlabel 'linkaxis 0'
set ylabel 'y'
set label 1 '(e)' at -9,0.8
set label 2 'impulses' -3.7,0.8
plot 'example6.dat' with impulses, 'example6.dat' with points

# Plot 5 (top right)
set origin 1*width, 2*width*gold_ratio
set boxfrom -0.5
set xlabel 'linkaxis 1'
set ylabel 'linkaxis 4'
set label 1 '(f)' at -9,0.8
set label 2 'boxes' -3.7,0.8
plot 'example6.dat' with boxes, 'example6.dat' with points

set display
refresh