title: Gnuplot from C program - Only allows for plotting for files over certain lengths
body: <p>I think I have run into the weirdest bug I have ever encountered. I am using pipes in C for using gnuplot. I have a datafile named <code>corr.dat</code> which looks like this:</p>
  
  <pre><code>0 2.535107 2.535107
  1 3.363503 3.363503
  ...
  ...
  24 1.435642 0.821686
  </code></pre>
  
  <p>This file was generated through</p>
  
  <pre><code>for (i=0; i&lt;25; i++) {
          fprintf(data_file, "%d %lf %lf\n", i, rv[i], fv[i])
  }
  </code></pre>
  
  <p>where <code>rv</code> and <code>fv</code> are arrays of doubles. I can plot this through</p>
  
  <pre><code>FILE * gnuplot_pipe = popen("gnuplot -persistent", "w");
  fprintf(gnuplot_pipe, "plot 'corr.dat'\n");
  fflush(gnuplot_pipe);
  </code></pre>
  
  <p>which works just fine. But when I change the loop to </p>
  
  <pre><code>for (i=0; i&lt;24; i++) {
  </code></pre>
  
  <p>I get an error from gnuplot saying</p>
  
  <pre><code>line 0: warning: Skipping data file with no valid points
  
  gnuplot&gt; plot 'corr.dat'
                          ^
  line 0: x range is invalid
  </code></pre>
  
  <p>The pattern persists - for numbers 25 and over gnuplot happily plots, but calls everything invalid when below. What the heck is going on here?</p>