multiplot

This script simply outputs several plots to one png file:

set term png small
set output "sho_final.png"

set size 2.0, 1.6
set multiplot

set xrange [0:10000]

#Ground state#
    set origin 1.2, 1.2
    set size 0.8, 0.4
    set yrange [0.04:0.10]
    set xlabel "Time"
    set ylabel "Energy"
    E0(x) = ground
    fit E0(x) "energy.data" us 1:2:4 via ground
    plot    "energy.data" us 1:2 title "E0" w lines,\
            "energy.data" us 1:3:4 title "<E0>" w yerr,\
            ground title "EO fit" w lines

#First excited state#
    set origin 1.2, 0.8
    set size 0.8, 0.4
    set yrange [0.15:0.30]
    set xlabel "Time"
    set ylabel "Energy"
    E1(x) = first
    fit E1(x) "energy.data" us 1:5:7 via first
    plot   "energy.data" us 1:5 title "E1" w lines,\
            "energy.data" us 1:6:7 title "<E1>" w yerr,\
            first title "E1 fit" w lines    

#Average position#
    set origin 1.2, 0.4
    set size 0.8, 0.4
    set yrange [-0.50:0.50]
    set xlabel "Time"
    set ylabel "Position"
    p(x) = position
    fit p(x) "energy.data" us 1:8 via position
    plot   "energy.data" us 1:8 title "<x>" w lines,\
            position title "x fit" w lines

#X vector#
    set origin 0.0, 0.0
    set size 2.0, 0.4
    set xrange [0:1000]
    set yrange [-6:6]
    set xlabel "X(N)"
    set ylabel "Position"
    plot     "x_vector.data" every :::1::1 notitle w lines

#Psi squared#
    set origin 0.0, 0.4
    set size 1.2, 1.2
    set xrange [-6:6]
    set yrange [0:0.35]
    set title "Psi Squared in a SHO"
    set xlabel "Position"
    set ylabel "Energy"
    set label 1 " E0 = %g ", ground at -6.0, (ground + .005)
    set label 2 " E1 = %g ", first at -6.0, (first + .005)
    plot   0.01125*x*x notitle w lines,\
            "final_psi2.data" notitle w boxes,\
            ground notitle w lines,\
            first notitle w lines

unset multiplot
set size 2.0, 1.6

Output:
sho_final.png
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License