From b0877a89266f2497242f15c6452d2b27abc2c135 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 13:33:48 -0800 Subject: [PATCH 1/8] If the options couldn't be parsed I don't dump the whole manpage --- bin/feedgnuplot | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index d04626d..8965235 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -108,9 +108,7 @@ sub interpretCommandline 'terminal=s', 'rangesize=s{2}', 'rangesizeall=i', 'extraValuesPerPoint=i', 'help', 'dump', 'exit', 'version', - 'geometry=s') or pod2usage( -exitval => 1, - -verbose => 1, # synopsis and args - -output => \*STDERR ); + 'geometry=s') or exit 1; # handle various cmdline-option errors From 048b0db65c0db3edeb24e72e0902c430e8689a79 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 13:54:22 -0800 Subject: [PATCH 2/8] Slightly better docs --- bin/feedgnuplot | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 8965235..bf494ba 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -1277,7 +1277,9 @@ This command causes feedgnuplot to exit. 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>, B<.svg> or B<.png> is requested. If any other file type is requested, -C<--terminal> I be passed in to tell gnuplot how to make the plot. +C<--terminal> I 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 @@ -1651,16 +1653,17 @@ For 3D plots, set square aspect ratio for ONLY the x,y axes C<--hardcopy xxx> 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 the output filename. =item C<--terminal xxx> 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, -.pdf, .ps, .eps or .svg. If any other file type is desired, use both -C<--hardcopy> and C<--terminal> +C<--hardcopy> sets this to some sensible defaults if C<--hardcopy> is set to a +filename ending in C<.png>, C<.pdf>, C<.ps>, C<.eps> or C<.svg>. If any other +file type is desired, use both C<--hardcopy> and C<--terminal> =item From 5dce1d8cda5cd3e9b03f5370a7a62902116417c5 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 14:39:15 -0800 Subject: [PATCH 3/8] --style and --rangesize can now take a comma-separated list of IDs --- bin/feedgnuplot | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index bf494ba..9a2e940 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -125,13 +125,6 @@ sub interpretCommandline 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 # --curvestyleall, so fill that in if( $options{styleall} ) @@ -155,6 +148,33 @@ sub interpretCommandline 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 # each histogram curve # @@ -1548,9 +1568,10 @@ report 0 or 1. 'cumulative' is the integral of the 'frequency' histogram. C<--style curveID style> 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 -multiple curves. C<--styleall> does I apply to curves that have a -C<--style> +it's the index of the curve, starting at 0. curveID can be a comma-separated +list of IDs to which the given style should apply. Use this option multiple +times for multiple curves. C<--styleall> does I apply to curves that have a +C<--style>. =item @@ -1696,6 +1717,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 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 C<--rangesizeall xxx> From 07f574a9290db82243677dc949edb62a5e6120e5 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 14:39:22 -0800 Subject: [PATCH 4/8] added a new recipe --- bin/feedgnuplot | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 9a2e940..b9d874e 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -1882,6 +1882,19 @@ in a Thinkpad. --binwidth 10 --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 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 This program is originally based on the driveGnuPlots.pl script from From 35ed74eaf10b25e13e5b6f2f1a83d8f413fada01 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 14:41:39 -0800 Subject: [PATCH 5/8] 'any' is from List::MoreUtils, not List::Util --- Makefile.PL | 1 + bin/feedgnuplot | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.PL b/Makefile.PL index dd3ed3f..a02c839 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -64,6 +64,7 @@ WriteMakefile PL_FILES => {}, EXE_FILES => [ 'bin/feedgnuplot' ], BUILD_REQUIRES => { 'String::ShellQuote' => 0, + 'List::MoreUtils' => 0, 'IPC::Run' => 0}, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'feedgnuplot-*' }, diff --git a/bin/feedgnuplot b/bin/feedgnuplot index b9d874e..c432edf 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -8,7 +8,8 @@ use Getopt::Long; use Time::HiRes qw( usleep gettimeofday tv_interval ); use IO::Handle; 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 Text::ParseWords; # for shellwords use Pod::Usage; From 89a185f8a6abe327da16bcbf71a57fe5c3d91c5d Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 14:42:49 -0800 Subject: [PATCH 6/8] the sleep-forever delay at end is now > 1000 days --- bin/feedgnuplot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index c432edf..0ac2465 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -805,7 +805,7 @@ sub mainThread # we persist gnuplot, so we shouldn't need this sleep. However, once # gnuplot exits, but the persistent window sticks around, you can no # 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 From e17f110269082b841a9bf0b5b0a74d6eae700665 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 14:45:35 -0800 Subject: [PATCH 7/8] changelog bump --- Changes | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Changes b/Changes index 8ec9e2f..012010d 100644 --- a/Changes +++ b/Changes @@ -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 Fri, 25 Nov 2016 14:45:06 -0800 + feedgnuplot (1.39) * by default, histograms are plotted in expected ways From 888583abe9cba4707ba6819dcd2721646a72956b Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 25 Nov 2016 14:45:47 -0800 Subject: [PATCH 8/8] version bump --- bin/feedgnuplot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 0ac2465..ce3965a 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -15,7 +15,7 @@ use Text::ParseWords; # for shellwords use Pod::Usage; use Time::Piece; -my $VERSION = 1.39; +my $VERSION = 1.40; my %options; interpretCommandline();