in reply to Re: Intro to plotting with perl
in thread Intro to plotting with perl

This. If you want to make graphs for a scientific publication, use Gnuplot. Your other uppercase-f-Free options are Octave (who knows how it will turn out since they stopped using Gnuplot), some Python thing (SciPy, of which I know little), and doing it yourself by hand (learn PostScript or some other vector drawing language).

However, the linked node has a bunch of extraneous garbage. (Also, it doesn't even work, since it doesn't bother to flush the temporary file before using it.) All you really need is some version of:

open DATAFILE, ">$whatever"; # write data to DATAFILE close DATAFILE; open PLOT, "| gnuplot"; print PLOT <<EOS; ... p '$whatever' ... (gnuplot options) ... ... EOS close PLOT;

Replies are listed 'Best First'.
Re^3: Intro to plotting with perl
by RichardK (Parson) on Jan 04, 2012 at 12:32 UTC

    Well don't use a temporary file then ;)

    Just use gnuplot's special file '-' and inline the data.

    I added a node to show how it's done to the above example at Re: Plot a spiral with gnuplot

Re^3: Intro to plotting with perl
by Lotus1 (Vicar) on Jan 04, 2012 at 15:19 UTC
    However, the linked node has a bunch of extraneous garbage.

    I don't see anything extraneous or any garbage. I found that node months ago when I was curious about gnuplot and found it to be short and sweet and to the point with helpful links.

    (Also, it doesn't even work, since it doesn't bother to flush the temporary file before using it.)

    It has been a while since I tried the code in that node but I just remember quickly having a plot of a pretty spiral without much (any) effort on my part.

      I don't see anything extraneous or any garbage.
      How do strict.pm, warnings.pm, and IO/Handle.pm help plot a graph? Why is Perl 5.10 necessary? All that is superstitious, useless programming.

        No, strictures at least are a life saving mantra, least least for those of us who are less than perfect. Sure, if you never write a bad line of code or mistype a variable name you don't need the early heads up that such helpers and rote coding practises provide, but there are precious few who are in that fortunate position and those few are exceedingly unlikely to include anyone looking for help.

        True laziness is hard work