mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-05 22:11:12 +08:00
Merge branch 'master' into debian
This commit is contained in:
commit
af94ddf457
17
Changes
17
Changes
@ -1,10 +1,23 @@
|
|||||||
feedgnuplot (1.30) unstable; urgency=low
|
feedgnuplot (1.32)
|
||||||
|
|
||||||
|
* Added --rangesize and --rangesizeall. Different curves can now plot
|
||||||
|
different-size tuples
|
||||||
|
|
||||||
|
-- Dima Kogan <dima@secretsauce.net> Wed, 05 Feb 2014 13:57:58 -0800
|
||||||
|
|
||||||
|
feedgnuplot (1.31)
|
||||||
|
|
||||||
|
* Test suite requires gawk to get strftime()
|
||||||
|
|
||||||
|
-- Dima Kogan <dima@secretsauce.net> Sat, 25 Jan 2014 20:49:38 -0800
|
||||||
|
|
||||||
|
feedgnuplot (1.30)
|
||||||
|
|
||||||
* Added --with, --set, --unset, --style, --styleall
|
* Added --with, --set, --unset, --style, --styleall
|
||||||
|
|
||||||
-- Dima Kogan <dima@secretsauce.net> Fri, 24 Jan 2014 15:38:07 -0800
|
-- Dima Kogan <dima@secretsauce.net> Fri, 24 Jan 2014 15:38:07 -0800
|
||||||
|
|
||||||
feedgnuplot (1.29) unstable; urgency=low
|
feedgnuplot (1.29)
|
||||||
|
|
||||||
* added CPAN meta-data to require IPC::Run at build time
|
* added CPAN meta-data to require IPC::Run at build time
|
||||||
|
|
||||||
|
169
bin/feedgnuplot
169
bin/feedgnuplot
@ -13,7 +13,7 @@ use Thread::Queue;
|
|||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
use Time::Piece;
|
use Time::Piece;
|
||||||
|
|
||||||
my $VERSION = 1.30;
|
my $VERSION = 1.32;
|
||||||
|
|
||||||
my %options;
|
my %options;
|
||||||
interpretCommandline();
|
interpretCommandline();
|
||||||
@ -121,6 +121,8 @@ sub interpretCommandline
|
|||||||
$options{styleall} = '';
|
$options{styleall} = '';
|
||||||
$options{with} = '';
|
$options{with} = '';
|
||||||
|
|
||||||
|
$options{rangesize} = [];
|
||||||
|
|
||||||
GetOptions(\%options, 'stream:s', 'domain!', 'dataid!', '3d!', 'colormap!', 'lines!', 'points!',
|
GetOptions(\%options, 'stream:s', 'domain!', 'dataid!', '3d!', 'colormap!', 'lines!', 'points!',
|
||||||
'circles', 'legend=s{2}', 'autolegend!', 'xlabel=s', 'ylabel=s', 'y2label=s', 'zlabel=s',
|
'circles', 'legend=s{2}', 'autolegend!', 'xlabel=s', 'ylabel=s', 'y2label=s', 'zlabel=s',
|
||||||
'title=s', 'xlen=f', 'ymin=f', 'ymax=f', 'xmin=s', 'xmax=s', 'y2min=f', 'y2max=f',
|
'title=s', 'xlen=f', 'ymin=f', 'ymax=f', 'xmin=s', 'xmax=s', 'y2min=f', 'y2max=f',
|
||||||
@ -129,7 +131,8 @@ sub interpretCommandline
|
|||||||
'square!', 'square_xy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s',
|
'square!', 'square_xy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s',
|
||||||
'histogram=s@', 'binwidth=f', 'histstyle=s',
|
'histogram=s@', 'binwidth=f', 'histstyle=s',
|
||||||
'terminal=s',
|
'terminal=s',
|
||||||
'extraValuesPerPoint=i', 'help', 'dump', 'exit', 'version',
|
'rangesize=s{2}', 'rangesizeall=i', 'extraValuesPerPoint=i',
|
||||||
|
'help', 'dump', 'exit', 'version',
|
||||||
'geometry=s') or pod2usage( -exitval => 1,
|
'geometry=s') or pod2usage( -exitval => 1,
|
||||||
-verbose => 1, # synopsis and args
|
-verbose => 1, # synopsis and args
|
||||||
-output => \*STDERR );
|
-output => \*STDERR );
|
||||||
@ -176,7 +179,7 @@ sub interpretCommandline
|
|||||||
# arrays in order to preserve the ordering. I parse both of these into hashes
|
# arrays in order to preserve the ordering. I parse both of these into hashes
|
||||||
# because those are useful to have later. After this I can access individual
|
# because those are useful to have later. After this I can access individual
|
||||||
# legends with $options{legend_hash}{curveid}
|
# legends with $options{legend_hash}{curveid}
|
||||||
for my $listkey (qw(legend curvestyle))
|
for my $listkey (qw(legend curvestyle rangesize))
|
||||||
{
|
{
|
||||||
$options{"${listkey}_hash"} = {};
|
$options{"${listkey}_hash"} = {};
|
||||||
|
|
||||||
@ -193,6 +196,12 @@ sub interpretCommandline
|
|||||||
exit -1;
|
exit -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( defined $options{rangesizeall} && defined $options{extraValuesPerPoint} )
|
||||||
|
{
|
||||||
|
print STDERR "Only one of --rangesizeall and --extraValuesPerPoint may be given\n";
|
||||||
|
exit -1;
|
||||||
|
}
|
||||||
|
|
||||||
# parse stream option. Allowed only numbers >= 0 or 'trigger'. After this code
|
# parse stream option. Allowed only numbers >= 0 or 'trigger'. After this code
|
||||||
# $options{stream} is
|
# $options{stream} is
|
||||||
# -1 for triggered replotting
|
# -1 for triggered replotting
|
||||||
@ -347,8 +356,6 @@ sub interpretCommandline
|
|||||||
|
|
||||||
my $Nfields = scalar split( ' ', $options{timefmt});
|
my $Nfields = scalar split( ' ', $options{timefmt});
|
||||||
$options{timefmt_Ncols} = $Nfields;
|
$options{timefmt_Ncols} = $Nfields;
|
||||||
my $regex_str = join( '\s+', ('\S+') x $Nfields );
|
|
||||||
$options{timefmt_regex} = qr/$regex_str/;
|
|
||||||
|
|
||||||
# make sure --xlen is an integer. With a timefmt xlen goes through strptime
|
# make sure --xlen is an integer. With a timefmt xlen goes through strptime
|
||||||
# and strftime, and those are integer-only
|
# and strftime, and those are integer-only
|
||||||
@ -427,10 +434,18 @@ sub makeDomainNumeric
|
|||||||
|
|
||||||
sub mainThread
|
sub mainThread
|
||||||
{
|
{
|
||||||
my $valuesPerPoint = 1;
|
my $valuesPerPoint;
|
||||||
|
if( $options{rangesizeall} )
|
||||||
|
{
|
||||||
|
$valuesPerPoint = $options{rangesizeall};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$valuesPerPoint = 1;
|
||||||
if($options{extraValuesPerPoint}) { $valuesPerPoint += $options{extraValuesPerPoint}; }
|
if($options{extraValuesPerPoint}) { $valuesPerPoint += $options{extraValuesPerPoint}; }
|
||||||
if($options{colormap}) { $valuesPerPoint++; }
|
if($options{colormap}) { $valuesPerPoint++; }
|
||||||
if($options{circles} ) { $valuesPerPoint++; }
|
if($options{circles} ) { $valuesPerPoint++; }
|
||||||
|
}
|
||||||
|
|
||||||
local *PIPE;
|
local *PIPE;
|
||||||
my $dopersist = '';
|
my $dopersist = '';
|
||||||
@ -573,16 +588,6 @@ sub mainThread
|
|||||||
|
|
||||||
setCurveAsHistogram( $_ ) foreach (@{$options{histogram}});
|
setCurveAsHistogram( $_ ) foreach (@{$options{histogram}});
|
||||||
|
|
||||||
# regexp for a possibly floating point, possibly scientific notation number
|
|
||||||
my $numRE = '-?\d*\.?\d+(?:[Ee][-+]?\d+)?';
|
|
||||||
my $domainRE = $options{timefmt_regex} || $numRE;
|
|
||||||
|
|
||||||
|
|
||||||
# a point may be preceded by an id
|
|
||||||
my $pointRE = $options{dataid} ? '(\S+)\s+' : '()';
|
|
||||||
$pointRE .= '(' . join('\s+', ($numRE) x $valuesPerPoint) . ')';
|
|
||||||
$pointRE = qr/$pointRE/;
|
|
||||||
|
|
||||||
# set all the axis ranges
|
# set all the axis ranges
|
||||||
# If a bound isn't given I want to set it to the empty string, so I can communicate it simply to
|
# If a bound isn't given I want to set it to the empty string, so I can communicate it simply to
|
||||||
# gnuplot
|
# gnuplot
|
||||||
@ -651,18 +656,37 @@ sub mainThread
|
|||||||
# line is used)
|
# line is used)
|
||||||
# 3d plots require $options{domain}, and dictate "x y" for the domain instead of just "x"
|
# 3d plots require $options{domain}, and dictate "x y" for the domain instead of just "x"
|
||||||
|
|
||||||
|
my @fields = split;
|
||||||
|
|
||||||
if($options{domain})
|
if($options{domain})
|
||||||
{
|
{
|
||||||
/($domainRE)/go or next;
|
if( $options{timefmt} )
|
||||||
$domain[0] = $1;
|
|
||||||
$domain0_numeric = makeDomainNumeric( $domain[0] );
|
|
||||||
|
|
||||||
if($options{'3d'})
|
|
||||||
{
|
{
|
||||||
/($numRE)/go or next;
|
# no point if doing anything unless I have at least the domain and
|
||||||
$domain[1] = $1;
|
# 1 piece of data
|
||||||
|
next if @fields < $options{timefmt_Ncols}+1;
|
||||||
|
|
||||||
|
$domain[0] = join (' ', splice( @fields, 0, $options{timefmt_Ncols}) );
|
||||||
|
$domain0_numeric = makeDomainNumeric( $domain[0] );
|
||||||
}
|
}
|
||||||
elsif( $options{monotonic} )
|
elsif(!$options{'3d'})
|
||||||
|
{
|
||||||
|
# no point if doing anything unless I have at least the domain and
|
||||||
|
# 1 piece of data
|
||||||
|
next if @fields < 1+1;
|
||||||
|
|
||||||
|
$domain[0] = $domain0_numeric = shift @fields;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# no point if doing anything unless I have at least the domain and
|
||||||
|
# 1 piece of data
|
||||||
|
next if @fields < 2+1;
|
||||||
|
|
||||||
|
@domain = splice(@fields, 0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $options{monotonic} )
|
||||||
{
|
{
|
||||||
if( defined $latestX && $domain0_numeric < $latestX )
|
if( defined $latestX && $domain0_numeric < $latestX )
|
||||||
{
|
{
|
||||||
@ -676,7 +700,6 @@ sub mainThread
|
|||||||
else
|
else
|
||||||
{ $latestX = $domain0_numeric; }
|
{ $latestX = $domain0_numeric; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -684,8 +707,7 @@ sub mainThread
|
|||||||
# $. on the data queue in that case
|
# $. on the data queue in that case
|
||||||
if(defined $dataQueue)
|
if(defined $dataQueue)
|
||||||
{
|
{
|
||||||
s/ ([\d]+)$//o;
|
$domain[0] = pop @fields;
|
||||||
$domain[0] = $1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -695,13 +717,32 @@ sub mainThread
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $id = -1;
|
my $id = -1;
|
||||||
while (/$pointRE/go)
|
|
||||||
|
while(@fields)
|
||||||
{
|
{
|
||||||
if($1 ne '') {$id = $1;}
|
my $rangesize = $valuesPerPoint;
|
||||||
else {$id++; }
|
|
||||||
|
if($options{dataid})
|
||||||
|
{
|
||||||
|
$id = shift @fields;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$id++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $options{rangesize_hash}{$id} )
|
||||||
|
{
|
||||||
|
$rangesize = $options{rangesize_hash}{$id};
|
||||||
|
}
|
||||||
|
|
||||||
|
last if @fields < $rangesize;
|
||||||
|
|
||||||
pushPoint(getCurve($id),
|
pushPoint(getCurve($id),
|
||||||
"@domain $2\n", $domain0_numeric);
|
join(' ',
|
||||||
|
@domain,
|
||||||
|
splice( @fields, 0, $rangesize ) ) . "\n",
|
||||||
|
$domain0_numeric);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1112,17 +1153,24 @@ conjunction with C<--dataid>.
|
|||||||
=head3 Multi-value style support
|
=head3 Multi-value style support
|
||||||
|
|
||||||
Depending on how gnuplot is plotting the data, more than one value may be needed
|
Depending on how gnuplot is plotting the data, more than one value may be needed
|
||||||
to represent a single point. For example, the script has support to plot all the
|
to represent the range of a single point. Basic 2D plots have 2 numbers
|
||||||
data with C<--circles>. This requires a radius to be specified for each point in
|
representing each point: 1 domain and 1 range. But if plotting with
|
||||||
addition to the position of the point. Thus, when plotting with C<--circles>, 2
|
C<--circles>, for instance, then there's an extra range value: the radius. A
|
||||||
numbers are read for each data point instead of 1. A similar situation exists
|
similar situation exists with C<--colormap> where each point contains the
|
||||||
with C<--colormap> where each point contains the position I<and> the color.
|
position I<and> the color. There are other gnuplot styles that require more data
|
||||||
There are other gnuplot styles that require more data (such as error bars), but
|
(such as error bars), but none of these are directly supported by the script.
|
||||||
none of these are directly supported by the script. They can still be used,
|
They can still be used, however, by specifying the specific style with
|
||||||
though, by specifying the specific style with C<--style>, and specifying how
|
C<--style>, and specifying how many values are needed for each point with
|
||||||
many extra values are needed for each point with C<--extraValuesPerPoint extra>.
|
C<--rangesizeall> or C<--rangesize> or C<--extraValuesPerPoint>. Those options
|
||||||
C<--extraValuesPerPoint> is ONLY needed for the styles not explicitly supported;
|
that specify the range size are required I<only> for styles not explicitly
|
||||||
supported styles set that variable automatically.
|
supported by feedgnuplot; supported styles do the right thing automatically.
|
||||||
|
|
||||||
|
More examples: if making a 2d plot of y error bars where gnuplot expects a
|
||||||
|
(x,y,ydelta) tuple for each point, you want C<--rangesizeall 2> because you have
|
||||||
|
one domain value (x) and 2 range values (y,ydelta). Gnuplot can also plot
|
||||||
|
lopsided y errorbars by giving a tuple (x,y,ylow,yhigh). This is similar as
|
||||||
|
before, but you want C<--rangesizeall 3> instead.
|
||||||
|
|
||||||
|
|
||||||
=head3 3D data
|
=head3 3D data
|
||||||
|
|
||||||
@ -1157,7 +1205,7 @@ C<--xmin> and C<--xmax> I<must> use the format passed in to C<--timefmt>
|
|||||||
|
|
||||||
Using this option changes both the way the input is parsed I<and> the way the
|
Using this option changes both the way the input is parsed I<and> the way the
|
||||||
x-axis tics are labelled. Gnuplot tries to be intelligent in this labelling, but
|
x-axis tics are labelled. Gnuplot tries to be intelligent in this labelling, but
|
||||||
it doesn't always to what the user wants. The labelling can be controlled with
|
it doesn't always do what the user wants. The labelling can be controlled with
|
||||||
the gnuplot C<set format> command, which takes the same type of format string as
|
the gnuplot C<set format> command, which takes the same type of format string as
|
||||||
C<--timefmt>. Example:
|
C<--timefmt>. Example:
|
||||||
|
|
||||||
@ -1365,8 +1413,7 @@ Interpret the X data as a time/date, parsed with the given format
|
|||||||
C<--colormap>
|
C<--colormap>
|
||||||
|
|
||||||
Show a colormapped xy plot. Requires extra data for the color. zmin/zmax can be
|
Show a colormapped xy plot. Requires extra data for the color. zmin/zmax can be
|
||||||
used to set the extents of the colors. Automatically increments
|
used to set the extents of the colors. Automatically sets the C<--rangesize>.
|
||||||
C<--extraValuesPerPoint>
|
|
||||||
|
|
||||||
=item
|
=item
|
||||||
|
|
||||||
@ -1394,8 +1441,7 @@ Do [not] draw points
|
|||||||
C<--circles>
|
C<--circles>
|
||||||
|
|
||||||
Plot with circles. This requires a radius be specified for each point.
|
Plot with circles. This requires a radius be specified for each point.
|
||||||
Automatically increments C<--extraValuesPerPoint>). C<Not> supported for 3d
|
Automatically sets the C<--rangesize>. C<Not> supported for 3d plots.
|
||||||
plots.
|
|
||||||
|
|
||||||
=item
|
=item
|
||||||
|
|
||||||
@ -1599,13 +1645,32 @@ replotted before being purged
|
|||||||
|
|
||||||
=item
|
=item
|
||||||
|
|
||||||
|
C<--rangesize curveID xxx>
|
||||||
|
|
||||||
|
The options C<--rangesizeall>, C<--rangesize> and C<--extraValuesPerPoint> set
|
||||||
|
the number of values are needed to represent each point being plotted (see
|
||||||
|
L</"Multi-value style support"> above). These options are I<only> needed if
|
||||||
|
unknown styles are used, with C<--styleall> or C<--with> for instance.
|
||||||
|
|
||||||
|
C<--rangesize> is used to set how many values are needed to represent the range
|
||||||
|
of a point for a particular curve. This overrides any defaults that may exist
|
||||||
|
for this curve only.
|
||||||
|
|
||||||
|
=item
|
||||||
|
|
||||||
|
C<--rangesizeall xxx>
|
||||||
|
|
||||||
|
Like C<--rangesize>, but applies to I<all> the curves.
|
||||||
|
|
||||||
C<--extraValuesPerPoint xxx>
|
C<--extraValuesPerPoint xxx>
|
||||||
|
|
||||||
How many extra values are given for each data point. Normally this is 0, and
|
Like C<--rangesizeall>, but instead of overriding the default, adds to it. For
|
||||||
does not need to be specified, but sometimes we want extra data, like for colors
|
example, if plotting non-lopsided y errorbars gnuplot wants (x,y,ydelta) tuples.
|
||||||
or point sizes or error bars, etc. feedgnuplot options that require this
|
These can be specified both with C<--rangesizeall 2> (because there are 2 range
|
||||||
(colormap, circles) automatically set it. This option is ONLY needed if unknown
|
values) or C<--extraValuesPerPoint 1> (because there's 1 more value than usual).
|
||||||
styles are used, with C<--styleall> or C<--with> for instance
|
|
||||||
|
This option is I<only> needed if unknown styles are used, with C<--styleall> or
|
||||||
|
C<--with> for instance.
|
||||||
|
|
||||||
=item
|
=item
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ complete -W \
|
|||||||
--dump \
|
--dump \
|
||||||
--exit \
|
--exit \
|
||||||
--extraValuesPerPoint \
|
--extraValuesPerPoint \
|
||||||
|
--rangesizeall \
|
||||||
|
--rangesize \
|
||||||
--extracmds \
|
--extracmds \
|
||||||
--set \
|
--set \
|
||||||
--unset \
|
--unset \
|
||||||
|
@ -37,7 +37,9 @@ _arguments -S
|
|||||||
'--hardcopy[Plot to a file]:filename' \
|
'--hardcopy[Plot to a file]:filename' \
|
||||||
'--maxcurves[The maximum allowed number of curves]:number of curves' \
|
'--maxcurves[The maximum allowed number of curves]:number of curves' \
|
||||||
'(--3d)--monotonic[Resets plot if an X in the past is seen]' \
|
'(--3d)--monotonic[Resets plot if an X in the past is seen]' \
|
||||||
'--extraValuesPerPoint[How many extra values are given for each data point]:N'\
|
'(--rangesizeall)--extraValuesPerPoint[How many extra values are given for each data range]:N'\
|
||||||
|
'(--extraValuesPerPoint)--rangesizeall[How many values are given for each data range]:N'\
|
||||||
|
'*--rangesize[How many values comprise a data range in this curve]:curve id: :N:' \
|
||||||
'--dump[Instead of printing to gnuplot, print to STDOUT]' \
|
'--dump[Instead of printing to gnuplot, print to STDOUT]' \
|
||||||
'--geometry[The X11 geometry string]:geometry string:' \
|
'--geometry[The X11 geometry string]:geometry string:' \
|
||||||
'*--curvestyle[Additional styles for a curve]:curve id: :style:' \
|
'*--curvestyle[Additional styles for a curve]:curve id: :style:' \
|
||||||
|
155
t/plots.t
155
t/plots.t
@ -17,14 +17,20 @@ BEGIN {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
open(my $pipe, 'gnuplot --version |');
|
my $gawkversion = `gawk -V`;
|
||||||
if( !$pipe )
|
if( !$gawkversion || $@ )
|
||||||
|
{
|
||||||
|
print("1..0 # Skip: gawk is required for strftime() in the test suite. Skipping tests.\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $gnuplotVersion = `gnuplot --version`;
|
||||||
|
if( !$gnuplotVersion || $@)
|
||||||
{
|
{
|
||||||
print("1..0 # Skip: gnuplot not installed. Tests require ver. 4.6.4; feedgnuplot works with any.\n");
|
print("1..0 # Skip: gnuplot not installed. Tests require ver. 4.6.4; feedgnuplot works with any.\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $gnuplotVersion = <$pipe>;
|
|
||||||
chomp $gnuplotVersion;
|
chomp $gnuplotVersion;
|
||||||
if ($gnuplotVersion ne "gnuplot 4.6 patchlevel 4")
|
if ($gnuplotVersion ne "gnuplot 4.6 patchlevel 4")
|
||||||
{
|
{
|
||||||
@ -33,7 +39,7 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use Test::More tests => 52;
|
use Test::More tests => 56;
|
||||||
use File::Temp 'tempfile';
|
use File::Temp 'tempfile';
|
||||||
use IPC::Run 'run';
|
use IPC::Run 'run';
|
||||||
use String::ShellQuote;
|
use String::ShellQuote;
|
||||||
@ -320,7 +326,7 @@ tryplot( testname => 'basic line plot with bounds, square aspect ratio',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'lines on both axes with labels, legends, titles',
|
tryplot( testname => 'lines on both axes with labels, legends, titles',
|
||||||
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'},
|
cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
|
||||||
options => [qw(--lines --points),
|
options => [qw(--lines --points),
|
||||||
'--legend', '0', 'data 0',
|
'--legend', '0', 'data 0',
|
||||||
'--title', "Test plot",
|
'--title', "Test plot",
|
||||||
@ -369,7 +375,7 @@ tryplot( testname => 'lines on both axes with labels, legends, titles',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'lines on both axes with labels, legends, titles; different styles',
|
tryplot( testname => 'lines on both axes with labels, legends, titles; different styles',
|
||||||
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'},
|
cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
|
||||||
options => ['--legend', '0', 'data 0',
|
options => ['--legend', '0', 'data 0',
|
||||||
'--title', "Test plot",
|
'--title', "Test plot",
|
||||||
qw(--y2 1 --y2label y2 --xlabel x --ylabel y --y2max 30),
|
qw(--y2 1 --y2label y2 --xlabel x --ylabel y --y2max 30),
|
||||||
@ -419,7 +425,7 @@ tryplot( testname => 'lines on both axes with labels, legends, titles; different
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'domain plot',
|
tryplot( testname => 'domain plot',
|
||||||
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'},
|
cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
|
||||||
options => [qw(--lines --points), '--domain'],
|
options => [qw(--lines --points), '--domain'],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -465,7 +471,7 @@ tryplot( testname => 'domain plot',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'dataid plot',
|
tryplot( testname => 'dataid plot',
|
||||||
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'},
|
cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
|
||||||
options => [qw(--lines --points),
|
options => [qw(--lines --points),
|
||||||
qw(--dataid --autolegend)],
|
qw(--dataid --autolegend)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
@ -512,7 +518,7 @@ tryplot( testname => 'dataid plot',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => '3d spiral with bounds, labels',
|
tryplot( testname => '3d spiral with bounds, labels',
|
||||||
cmd => q{seq 50 | awk '{print 2*cos($1/5), sin($1/5), $1}'},
|
cmd => q{seq 50 | gawk '{print 2*cos($1/5), sin($1/5), $1}'},
|
||||||
options => [qw(--lines --points),
|
options => [qw(--lines --points),
|
||||||
qw(--3d --domain --zmin -5 --zmax 45 --zlabel z),
|
qw(--3d --domain --zmin -5 --zmax 45 --zlabel z),
|
||||||
'--extracmds', 'set view 60,30'],
|
'--extracmds', 'set view 60,30'],
|
||||||
@ -560,7 +566,7 @@ tryplot( testname => '3d spiral with bounds, labels',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => '3d spiral with bounds, labels, square xy aspect ratio',
|
tryplot( testname => '3d spiral with bounds, labels, square xy aspect ratio',
|
||||||
cmd => q{seq 50 | awk '{print 2*cos($1/5), sin($1/5), $1}'},
|
cmd => q{seq 50 | gawk '{print 2*cos($1/5), sin($1/5), $1}'},
|
||||||
options => [qw(--lines --points),
|
options => [qw(--lines --points),
|
||||||
qw(--3d --domain --zmin -5 --zmax 45 --zlabel z),
|
qw(--3d --domain --zmin -5 --zmax 45 --zlabel z),
|
||||||
'--extracmds', 'set view 60,30', '--square_xy'],
|
'--extracmds', 'set view 60,30', '--square_xy'],
|
||||||
@ -608,7 +614,7 @@ tryplot( testname => '3d spiral with bounds, labels, square xy aspect ratio',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'Monotonicity check',
|
tryplot( testname => 'Monotonicity check',
|
||||||
cmd => q{seq 10 | awk '{print (NR-1)%5,NR}'},
|
cmd => q{seq 10 | gawk '{print (NR-1)%5,NR}'},
|
||||||
options => [qw(--lines --points --domain --monotonic)],
|
options => [qw(--lines --points --domain --monotonic)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -655,7 +661,7 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
tryplot( testname => 'basic --timefmt plot',
|
tryplot( testname => 'basic --timefmt plot',
|
||||||
cmd => q{seq 5 | awk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'},
|
cmd => q{seq 5 | gawk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'},
|
||||||
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S'],
|
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S'],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -701,7 +707,7 @@ tryplot( testname => 'basic --timefmt plot',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => '--timefmt plot with bounds',
|
tryplot( testname => '--timefmt plot with bounds',
|
||||||
cmd => q{seq 5 | awk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'},
|
cmd => q{seq 5 | gawk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'},
|
||||||
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
||||||
'--xmin', '20 Oct 2013 06:05:00',
|
'--xmin', '20 Oct 2013 06:05:00',
|
||||||
'--xmax', '20 Oct 2013 06:05:20'],
|
'--xmax', '20 Oct 2013 06:05:20'],
|
||||||
@ -749,7 +755,7 @@ tryplot( testname => '--timefmt plot with bounds',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => '--timefmt plot with --monotonic',
|
tryplot( testname => '--timefmt plot with --monotonic',
|
||||||
cmd => q{seq 10 | awk '{x=(NR-1)%5; print strftime("%d %b %Y %T",1382249107+x,1),$1}'},
|
cmd => q{seq 10 | gawk '{x=(NR-1)%5; print strftime("%d %b %Y %T",1382249107+x,1),$1}'},
|
||||||
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
||||||
'--monotonic'],
|
'--monotonic'],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
@ -796,9 +802,9 @@ tryplot( testname => '--timefmt plot with --monotonic',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'Error bars (using extraValuesPerPoint)',
|
tryplot( testname => 'Error bars (using extraValuesPerPoint)',
|
||||||
cmd => q{seq 5 | awk '{print $1,$1,$1/10}'},
|
cmd => q{seq 5 | gawk '{print $1,$1,$1/10}'},
|
||||||
options => [qw(--domain),
|
options => [qw(--domain),
|
||||||
qw(--extraValuesPerPoint 1 --curvestyle 0), 'with errorbars'],
|
qw(--extraValuesPerPoint 1 --with errorbars)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
|
|
||||||
@ -843,6 +849,103 @@ tryplot( testname => 'Error bars (using extraValuesPerPoint)',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
tryplot( testname => 'Error bars (using rangesizeall)',
|
||||||
|
cmd => q{seq 5 | gawk '{print $1,$1,$1/10}'},
|
||||||
|
options => [qw(--domain),
|
||||||
|
qw(--rangesizeall 2 --with errorbars)],
|
||||||
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
|
|
||||||
|
5.5 ++---------+-----------+----------+----------+----------+-----------+----------+---------**
|
||||||
|
+ + + + + + + + *
|
||||||
|
| *
|
||||||
|
5 ++ +A
|
||||||
|
| *
|
||||||
|
| *
|
||||||
|
| *
|
||||||
|
4.5 ++ **
|
||||||
|
| *** |
|
||||||
|
| * |
|
||||||
|
4 ++ A ++
|
||||||
|
| * |
|
||||||
|
| * |
|
||||||
|
| *** |
|
||||||
|
3.5 ++ ++
|
||||||
|
| *** |
|
||||||
|
| * |
|
||||||
|
3 ++ A ++
|
||||||
|
| * |
|
||||||
|
| * |
|
||||||
|
| *** |
|
||||||
|
2.5 ++ ++
|
||||||
|
| |
|
||||||
|
| *** |
|
||||||
|
2 ++ A ++
|
||||||
|
| * |
|
||||||
|
| *** |
|
||||||
|
| |
|
||||||
|
1.5 ++ ++
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
1 A* ++
|
||||||
|
** |
|
||||||
|
| |
|
||||||
|
+ + + + + + + + +
|
||||||
|
0.5 ++---------+-----------+----------+----------+----------+-----------+----------+---------++
|
||||||
|
1 1.5 2 2.5 3 3.5 4 4.5 5
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
tryplot( testname => 'Error bars (using rangesize, rangesizeall)',
|
||||||
|
cmd => q{seq 5 | gawk '{print $1,"vert",$1,$1/10,"horiz",5-$1,$1-$1/5,$1+$1/20}'},
|
||||||
|
options => [qw(--domain --dataid),
|
||||||
|
qw(--rangesize vert 2 --rangesizeall 3 --with xerrorbars --style vert), 'with errorbars',
|
||||||
|
qw(--xmin 1 --xmax 5 --ymin 0.5 --ymax 5.5)],
|
||||||
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
|
|
||||||
|
+-----------+----------+-----------+----------+-----------+----------+-----------+---------**
|
||||||
|
+ + + + + + + + *
|
||||||
|
| *
|
||||||
|
5 ++ +A
|
||||||
|
| *
|
||||||
|
| *
|
||||||
|
| *
|
||||||
|
| **
|
||||||
|
| *** |
|
||||||
|
## * |
|
||||||
|
4 B# A ++
|
||||||
|
## * |
|
||||||
|
| * |
|
||||||
|
| *** |
|
||||||
|
| |
|
||||||
|
| *** |
|
||||||
|
| # # * |
|
||||||
|
3 ++ #########B## A ++
|
||||||
|
| # # * |
|
||||||
|
| * |
|
||||||
|
| *** |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| *** # # |
|
||||||
|
2 ++ A ##############B### ++
|
||||||
|
| * # # |
|
||||||
|
| *** |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| # # |
|
||||||
|
1 A* ##################B##### ++
|
||||||
|
** # # |
|
||||||
|
| |
|
||||||
|
+ + + + + + + + +
|
||||||
|
+-----------+----------+-----------+----------+-----------+----------+-----------+----------+
|
||||||
|
1 1.5 2 2.5 3 3.5 4 4.5 5
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
SKIP:
|
SKIP:
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -860,7 +963,7 @@ skip "Skipping unreliable tests. Set RUN_ALL_TESTS environment variable to run t
|
|||||||
|
|
||||||
|
|
||||||
tryplot( testname => 'Histogram plot',
|
tryplot( testname => 'Histogram plot',
|
||||||
cmd => q{seq 50 | awk '{print $1*$1}'},
|
cmd => q{seq 50 | gawk '{print $1*$1}'},
|
||||||
options => [qw(--lines --points),
|
options => [qw(--lines --points),
|
||||||
qw(--histo 0 --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'],
|
qw(--histo 0 --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
@ -907,7 +1010,7 @@ tryplot( testname => 'Histogram plot',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'Cumulative histogram',
|
tryplot( testname => 'Cumulative histogram',
|
||||||
cmd => q{seq 50 | awk '{print $1*$1}'},
|
cmd => q{seq 50 | gawk '{print $1*$1}'},
|
||||||
options => [qw(--lines --points),
|
options => [qw(--lines --points),
|
||||||
qw(--histo 0 --histstyle cum --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'],
|
qw(--histo 0 --histstyle cum --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
@ -954,7 +1057,7 @@ tryplot( testname => 'Cumulative histogram',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'Circles',
|
tryplot( testname => 'Circles',
|
||||||
cmd => q{seq 5 | awk '{print $1,$1,$1/10}'},
|
cmd => q{seq 5 | gawk '{print $1,$1,$1/10}'},
|
||||||
options => [qw(--circles --domain)],
|
options => [qw(--circles --domain)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -1008,7 +1111,7 @@ note( "Starting to run streaming tests. These will take several seconds each" );
|
|||||||
# points, and then "exit", so I should have two frames worth of data plotted. I
|
# points, and then "exit", so I should have two frames worth of data plotted. I
|
||||||
# pre-send a 0 so that the gnuplot autoscaling is always well-defined
|
# pre-send a 0 so that the gnuplot autoscaling is always well-defined
|
||||||
tryplot( testname => 'basic streaming test',
|
tryplot( testname => 'basic streaming test',
|
||||||
cmd => q{seq 500 | awk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 1.2");}'},
|
cmd => q{seq 500 | gawk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 1.2");}'},
|
||||||
options => [qw(--lines --points --stream)],
|
options => [qw(--lines --points --stream)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -1094,7 +1197,7 @@ tryplot( testname => 'basic streaming test',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'basic streaming test, twice as fast',
|
tryplot( testname => 'basic streaming test, twice as fast',
|
||||||
cmd => q{seq 500 | awk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'},
|
cmd => q{seq 500 | gawk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'},
|
||||||
options => [qw(--lines --points --stream 0.4)],
|
options => [qw(--lines --points --stream 0.4)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -1181,7 +1284,7 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
tryplot( testname => 'streaming with --xlen',
|
tryplot( testname => 'streaming with --xlen',
|
||||||
cmd => q{seq 500 | awk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'},
|
cmd => q{seq 500 | gawk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'},
|
||||||
options => [qw(--lines --points --stream 0.4 --xlen 1.1)],
|
options => [qw(--lines --points --stream 0.4 --xlen 1.1)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -1267,7 +1370,7 @@ tryplot( testname => 'streaming with --xlen',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => 'streaming with --monotonic',
|
tryplot( testname => 'streaming with --monotonic',
|
||||||
cmd => q{seq 500 | awk '{if(NR==11) {print "exit";} else {x=(NR-1)%5; if(x==0) {print -1,-1;} print x,NR;}; fflush(); system("sleep 0.6");}'},
|
cmd => q{seq 500 | gawk '{if(NR==11) {print "exit";} else {x=(NR-1)%5; if(x==0) {print -1,-1;} print x,NR;}; fflush(); system("sleep 0.6");}'},
|
||||||
options => [qw(--lines --points --stream 0.4 --domain --monotonic)],
|
options => [qw(--lines --points --stream 0.4 --domain --monotonic)],
|
||||||
refplot => <<'EOF' );
|
refplot => <<'EOF' );
|
||||||
|
|
||||||
@ -1673,7 +1776,7 @@ tryplot( testname => 'streaming with --monotonic',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => '--timefmt streaming plot with --xlen',
|
tryplot( testname => '--timefmt streaming plot with --xlen',
|
||||||
cmd => q{seq 5 | awk 'BEGIN{ print strftime("%d %b %Y %T",1382249107-1,1),-4;} {if(NR==3) {print "exit";} else{ print strftime("%d %b %Y %T",1382249107+$1,1),$1;} fflush(); system("sleep 0.6")}'},
|
cmd => q{seq 5 | gawk 'BEGIN{ print strftime("%d %b %Y %T",1382249107-1,1),-4;} {if(NR==3) {print "exit";} else{ print strftime("%d %b %Y %T",1382249107+$1,1),$1;} fflush(); system("sleep 0.6")}'},
|
||||||
options => ['--points', '--lines',
|
options => ['--points', '--lines',
|
||||||
'--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
'--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
||||||
qw(--stream 0.4 --xlen 3)],
|
qw(--stream 0.4 --xlen 3)],
|
||||||
@ -1761,7 +1864,7 @@ tryplot( testname => '--timefmt streaming plot with --xlen',
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
tryplot( testname => '--timefmt streaming plot with --monotonic',
|
tryplot( testname => '--timefmt streaming plot with --monotonic',
|
||||||
cmd => q{seq 10 | awk '{x=(NR-1)%5; if(x==0) {print strftime("%d %b %Y %T",1382249107-1,-4),-4;} print strftime("%d %b %Y %T",1382249107+x,1),NR; fflush(); system("sleep 0.6")}'},
|
cmd => q{seq 10 | gawk '{x=(NR-1)%5; if(x==0) {print strftime("%d %b %Y %T",1382249107-1,-4),-4;} print strftime("%d %b %Y %T",1382249107+x,1),NR; fflush(); system("sleep 0.6")}'},
|
||||||
options => ['--points', '--lines',
|
options => ['--points', '--lines',
|
||||||
'--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
'--domain', '--timefmt', '%d %b %Y %H:%M:%S',
|
||||||
qw(--stream 0.4 --monotonic)],
|
qw(--stream 0.4 --monotonic)],
|
||||||
@ -2177,7 +2280,7 @@ sub tryplot
|
|||||||
my %args = @_;
|
my %args = @_;
|
||||||
|
|
||||||
my @options = ('--exit',
|
my @options = ('--exit',
|
||||||
'--extracmds', 'unset grid',
|
qw(--unset grid),
|
||||||
'--terminal', 'dumb 100,40');
|
'--terminal', 'dumb 100,40');
|
||||||
unshift @options, @{$args{options}};
|
unshift @options, @{$args{options}};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user