The PyXPlot logo

PyXPlot

Examples: First steps in PyXPlot

Download
.ppl
1.3K
.eps
90K
.png
13K

A plot with multiple axes

Up
Graphical output from PyXPlot

Script

# A few physical constants
min = 5
max = 200
phy_h = 6.626068e-34
phy_c = 3e8
phy_ev = 1.6e-19

# Set up plot basics...
set grid
set key bottom right
set width 10
set logscale x1y1x2x3
set title 'Simulated infrared dust spectrum for an \
{\mbox{\normalsize H\thinspace\footnotesize II}\kern3pt} region'

set xlabel '$\lambda$/$\mu$m'
set x2range [phy_c/(min*1e-6):phy_c/(max*1e-6)]
set x2label '$\nu$/Hz'
set x3range [phy_h*phy_c/(min*1e-6)/phy_ev:phy_h*phy_c/ \
(max*1e-6)/phy_ev]
set x3label 'Photon Energy / eV'

set ylabel '$\int F_{\nu}(a)\mathrm{d}a \cdot 4\pi r^2 / \
\mathrm{W} \, \mathrm{Hz}^{-1}\, \mathrm{m}^2 \, \
\mathrm{H}^{-1}$'
# Put an arrow and label on our plot, labelling one
# of the lines
set arrow 1 from 60, 2e-5 to 38, 1e-5
set label 1 "$F_\nu=\nu^{\beta}B_\nu(30\mathrm{K})$" \
at 62, 1.8e-5

# Make f(x) a 30K greybody
T=30.0
h=6.626e-34
k=1.38e-23
c=3e8
f(x)=((c/(x*1e-6))**(3+2))/(exp(h*c/(x*1e-6*k*T))-1.0)

# Finally, plot all of our data
plot [min:max][1e-7:1e-3] 'example1.dat' using 1:2 \
t 'Nikoli\v{c}-Ford Dust Code' with lines, \
'example2.dat' t 'IRAS Photometry' using \
($1):(($2)/3e8*((($1)*1e-6)**2)*1.375191e+13/3.668333e+17) \
with points, \
f(x)/f(60)*1.375191e+13/(3e8/(60e-6**2)) t '$\beta=2$ Greybody' with lines

Notes

We plot two datafiles, one with a line, and another with points. We label our lines using arrows and text labels. We also have multiple axes, this time having three x-axes on the same plot.

This page is maintained by the PyXPlot webmonkey and was last updated on Tuesday, 06-Mar-2007 21:46:15 GMT.