Chart-Gnuplot
view release on metacpan
or search on metacpan
Changes
view on Meta::CPAN
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | - Fix a typo in POD
- Improve testsuite
0.07
- Support user-specified path of the convert program
- Support plotting parametric functions
- Fix a bug that range does not work if axis is date/ time
(Thanks to Holyspell)
0.06
- Support formatting legend
- Fix an error that causes some options of one chart affects other charts
in multiplot.
- Fix an error in image format conversion.
- Better support of MSWin
0.05
- Fix a bug in timestamp option.
(Thanks to Lou King)
- Fix a typo in POD
|
MANIFEST
view on Meta::CPAN
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | examples/datetime_3.pl
examples/grid_1.pl
examples/grid_2.pl
examples/grid_3.pl
examples/grid_4.pl
examples/grid_5.pl
examples/grid_6.pl
examples/grid_7.pl
examples/grid_8.pl
examples/grid_9.pl
examples/legend_1.pl
examples/legend_2.pl
examples/legend_3.pl
examples/legend_4.pl
examples/legend_5.pl
examples/legend_6.pl
examples/legend_7.pl
examples/legend_8.pl
examples/legend_9.pl
examples/legend_10.pl
examples/lineStyle_1.pl
examples/lineStyle_2.pl
examples/lineStyle_3.pl
examples/lineStyle_4.pl
examples/lineStyle_5.pl
examples/multiplot_1.pl
examples/multiplot_2.pl
examples/multiplot_3.pl
examples/plot3d_1.pl
examples/plot3d_2.pl
|
MANIFEST
view on Meta::CPAN
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | t/datetime_2.gp
t/datetime.t
t/grid_1.gp
t/grid_2.gp
t/grid_3.gp
t/grid.t
t/label_1.gp
t/label_2.gp
t/label_3.gp
t/label.t
t/legend_1.gp
t/legend.t
t/lineStyle.t
t/plotAxes_1.gp
t/plotAxes.t
t/pointStyle.t
t/range_1.gp
t/range_2.gp
t/range.t
t/set_1.gp
t/set.t
t/thaw_1.dat
|
examples/Makefile
view on Meta::CPAN
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | datetime_3.png \
grid_1.png \
grid_2.png \
grid_3.png \
grid_4.png \
grid_5.png \
grid_6.png \
grid_7.png \
grid_8.png \
grid_9.png \
legend_1.png \
legend_2.png \
legend_3.png \
legend_4.png \
legend_5.png \
legend_6.png \
legend_7.png \
legend_8.png \
legend_9.png \
legend_10.png \
lineStyle_1.png \
lineStyle_2.png \
lineStyle_3.png \
lineStyle_4.png \
lineStyle_5.png \
multiplot_1.png \
multiplot_2.png \
multiplot_3.png \
plot3d_1.png \
plot3d_2.png \
|
examples/chartFmt_3.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => 'gallery/chartFmt_3.png' ,
);
my $data = Chart::Gnuplot::DataSet->new(
func => "tanh(x)" ,
title => 'legend' ,
);
$chart ->plot2d( $data );
|
examples/legend_1.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_1.png" ,
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine" ,
);
my $points = Chart::Gnuplot::DataSet->new(
|
examples/legend_10.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_10.png" ,
legend => {
position => "outside center bottom" ,
order => "horizontal reverse" ,
align => 'left' ,
border => 'on' ,
},
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
|
examples/legend_2.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_2.png" ,
legend => {
position => 'left' ,
},
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine" ,
);
|
examples/legend_3.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_3.png" ,
legend => {
border => 'on' ,
},
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine" ,
);
|
examples/legend_4.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_4.png" ,
legend => {
border => {
linetype => 2,
width => 2,
color => "navy" ,
},
},
);
my $lines = Chart::Gnuplot::DataSet->new(
|
examples/legend_5.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_5.png" ,
legend => {
width => 3,
height => 4,
border => 'on' ,
},
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine" ,
|
examples/legend_6.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_6.png" ,
title => 'Legend with title' ,
legend => {
title => 'Legend title' ,
border => 'on' ,
},
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine" ,
);
|
examples/legend_7.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_7.png" ,
title => 'Reverse order of the sample lines' ,
legend => {
order => 'reverse' ,
},
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine" ,
);
|
examples/legend_8.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_8.png" ,
title => "Left alignment of the label" ,
legend => {
align => 'left' ,
},
);
my $lines = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine" ,
);
|
examples/legend_9.pl
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/usr/bin/perl -w
my $chart = Chart::Gnuplot->new(
output => "gallery/legend_9.png" ,
title => "Format the sample lines" ,
legend => {
sample => {
length => 10,
position => 'left' ,
spacing => 2,
}
},
);
my $lines = Chart::Gnuplot::DataSet->new(
|
examples/list.html
view on Meta::CPAN
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <a href= "main.html#Range of the plot" target=main>Range of the plot</a>
<br/>
<a href= "main.html#Formatting the chart title" target=main>Formatting the chart title</a>
<br/>
<a href= "main.html#Formatting the axis label" target=main>Formatting the axis label</a>
<br/>
<a href= "main.html#Formatting the axis tics" target=main>Formatting the axis tics</a>
<br/>
<a href= "main.html#Formatting the grid lines" target=main>Formatting the grid lines</a>
<br/>
<a href= "main.html#Formatting the legend" target=main>Formatting the legend</a>
<br/>
<a href= "main.html#Formatting the graph borders" target=main>Formatting the graph borders</a>
<br/>
<a href= "main.html#Date and time data" target=main>Date and time data</a>
<br/>
<a href= "main.html#Plot on the secondary axes" target=main>Plot on the secondary axes</a>
<br/>
<a href= "main.html#Chart dimension" target=main>Chart dimension</a>
<br/>
<a href= "main.html#Background color" target=main>Background color</a>
|
examples/main.html
view on Meta::CPAN
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | <td width=65%>Add a chart title</td>
<td align= "center" ><a href= "chartFmt_1.pl" >script</a></td>
<td align= "center" ><a href= "gallery/chartFmt_1.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Add axis labels</td>
<td align= "center" ><a href= "chartFmt_2.pl" >script</a></td>
<td align= "center" ><a href= "gallery/chartFmt_2.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Add legend</td>
<td align= "center" ><a href= "chartFmt_3.pl" >script</a></td>
<td align= "center" ><a href= "gallery/chartFmt_3.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Add grid lines</td>
<td align= "center" ><a href= "chartFmt_4.pl" >script</a></td>
<td align= "center" ><a href= "gallery/chartFmt_4.png" >sample image</a></td>
</ tr >
</table>
|
examples/main.html
view on Meta::CPAN
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | <td align= "center" ><a href= "gallery/grid_8.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Composite example</td>
<td align= "center" ><a href= "grid_9.pl" >script</a></td>
<td align= "center" ><a href= "gallery/grid_9.png" >sample image</a></td>
</ tr >
</table>
<!-- ----- Formatting the legend ----- -->
<a name= "Formatting the legend" >
<h2 style= "color:green" >Formatting the legend</h2>
</a>
<table border=0 width=100%>
< tr >
<td width=65%>Use default settings</td>
<td align= "center" ><a href= "legend_1.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_1.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Position</td>
<td align= "center" ><a href= "legend_2.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_2.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Add border</td>
<td align= "center" ><a href= "legend_3.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_3.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Format the border</td>
<td align= "center" ><a href= "legend_4.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_4.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Dimension</td>
<td align= "center" ><a href= "legend_5.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_5.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Legend title</td>
<td align= "center" ><a href= "legend_6.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_6.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Order of the sample lines</td>
<td align= "center" ><a href= "legend_7.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_7.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Alignment of the label</td>
<td align= "center" ><a href= "legend_8.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_8.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Format the sample lines</td>
<td align= "center" ><a href= "legend_9.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_9.png" >sample image</a></td>
</ tr >
< tr >
<td width=65%>Composite example</td>
<td align= "center" ><a href= "legend_10.pl" >script</a></td>
<td align= "center" ><a href= "gallery/legend_10.png" >sample image</a></td>
</ tr >
</table>
<!-- ----- Formatting the graph borders ----- -->
<a name= "Formatting the graph borders" >
<h2 style= "color:green" >Formatting the graph borders</h2>
</a>
<table border=0 width=100%>
< tr >
|
lib/Chart/Gnuplot.pm
view on Meta::CPAN
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | push ( @sets , "m$axis" . "tics" );
}
}
push ( @sets , $attr );
}
else
{
print PLT "unset $attr\n" ;
}
}
elsif ( $attr eq 'legend' )
{
print PLT "set key" . &_setLegend ( $self ->{legend}). "\n" ;
push ( @sets , 'key' );
}
elsif ( $attr eq 'border' )
{
if ( defined $self ->{border})
{
print PLT "set border" ;
print PLT " " . &_borderCode ( $self ->{border}->{sides}) if
( defined $self ->{border}->{sides});
print PLT &_setBorder ( $self ->{border}). "\n" ;
|
lib/Chart/Gnuplot.pm
view on Meta::CPAN
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | {
my ( $grid ) = @_ ;
return ( $grid ) if ( ref ( $grid ) eq 'HASH' );
my %out ;
$out {xlines} = $out {ylines} = $out {zlines} = $grid ;
return (\ %out );
}
|
lib/Chart/Gnuplot.pm
view on Meta::CPAN
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | my $out = '' ;
$out .= " $$border{layer}" if ( defined $$border {layer});
$out .= " linetype " . &_lineType ( $$border {linetype}) if
( defined $$border {linetype});
$out .= " linecolor rgb \"$$border{color}\"" if ( defined $$border {color});
$out .= " linewidth $$border{width}" if ( defined $$border {width});
return ( $out );
}
sub _setLegend
{
my ( $legend ) = @_ ;
my $out = '' ;
if ( defined $$legend {position})
{
( $$legend {position} =~ /\d/)? ( $out .= " at $$legend{position}" ):
( $out .= " $$legend{position}" );
}
$out .= " width $$legend{width}" if ( defined $$legend {width});
$out .= " height $$legend{height}" if ( defined $$legend {height});
if ( defined $$legend {align})
{
$out .= " Left" if ( $$legend {align} eq 'left' );
$out .= " Right" if ( $$legend {align} eq 'right' );
}
if ( defined $$legend {order})
{
my $order = $$legend {order};
$order =~ s/ reverse /invert/;
$out .= " $order" ;
}
if ( defined $$legend {title})
{
if ( ref ( $$legend {title}) eq 'HASH' )
{
my $title = $$legend {title};
$out .= " title \"$$title{text}\"" ;
$out .= " noenhanced" if (! defined $$title {enhanced} ||
$$title {enhanced} ne 'on' );
}
else
{
$out .= " title \"$$legend{title}\" noenhanced" ;
}
}
if ( defined $$legend {sample})
{
$out .= " samplen $$legend{sample}{length}" if
( defined $$legend {sample}{ length });
$out .= " reverse" if ( defined $$legend {sample}{position} ||
$$legend {sample}{position} eq "left" );
$out .= " spacing $$legend{sample}{spacing}" if
( defined $$legend {sample}{spacing});
}
if ( defined $$legend {border})
{
if ( ref ( $$legend {border}) eq 'HASH' )
{
$out .= " box " . &_setBorder ( $$legend {border});
}
elsif ( $$legend {border} eq "off" )
{
$out .= " no box" ;
}
elsif ( $$legend {border} eq "on" )
{
$out .= " box" ;
}
}
return ( $out );
}
sub _setMultiplot
|
lib/Chart/Gnuplot.pm
view on Meta::CPAN
3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 | length : length of the tics
along : where the tics are put (axis/border)
minor : number of minor tics between adjacant major tics
mirror : turn on and off the tic label of the secondary axis. No effect
: for C<ztics> (on/off)
|
lib/Chart/Gnuplot.pm
view on Meta::CPAN
3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 | if ... than else ... : ?:, e.g., a ? b : c
Parametric functions may be represented as hash. E.g.
func => { x => 'sin(t)' , y => 'cos(t)' }
will draw a circle.
|
lib/Chart/Gnuplot.pm
view on Meta::CPAN
3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 | my $chart = Chart::Gnuplot->new(
output => "file.png"
);
my $dataSet = Chart::Gnuplot::DataSet->new(
datafile => "in.dat"
);
$chart ->plot2d( $dataSet );
|
t/legend.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/usr/bin/perl -w
my $temp = "temp.ps" ;
{
my $d = Chart::Gnuplot::DataSet->new(
func => "cos(x)" ,
title => "cosine function" ,
);
ok( $d ->_thaw() eq "cos(x) title \"cosine function\"" );
}
{
my $c = Chart::Gnuplot->new(
output => $temp ,
legend => {
position => "outside center bottom" ,
order => "horizontal reverse" ,
align => 'left' ,
width => 3,
height => 4,
title => 'Trigonometric functions' ,
sample => { length => 10, position => 'left' , spacing => 2},
border => 'on' ,
},
);
$c ->_setChart();
ok( &diff ( $c ->{_script}, "legend_1.gp" ) == 0);
}
sub diff
{
my ( $f1 , $f2 ) = @_ ;
|