I am writing a gnuplot (5.2) script and I would like to only plot certain functions or data files if a flag is set. An example of this that works with gnuplot is:
if(flag==0){plot sin(x)}
if(flag==1){plot sin(x), cos(x)}
so that depending on the value of 'flag' I can make slightly different plots. However, doing it the above way means repeating the plot command for every setting for the flag and this quickly becomes laborious if I have multiple settings for my flag. Is there a way to use the 'if' statement inside a plot command? For example, something like:
plot sin(x), if(flag==1){cos(x)}
so that I can do everything with only one use of 'plot'.