r75116 - in /trunk/libchart-gnuplot-perl: Changes META.yml Makefile.PL README debian/changelog lib/Chart/Gnuplot.pm
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Sat Jun 4 19:26:26 UTC 2011
Author: carnil
Date: Sat Jun 4 19:26:19 2011
New Revision: 75116
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75116
Log:
* New upstream release
* Email change: Salvatore Bonaccorso -> carnil at debian.org
Modified:
trunk/libchart-gnuplot-perl/Changes
trunk/libchart-gnuplot-perl/META.yml
trunk/libchart-gnuplot-perl/Makefile.PL
trunk/libchart-gnuplot-perl/README
trunk/libchart-gnuplot-perl/debian/changelog
trunk/libchart-gnuplot-perl/lib/Chart/Gnuplot.pm
Modified: trunk/libchart-gnuplot-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libchart-gnuplot-perl/Changes?rev=75116&op=diff
==============================================================================
--- trunk/libchart-gnuplot-perl/Changes (original)
+++ trunk/libchart-gnuplot-perl/Changes Sat Jun 4 19:26:19 2011
@@ -1,4 +1,10 @@
Change log for Chart::Gnuplot
+
+0.16
+ - Add support of creating animated gif
+ - Option to unset "(x|y)tics" and "border"
+ (Thanks to Adam Russell)
+ - Improve POD
0.15
- Fix the problem that "orient" has no effect if "imagesize" is set
Modified: trunk/libchart-gnuplot-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libchart-gnuplot-perl/META.yml?rev=75116&op=diff
==============================================================================
--- trunk/libchart-gnuplot-perl/META.yml (original)
+++ trunk/libchart-gnuplot-perl/META.yml Sat Jun 4 19:26:19 2011
@@ -1,7 +1,7 @@
--- #YAML:1.0
name: Chart-Gnuplot
-version: 0.15
-abstract: Plot graph using Gnuplot on the fly
+version: 0.16
+abstract: Plot graph using Gnuplot in Perl on the fly
author:
- Ka-Wai Mak
license: perl
@@ -11,6 +11,7 @@
build_requires:
ExtUtils::MakeMaker: 0
requires:
+ Carp: 1.04
File::Copy: 2.08
File::Temp: 0.14
Storable: 2.15
Modified: trunk/libchart-gnuplot-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libchart-gnuplot-perl/Makefile.PL?rev=75116&op=diff
==============================================================================
--- trunk/libchart-gnuplot-perl/Makefile.PL (original)
+++ trunk/libchart-gnuplot-perl/Makefile.PL Sat Jun 4 19:26:19 2011
@@ -6,6 +6,7 @@
VERSION_FROM => 'lib/Chart/Gnuplot.pm',
ABSTRACT_FROM => "lib/Chart/Gnuplot.pm",
PREREQ_PM => {
+ Carp => 1.04,
File::Copy => 2.08,
File::Temp => 0.14,
Storable => 2.15,
Modified: trunk/libchart-gnuplot-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libchart-gnuplot-perl/README?rev=75116&op=diff
==============================================================================
--- trunk/libchart-gnuplot-perl/README (original)
+++ trunk/libchart-gnuplot-perl/README Sat Jun 4 19:26:19 2011
@@ -1,6 +1,6 @@
Description
===========
-Plot graph using Gnuplot on the fly
+Plot graph using Gnuplot in Perl on the fly
Build and install
=================
@@ -11,12 +11,13 @@
Prerequisites
=============
+Carp v 1.04 or later
File::Copy v2.08 or later
File::Temp v0.14 or later
Storable v2.15 or later
Copyright
=========
-Copyright (c) 2008-2010 Ka-Wai Mak. All rights reserved.
+Copyright (c) 2008-2011 Ka-Wai Mak. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Modified: trunk/libchart-gnuplot-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libchart-gnuplot-perl/debian/changelog?rev=75116&op=diff
==============================================================================
--- trunk/libchart-gnuplot-perl/debian/changelog (original)
+++ trunk/libchart-gnuplot-perl/debian/changelog Sat Jun 4 19:26:19 2011
@@ -1,6 +1,7 @@
-libchart-gnuplot-perl (0.15-3) UNRELEASED; urgency=low
+libchart-gnuplot-perl (0.16-1) UNRELEASED; urgency=low
- * Update my email address.
+ * New upstream release
+ * Email change: Salvatore Bonaccorso -> carnil at debian.org
-- Salvatore Bonaccorso <carnil at debian.org> Sun, 10 Oct 2010 15:02:32 +0200
Modified: trunk/libchart-gnuplot-perl/lib/Chart/Gnuplot.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libchart-gnuplot-perl/lib/Chart/Gnuplot.pm?rev=75116&op=diff
==============================================================================
--- trunk/libchart-gnuplot-perl/lib/Chart/Gnuplot.pm (original)
+++ trunk/libchart-gnuplot-perl/lib/Chart/Gnuplot.pm Sat Jun 4 19:26:19 2011
@@ -5,7 +5,7 @@
use File::Copy qw(move);
use File::Temp qw(tempdir);
use Chart::Gnuplot::Util qw(_lineType _pointType _copy);
-$VERSION = '0.15';
+$VERSION = '0.16';
# Constructor
sub new
@@ -412,24 +412,31 @@
}
elsif ($attr =~ /^(x|y|x2|y2|z)tics$/)
{
- my ($axis) = ($attr =~ /^(.+)tics$/);
- print PLT "set $attr".&_setTics($self->{$attr})."\n";
- if (ref($self->{$attr}) eq 'HASH')
- {
- if (defined ${$self->{$attr}}{labelfmt})
+ if (defined $self->{$attr})
+ {
+ my ($axis) = ($attr =~ /^(.+)tics$/);
+ print PLT "set $attr".&_setTics($self->{$attr})."\n";
+ if (ref($self->{$attr}) eq 'HASH')
{
- print PLT "set format $axis ".
- "\"${$self->{$attr}}{labelfmt}\"\n";
- push(@sets, 'format');
+ if (defined ${$self->{$attr}}{labelfmt})
+ {
+ print PLT "set format $axis ".
+ "\"${$self->{$attr}}{labelfmt}\"\n";
+ push(@sets, 'format');
+ }
+ if (defined ${$self->{$attr}}{minor})
+ {
+ my $nTics = ${$self->{$attr}}{minor}+1;
+ print PLT "set m$axis"."tics $nTics\n";
+ push(@sets, "m$axis"."tics");
+ }
}
- if (defined ${$self->{$attr}}{minor})
- {
- my $nTics = ${$self->{$attr}}{minor}+1;
- print PLT "set m$axis"."tics $nTics\n";
- push(@sets, "m$axis"."tics");
- }
- }
- push(@sets, $attr);
+ push(@sets, $attr);
+ }
+ else
+ {
+ print PLT "unset $attr\n";
+ }
}
elsif ($attr eq 'legend')
{
@@ -438,8 +445,15 @@
}
elsif ($attr eq 'border')
{
- print PLT "set border".&_setBorder($self->{border})."\n";
- push(@sets, 'border');
+ if (defined $self->{border})
+ {
+ print PLT "set border".&_setBorder($self->{border})."\n";
+ push(@sets, 'border');
+ }
+ else
+ {
+ print PLT "unset border\n";
+ }
}
elsif ($attr =~ /^(minor)?grid$/)
{
@@ -951,9 +965,9 @@
$gnuplot = $self->{gnuplot} if (defined $self->{gnuplot});
my $cmd = "$gnuplot $self->{_script}";
$cmd .= " -" if ($self->{terminal} =~ /^(ggi|pm|windows|wxt|x11)(\s|$)/);
-# my $err = `$cmd 2>&1`;
- my $err;
- system("$cmd");
+ my $err = `$cmd 2>&1`;
+# my $err;
+# system("$cmd");
# Capture and process error message from Gnuplot
if (defined $err && $err ne '')
@@ -1111,6 +1125,68 @@
my $gnuplot = 'gnuplot';
$gnuplot = $self->{gnuplot} if (defined $self->{gnuplot});
system("$gnuplot $pltTmp");
+ return($self);
+}
+
+
+# Create animated gif
+#
+# Usage example:
+# $chart->animate(
+# charts => \@charts, # sequence of chart object
+# delay => 10, # delay in units of 0.01 second
+# );
+sub animate
+{
+ my ($self, %animate) = @_;
+ my $charts = $animate{charts};
+
+ # Force the terminal to be 'gif'
+ # - Only the 'gif' terminal supports animation
+ if (defined $self->{_terminal} && $self->{_terminal} eq 'auto')
+ {
+ $self->{terminal} = $self->{_terminal} = 'gif';
+ }
+ elsif ($self->{terminal} !~ /^gif/)
+ {
+ croak "animate() is supported only by the gif terminal";
+ }
+ $self->{terminal} .= " animate";
+ $self->{terminal} .= " delay $animate{delay}" if (defined $animate{delay});
+
+ &_setChart($self);
+
+ open(PLT, ">>$self->{_script}") || confess("Can't write $self->{_script}");
+
+ foreach my $chart (@$charts)
+ {
+ $chart->_script($self->{_script});
+ $chart->_multiplot(1);
+
+ my $plot;
+ my @dataSet;
+ if (defined $chart->{_dataSets2D})
+ {
+ $plot = 'plot';
+ @dataSet = @{$chart->{_dataSets2D}};
+ }
+ elsif (defined $chart->{_dataSets3D})
+ {
+ $plot = 'splot';
+ @dataSet = @{$chart->{_dataSets3D}};
+ }
+
+ &_setChart($chart, \@dataSet);
+ open(PLT, ">>$self->{_script}") ||
+ confess("Can't write $self->{_script}");
+ print PLT "\n$plot ";
+ print PLT join(', ', map {$_->_thaw($self)} @dataSet), "\n";
+ close(PLT);
+ &_reset($chart);
+ }
+
+ # Generate image file
+ &_execute($self);
return($self);
}
@@ -1823,7 +1899,7 @@
=head1 NAME
-Chart::Gnuplot - Plot graph using Gnuplot on the fly
+Chart::Gnuplot - Plot graph using Gnuplot in Perl on the fly
=head1 SYNOPSIS
@@ -1861,9 +1937,9 @@
=head1 DESCRIPTION
-This module is to plot graphs uning GNUPLOT on the fly. In order to use this
-module, gnuplot need to be installed. If image format other than PS and EPS is
-required to generate, the convert program of ImageMagick is also needed.
+This Perl module is to plot graphs uning GNUPLOT on the fly. In order to use
+this module, gnuplot need to be installed. If image format other than PS and
+EPS is required to generate, the convert program of ImageMagick is also needed.
To plot chart using Chart::Gnuplot, a chart object and at least one dataset
object are required. Information about the chart such as output file, chart
@@ -1878,7 +1954,7 @@
$chart->plot2d($dataSet1, $dataSet2, ...);
To illustate the features of Chart::Gnuplot, the best way is to show by
-examples. A lot of examples are provided in the package.
+examples. A lot of examples can be found in SourceForge L<http://chartgnuplot.sourceforge.net>.
=head1 CHART OBJECT
@@ -1965,14 +2041,17 @@
xrange => [0, "pi"]
+would make the plot from x = 0 to x = 3.14159...
+
=head3 x2range, y2range
-Range of the secondary axes in the plot. See L<xrange>.
+Range of the secondary (top horizontal and right vertical) axes of the plot.
+See L<xrange, yrange, zrange>.
=head3 trange, urange, vrange
Range of the parametric parameter (t for 2D plots, while u and v for 3D plots).
-See L<xrange>.
+See L<xrange, yrange, zrange>.
=head3 xtics, ytics, ztics
@@ -1983,6 +2062,13 @@
labelfmt => "%3f",
....
}
+
+If you set this to C<undef>. E.g.,
+
+ xtics => undef
+
+Then this option will be explicitly I<unset> and the chart will have not have
+tic marks on the specified axis.
Supported properties are:
@@ -2061,6 +2147,13 @@
color => '#ff00ff',
}
+If you set this to C<undef>. E.g.,
+
+ border => undef
+
+Then this option will be explicitly I<unset> and the chart will have not have
+any border.
+
=head3 grid
Major grid lines. E.g.
@@ -2213,15 +2306,47 @@
Plot multiple charts in the same image.
+=head3 animate
+
+Create animated gif. E.g.
+
+ my $chart = Chart::Gnuplot->new(
+ output => "animate.gif",
+ );
+
+ my $T = 30; # number of frames
+ my @c;
+ for (my $i = 0; $i < $T; $i++)
+ {
+ $c[$i] = Chart::Gnuplot->new(xlabel => 'x');
+ my $ds = Chart::Gnuplot::DataSet->new(
+ func => "sin($i*2*pi/$T + x)",
+ );
+ $c[$i]->add2d($ds);
+ }
+
+ $chart->animate(
+ charts => \@c,
+ delay => 10, # delay 0.1 sec between successive images
+ );
+
+Supported properties are:
+
+ charts : chart sequence used to create the animation
+ delay : delay (in units of 0.01 second) between successive images, default
+ : value is 5
+
+See L<add2d> and L<add3d>.
+
=head3 add2d
Add a 2D dataset to a chart without plotting it out immediately. Used with
-C<multiplot>.
+C<multiplot> or C<animate>.
=head3 add3d
Add a 3D dataset to a chart without plotting it out immediately. Used with
-C<multiplot>.
+C<multiplot> or C<animate>.
=head3 label
@@ -2730,7 +2855,7 @@
=head1 REQUIREMENTS
-L<File::Copy>, L<File::Temp>, L<Storable>
+L<Carp>, L<File::Copy>, L<File::Temp>, L<Storable>
Gnuplot L<http://www.gnuplot.info>
@@ -2746,7 +2871,7 @@
=head1 COPYRIGHT
-Copyright (c) 2008-2010 Ka-Wai Mak. All rights reserved.
+Copyright (c) 2008-2011 Ka-Wai Mak. All rights reserved.
=head1 LICENSE
More information about the Pkg-perl-cvs-commits
mailing list