如何从perl调用gnuplot脚本

use*_*050 3 perl gnuplot

我有一个gnu.gp文件:

# grphist.conf
set terminal canvas
#Terminal type set to 'canvas'
#Options are ' solid butt size 600,400 fsize 10 lw 1 fontscale 1 standalone'
set output 'output.html'  

set grid
set xtic rotate by 90
set style data histograms
set style fill solid 1.00 border -1
#$ cat grphist.conf | gnuplot
plot "c_time"  using 2:xtic(1) title "time to number of UIDs"
Run Code Online (Sandbox Code Playgroud)

但是,我必须将它与perl脚本集成.

cho*_*oba 9

你可以打开一个管道到gnuplot:

use autodie qw(:all);
open my $GP, '|-', 'gnuplot';

print {$GP} <<'__GNUPLOT__';
    set xrange [-5:5];
    plot sin(x);
__GNUPLOT__

close $GP;
Run Code Online (Sandbox Code Playgroud)

或者,您可以在CPAN上找到Chart :: Gnuplot.