It's very often to show several figures in a single plot. With ``set multiplot,''
gunplot can do this work pretty good. There will be some problems, however, when we don't give proper settings for gunplot. One of the problems I've met was the gnuplot did not print out complete plot containing multiple figures with the terminal set as postscript.
I tried and searched for the solution, and finally got the key. It is better to set the size for the entire plot before the multiplot setting.
Here is my original WRONG setting structure:
- set the terminal
- set the output filename
- set the size for individual figures
- set multiplot
- set the origin for individual figures
- plot individual figures
- unset multiplot
And the following is the corrected one:
- set the terminal
- set the output filename
- set the size for the entire plot
- set the origin for the entire plot
- set multiplot
- set the size for individual figures
- set the origin for individual figures
- plot individual figures
- unset multiplot
With the wrong setting structure, we can still get normal output with some terminals such as png. If what we want is something like eps files, then it's necessary to use the right setting structure, which actually makes better sense.
---
Let me show you the (correct) example.
1 set terminal postscript eps enhanced color solid 20
2 set output "test_nogood.eps"
3
4 set nokey
5 set size 1,1
6 set origin 0,0
7
8 set multiplot
9
10 set tmargin 0.5
11 set bmargin 0.5
12 set rmargin 1.0
13 set lmargin 5.0
14
15 set xrange [-25:25]
16 set ylabel "f(x)"
17 set noxtics
18 set noytics
19
20 set size 1,0.20
21 set origin 0.0,0.76
22 set title "sin(x)" offset 0,-1.0
23 plot sin(x) w l lt 1 lw 2
24 set size 1,0.20
25 set origin 0.0,0.54
26 set title "cos(x)" offset 0,-1.0
27 plot cos(x) w l lt 9 lw 2
28 set size 1,0.20
29 set origin 0.0,0.32
30 set title "sin(x)/x" offset 0,-1.0
31 plot sin(x)/x w l lt 3 lw 2
32 set size 1,0.20
33 set origin 0.0,0.10
34 set xlabel "x"
35 set title "x*sin(x)" offset 0,-1.0
36 plot x*sin(x) w l lt 8 lw 2
37
38 unset multiplot
39
40 reset
41
You will get the following plot:
If you change line 5 as ``set size 1,0.20'' and comment out lines 6, 20, 24, 28, and 32, the output result will be as the following plot:
It gives only the last part of the eps file.
---
References:
Gnuplot FAQ: 7.6
My output files are incomplete!
Visualize your data with gnuplot