我有一个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"
但是,我必须将它与perl脚本集成。
答案 0 :(得分:9)
您可以打开gnuplot的管道:
use autodie qw(:all);
open my $GP, '|-', 'gnuplot';
print {$GP} <<'__GNUPLOT__';
set xrange [-5:5];
plot sin(x);
__GNUPLOT__
close $GP;
或者,您可以在CPAN上找到Chart::Gnuplot。
答案 1 :(得分:2)
`gnuplot <your file>`; #linux
`wgnuplot.exe <your file>`; #win
或
system("gnuplot <your file>"); #linux
system("wgnuplot.exe <your file>"); #win
或
exec("gnuplot <yout file>"); #linux
exec("wgnuplot.exe <your file>"); #win
您的选择取决于:
What's the difference between Perl's backticks, system, and exec?