plotter.js
function setup_gnuplot(gnuplot, options) {
  if (options.format === 'svg') { /* Setup gnuplot for SVG */
    gnuplot.stdin.write('set term svg fname \"Helvetica\" fsize 14\n');
  } else if (options.format == 'pdf') {
    /* PDF: setup Gnuplot output to postscript so ps2pdf can interpret it */
    gnuplot.stdin.write('set term postscript landscape enhanced color dashed' +
			'\"Helvetica\" 14\n');
  } else { /* Setup gnuplot for png */
    gnuplot.stdin.write('set term png\n');
  }

  /* Formatting Options */
  if (options.time) {
    gnuplot.stdin.write('set xdata time\n');
    gnuplot.stdin.write('set timefmt "%s"\n');
    gnuplot.stdin.write('set format x "' + time_format(options.time) + '"\n');
    gnuplot.stdin.write('set xlabel "time"\n');
  }
  if (options.title) {
    gnuplot.stdin.write('set title "'+options.title+'"\n');
  }
  if (options.logscale) {
    gnuplot.stdin.write('set logscale y\n');
  }
  if (options.xlabel) {
    gnuplot.stdin.write('set xlabel "'+options.xlabel+'"\n');
  }
  if (options.ylabel) {
    gnuplot.stdin.write('set ylabel "'+options.ylabel+'"\n');
  }

  /* Setup ticks */
  gnuplot.stdin.write('set grid xtics ytics mxtics\n');
  gnuplot.stdin.write('set mxtics\n');

  if (options.nokey) {
    gnuplot.stdin.write('set nokey\n');
  }
}
function setup_gnuplot(gnuplot, options) {
  if (options.format === 'svg') { /* Setup gnuplot for SVG */
    gnuplot.stdin.write('set term svg fname \"Helvetica\" fsize 14\n');
  } else if (options.format == 'pdf') {
    /* PDF: setup Gnuplot output to postscript so ps2pdf can interpret it */
    gnuplot.stdin.write('set term postscript landscape enhanced color dashed' +
			'\"Helvetica\" 14\n');
  } else { /* Setup gnuplot for png */
    gnuplot.stdin.write('set term png\n');
  }

  /* Formatting Options */
  if (options.time) {
    gnuplot.stdin.write('set xdata time\n');
    gnuplot.stdin.write('set timefmt "%s"\n');
    gnuplot.stdin.write('set format x "' + time_format(options.time) + '"\n');
    gnuplot.stdin.write('set xlabel "time"\n');
  }
  if (options.title) {
    gnuplot.stdin.write('set title "'+options.title+'"\n');
  }
  if (options.logscale) {
    gnuplot.stdin.write('set logscale y\n');
  }
  if (options.xlabel) {
    gnuplot.stdin.write('set xlabel "'+options.xlabel+'"\n');
  }
  if (options.ylabel) {
    gnuplot.stdin.write('set ylabel "'+options.ylabel+'"\n');
  }

  /* Setup ticks */
  gnuplot.stdin.write('set grid xtics ytics mxtics\n');
  gnuplot.stdin.write('set mxtics\n');

  if (options.nokey) {
    gnuplot.stdin.write('set nokey\n');
  }
}
function setup_gnuplot ( gnuplot , options ) { if ( options . format === 'svg' ) { /* Setup gnuplot for SVG */ gnuplot . stdin . write ( 'set term svg fname \"Helvetica\" fsize 14\n' ) ; } else if ( options . format == 'pdf' ) { /* PDF: setup Gnuplot output to postscript so ps2pdf can interpret it */ gnuplot . stdin . write ( 'set term postscript landscape enhanced color dashed' + '\"Helvetica\" 14\n' ) ; } else { /* Setup gnuplot for png */ gnuplot . stdin . write ( 'set term png\n' ) ; } /* Formatting Options */ if ( options . time ) { gnuplot . stdin . write ( 'set xdata time\n' ) ; gnuplot . stdin . write ( 'set timefmt "%s"\n' ) ; gnuplot . stdin . write ( 'set format x "' + time_format ( options . time ) + '"\n' ) ; gnuplot . stdin . write ( 'set xlabel "time"\n' ) ; } if ( options . title ) { gnuplot . stdin . write ( 'set title "' + options . title + '"\n' ) ; } if ( options . logscale ) { gnuplot . stdin . write ( 'set logscale y\n' ) ; } if ( options . xlabel ) { gnuplot . stdin . write ( 'set xlabel "' + options . xlabel + '"\n' ) ; } if ( options . ylabel ) { gnuplot . stdin . write ( 'set ylabel "' + options . ylabel + '"\n' ) ; } /* Setup ticks */ gnuplot . stdin . write ( 'set grid xtics ytics mxtics\n' ) ; gnuplot . stdin . write ( 'set mxtics\n' ) ; if ( options . nokey ) { gnuplot . stdin . write ( 'set nokey\n' ) ; } }
Sets up gnuplot based on the properties we're given in the options object.
Sets up gnuplot based on the properties we re given in the options object .