gnuplot - multiple plot files using the same style settings, but different number of plot lines? -


this problem: have 4 different data files; , need create various plots on png, using data in these files.

i have in function call in script, put many common statement can.

the plot have different file names, use same settings: legend position, title, axis label, range, border line style.

what change data, coming different data files, number of lines on same plot (some has example 1 set of data, others has 4-5 per plot), , color differentiate them.

is there clean way group similar, don't end writing same things each of plot? i've check doc , not able find solution this; since style set each dataset, can't group it.

found questions here similar, problem totally different...i don't need merge data different dataset, need create different plot files, share of common settings. make generic example, need way css style file, style stay same, content of plot (and name of file) changes.

i using shell script code; wrapped gnuplot command in shell function.

thanks

you can put common settings in 1 file (lets settings.gp) , load them main files load 'settings.gp'. works if write actual commands in place of load command. therefore can define variables before loading settings file change behavior.

file settings.gp:

set terminal pngcairo set output outfile  set style increment user if (plotnum == 2) {     set style line 1 lt 5     set style line 2 lt 6 } else {     set [i=1:5] style line lt i+2 } 

(note, kind of if statement requires gnuplot version 4.6 , newer).

file main.gp

outfile = 'first.png' plotnum = 2 load 'settings.gp' plot x, x**2 

the command set style increment user automatically iterates on line styles instead of line types in plot command.

that of course example, can include kind of tests , conditions in settings.gp. other possiblity using call command.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -