title: Generate titles from variables in Gnuplot
body: <p>I am trying to generate titles automatically in Gnuplot. I have an array (titleprefix) and another set of variables (a1,a2,a3...), and the title is the prefix followed by the slope (the a's). I tried this:</p>
  
  <pre><code>title(n) = sprintf("word(titleprefix,n).sprintf(\" Slope = %.3f\",%f)",a."n"+0)
  </code></pre>
  
  <p>Of course that did not work. Error is:</p>
  
  <blockquote>
    <p>Non-numeric string found where a numeric expression was expected.</p>
  </blockquote>
  
  <p>Any idea how I solve this?</p>
  
  <p>Eventually, I would like to plot several curves like this:</p>
  
  <pre><code>plot f1 w l t title(1), \
       f2 w l t title(2), \
       f3 w l t title(3)
  </code></pre>