title: 'if' statements within a 'plot' command in gnuplot
body: <p>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:</p>
  
  <pre><code>if(flag==0){plot sin(x)}
  
  if(flag==1){plot sin(x), cos(x)}
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>plot sin(x), if(flag==1){cos(x)}
  </code></pre>
  
  <p>so that I can do everything with only one use of 'plot'.</p>