Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Plot a spiral with gnuplot

by RichardK (Priest)
on Aug 16, 2011 at 11:51 UTC ( #920467=note: print w/ replies, xml ) Need Help??


in reply to Plot a spiral with gnuplot

When I use gnuplot I use its special file handle '-' and inline the data.

Would it be better to use a tempfile? and if so what are the advantages?

I'd write your code like this :-

use v5.12; use warnings; use autodie; use IO::Handle; open my $out,'|-','gnuplot'; say $out 'unset key'; say $out "plot '-' with lines lw 3"; for my $t (100..500) { say $out $t*sin($t*0.1),' ',$t*cos($t*0.1); } say $out 'e'; flush $out; <STDIN>; close $out;


Comment on Re: Plot a spiral with gnuplot
Download Code
Re^2: Plot a spiral with gnuplot
by ambrus (Abbot) on Aug 16, 2011 at 17:44 UTC

    Frankly, I didn't know you could give gnuplot data inline like that. The manual of gnuplot is a bit long and boring, so I've read only a little of it. Thank you for telling about this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://920467]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2014-12-27 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls