This shows you the differences between two versions of the page.
ep:labs:05:contents:tutorial:ex3 [2019/10/27 17:06] emilian.radoi created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 03. [10p] Gnuplot Scripts ==== | ||
- | The benefit of using a script is that you do not have to retype everything every time you want to make a change or want to reproduce your plot. The following is an example of a Gnuplot script that plots two graphs on a single plot. | ||
- | |||
- | <code> | ||
- | reset # flush all the variables | ||
- | |||
- | set size 1,1 # use default pallet size (100% of width and height) | ||
- | set multiplot | ||
- | |||
- | #Graph 1 | ||
- | set size 0.5,1 #half the width and full height | ||
- | set origin 0,0 #x,y | ||
- | plot 'data2.txt' w l lw 0.5 | ||
- | |||
- | #Graph 2 | ||
- | set size 0.5,1 | ||
- | set origin 0.5,0 | ||
- | plot 'data3.txt' w l lw 0.5 | ||
- | |||
- | unset multiplot | ||
- | </code> | ||
- | |||
- | Run the script: | ||
- | |||
- | <code> | ||
- | $ gnuplot | ||
- | gnuplot> load 'script_name' | ||
- | </code> |