Merge branch 'master' into debian

This commit is contained in:
Dima Kogan 2016-11-25 14:47:00 -08:00
commit b76c18a92d
3 changed files with 71 additions and 21 deletions

View File

@ -1,3 +1,12 @@
feedgnuplot (1.40)
* If the options couldn't be parsed I don't dump the whole manpage
* --style and --rangesize can now take a comma-separated list of IDs
* 'any' is from List::MoreUtils, not List::Util
* the sleep-forever delay at end is now > 1000 days
-- Dima Kogan <dima@secretsauce.net> Fri, 25 Nov 2016 14:45:06 -0800
feedgnuplot (1.39) feedgnuplot (1.39)
* by default, histograms are plotted in expected ways * by default, histograms are plotted in expected ways

View File

@ -64,6 +64,7 @@ WriteMakefile
PL_FILES => {}, PL_FILES => {},
EXE_FILES => [ 'bin/feedgnuplot' ], EXE_FILES => [ 'bin/feedgnuplot' ],
BUILD_REQUIRES => { 'String::ShellQuote' => 0, BUILD_REQUIRES => { 'String::ShellQuote' => 0,
'List::MoreUtils' => 0,
'IPC::Run' => 0}, 'IPC::Run' => 0},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'feedgnuplot-*' }, clean => { FILES => 'feedgnuplot-*' },

View File

@ -8,13 +8,14 @@ use Getopt::Long;
use Time::HiRes qw( usleep gettimeofday tv_interval ); use Time::HiRes qw( usleep gettimeofday tv_interval );
use IO::Handle; use IO::Handle;
use IO::Select; use IO::Select;
use List::Util qw( first any ); use List::Util qw( first );
use List::MoreUtils 'any';
use Scalar::Util qw( looks_like_number ); use Scalar::Util qw( looks_like_number );
use Text::ParseWords; # for shellwords use Text::ParseWords; # for shellwords
use Pod::Usage; use Pod::Usage;
use Time::Piece; use Time::Piece;
my $VERSION = 1.39; my $VERSION = 1.40;
my %options; my %options;
interpretCommandline(); interpretCommandline();
@ -108,9 +109,7 @@ sub interpretCommandline
'terminal=s', 'terminal=s',
'rangesize=s{2}', 'rangesizeall=i', 'extraValuesPerPoint=i', 'rangesize=s{2}', 'rangesizeall=i', 'extraValuesPerPoint=i',
'help', 'dump', 'exit', 'version', 'help', 'dump', 'exit', 'version',
'geometry=s') or pod2usage( -exitval => 1, 'geometry=s') or exit 1;
-verbose => 1, # synopsis and args
-output => \*STDERR );
# handle various cmdline-option errors # handle various cmdline-option errors
@ -127,13 +126,6 @@ sub interpretCommandline
exit 0; exit 0;
} }
# expand options that are given as comma-separated lists
for my $listkey (qw(histogram y2))
{
@{$options{$listkey}} = map split('\s*,\s*', $_), @{$options{$listkey}}
if defined $options{$listkey};
}
# --style and --curvestyle are synonyms, as are --styleall and # --style and --curvestyle are synonyms, as are --styleall and
# --curvestyleall, so fill that in # --curvestyleall, so fill that in
if( $options{styleall} ) if( $options{styleall} )
@ -157,6 +149,33 @@ sub interpretCommandline
delete $options{with}; delete $options{with};
} }
# expand options that are given as comma-separated lists
for my $listkey (qw(histogram y2))
{
@{$options{$listkey}} = map split('\s*,\s*', $_), @{$options{$listkey}}
if defined $options{$listkey};
}
for my $listkey (qw(curvestyle rangesize))
{
next unless defined $options{$listkey};
my @in = @{$options{$listkey}};
my $N = @in / 2;
my @out;
for my $i (0..$N-1)
{
my $key = $in[2*$i];
my $value = $in[2*$i + 1];
for my $key_new (split('\s*,\s*', $key))
{
push @out, $key_new, $value;
}
}
@{$options{$listkey}} = @out;
}
# If we're plotting histograms, then set the default histogram options for # If we're plotting histograms, then set the default histogram options for
# each histogram curve # each histogram curve
# #
@ -786,7 +805,7 @@ sub mainThread
# we persist gnuplot, so we shouldn't need this sleep. However, once # we persist gnuplot, so we shouldn't need this sleep. However, once
# gnuplot exits, but the persistent window sticks around, you can no # gnuplot exits, but the persistent window sticks around, you can no
# longer interactively zoom the plot. So we still sleep # longer interactively zoom the plot. So we still sleep
sleep(100000) unless $options{dump} || $options{exit}; sleep(100000000) unless $options{dump} || $options{exit};
} }
sub pruneOldData sub pruneOldData
@ -1279,7 +1298,9 @@ This command causes feedgnuplot to exit.
The script is able to produce hardcopy output with C<--hardcopy outputfile>. The The script is able to produce hardcopy output with C<--hardcopy outputfile>. The
output type can be inferred from the filename, if B<.ps>, B<.eps>, B<.pdf>, output type can be inferred from the filename, if B<.ps>, B<.eps>, B<.pdf>,
B<.svg> or B<.png> is requested. If any other file type is requested, B<.svg> or B<.png> is requested. If any other file type is requested,
C<--terminal> I<must> be passed in to tell gnuplot how to make the plot. C<--terminal> I<must> be passed in to tell gnuplot how to make the plot. If
C<--terminal> is passed in, then the C<--hardcopy> argument only provides the
output filename.
=head2 Self-plotting data files =head2 Self-plotting data files
@ -1548,9 +1569,10 @@ report 0 or 1. 'cumulative' is the integral of the 'frequency' histogram.
C<--style curveID style> C<--style curveID style>
Additional styles per curve. With C<--dataid>, curveID is the ID. Otherwise, Additional styles per curve. With C<--dataid>, curveID is the ID. Otherwise,
it's the index of the curve, starting at 0. Use this option multiple times for it's the index of the curve, starting at 0. curveID can be a comma-separated
multiple curves. C<--styleall> does I<not> apply to curves that have a list of IDs to which the given style should apply. Use this option multiple
C<--style> times for multiple curves. C<--styleall> does I<not> apply to curves that have a
C<--style>.
=item =item
@ -1653,16 +1675,17 @@ For 3D plots, set square aspect ratio for ONLY the x,y axes
C<--hardcopy xxx> C<--hardcopy xxx>
If not streaming, output to a file specified here. Format inferred from If not streaming, output to a file specified here. Format inferred from
filename, unless specified by C<--terminal> filename, unless specified by C<--terminal>. If C<--terminal> is given,
C<--hardcopy> sets I<only> the output filename.
=item =item
C<--terminal xxx> C<--terminal xxx>
String passed to 'set terminal'. No attempts are made to validate this. String passed to 'set terminal'. No attempts are made to validate this.
C<--hardcopy> sets this to some sensible defaults if --hardcopy is given .png, C<--hardcopy> sets this to some sensible defaults if C<--hardcopy> is set to a
.pdf, .ps, .eps or .svg. If any other file type is desired, use both filename ending in C<.png>, C<.pdf>, C<.ps>, C<.eps> or C<.svg>. If any other
C<--hardcopy> and C<--terminal> file type is desired, use both C<--hardcopy> and C<--terminal>
=item =item
@ -1695,6 +1718,10 @@ 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 of a point for a particular curve. This overrides any defaults that may exist
for this curve only. for this curve only.
With C<--dataid>, curveID is the ID. Otherwise, it's the index of the curve,
starting at 0. curveID can be a comma-separated list of IDs to which the given
rangesize should apply.
=item =item
C<--rangesizeall xxx> C<--rangesizeall xxx>
@ -1856,6 +1883,19 @@ in a Thinkpad.
--binwidth 10 --binwidth 10
--ymin 0 --xlabel 'File size (MB)' --ylabel Frequency --ymin 0 --xlabel 'File size (MB)' --ylabel Frequency
=head2 Plotting points on top of an existing image
This can be done by using C<--equation> to pass arbitrary plot input to gnuplot:
$ < features_xy.data
feedgnuplot --points --domain
--equation '"image.png" binary filetype=png flipy with rgbimage'
Here an existing image is given to gnuplot verbatim, and data to plot on top of
it is interpreted by feedgnuplot as usual. C<flipy> is useful here because
usually the y axis points up, but when looking at images, this is usually
reversed: the origin is the top-left pixel.
=head1 ACKNOWLEDGEMENT =head1 ACKNOWLEDGEMENT
This program is originally based on the driveGnuPlots.pl script from This program is originally based on the driveGnuPlots.pl script from