Tuesday, November 6, 2007

multiple plots in one window with gnuplot

Display colors and point types:
test

For data plots:
set terminal postscript eps monochrome enhanced dashed
set output "distplot.eps"
set style data linespoints
set title "Minimum Distance"
set xlabel "m"
set ylabel "toroidal minimum distance"
set logscale xy 2
plot "mindists.dat" using 1:2 title "Sobol'", "mindists.dat" using 1:3 lt 3 title "Larcher-Pillichshammer"

Modifying the data columns (e.g. plot differences):
plot 'force.dat' using 1:($3-$2)
plot 'force.dat' using (3*$2):(sin($3+$1))


Don't clear the window, very general method:
set multiplot

# common margins
set lmargin 10
set rmargin 2

# common y-range
set yrange [0:1.3e+9]

plot "values.dat" using 1:2 title "f1"
plot "values.dat" using 1:3 lt 3 title "f2"
...
clear
unset multiplot

7 comments:

antiwire said...

Thank you for the gnuplot example of multiple plot lines in a single graph. This post really helped me out.

Rational and Humane said...

Thanks a lot

Shreyas said...

Thanks a lot! Really helped me!

Figo said...

You saved my day!

Anonymous said...

Thanks a lot

Anonymous said...

This is really helpful thanks a bunch!

Sujoy Sett said...

Thanks.
It was a great post.
I searched a hell lot for this multiple plots in eps files.

Thanks again.
Sujoy.