如何从Perl调用gnuplot脚本 [英] how to call a gnuplot script from perl

查看:124
本文介绍了如何从Perl调用gnuplot脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gnu.gp文件:

I have a gnu.gp file :

# 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脚本集成.

But, I have to integrate this with a perl script.

推荐答案

您可以打开gnuplot管道:

You can open a pipe to 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 .

Or, you can reach for Chart::Gnuplot on CPAN.

这篇关于如何从Perl调用gnuplot脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆