From f01431dd1e5bb4817abcc84519107a82178cf090 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 22 Jan 2016 00:48:59 -0800 Subject: [PATCH 01/11] removed unneeded old code --- bin/feedgnuplot | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 9789769..af71a35 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -605,11 +605,6 @@ sub mainThread setCurveAsHistogram( $_ ) foreach (@{$options{histogram}}); - # 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 - # gnuplot - print PIPE "set xtics\n"; - if(@{$options{y2}}) { print PIPE "set ytics nomirror\n"; From f8ed4615712ab4f2dc8576a9ccb1baa05496c7ff Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Mon, 11 Jul 2016 10:11:06 -0700 Subject: [PATCH 02/11] No enhanced text mode in hardcopies, slightly larger font size --- bin/feedgnuplot | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index af71a35..d4ffd0e 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -497,11 +497,11 @@ sub mainThread } my %terminalOpts = - ( eps => 'postscript solid color enhanced eps', - ps => 'postscript solid color landscape 10', - pdf => 'pdfcairo solid color font ",10" size 11in,8.5in', - png => 'png size 1280,1024', - svg => 'svg'); + ( eps => 'postscript noenhanced solid color enhanced eps', + ps => 'postscript noenhanced solid color landscape 12', + pdf => 'pdfcairo noenhanced solid color font ",12" size 11in,8.5in', + png => 'png noenhanced size 1280,1024', + svg => 'svg noenhanced'); if( !defined $options{terminal} && defined $outputfileType && From 18994e68e18ce7a5694614fe0ecd6eea0eb4e182 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Wed, 27 Jul 2016 22:16:34 -0700 Subject: [PATCH 03/11] version bump --- Changes | 8 ++++++++ bin/feedgnuplot | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 34cb996..472f367 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,11 @@ +feedgnuplot (1.38) + + * hardcopy defaults: + - no enhanced text mode + - larger font size + + -- Dima Kogan Wed, 27 Jul 2016 22:15:11 -0700 + feedgnuplot (1.37) * At the end of a streaming plot, include the last chunk of data diff --git a/bin/feedgnuplot b/bin/feedgnuplot index d4ffd0e..44393cb 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -14,7 +14,7 @@ use Text::ParseWords; # for shellwords use Pod::Usage; use Time::Piece; -my $VERSION = 1.37; +my $VERSION = 1.38; my %options; interpretCommandline(); From cacbedb336edac788f0a71afcaea78990306d2b6 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Wed, 27 Jul 2016 23:08:22 -0700 Subject: [PATCH 04/11] added sample rpm spec file --- feedgnuplot.spec | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 feedgnuplot.spec diff --git a/feedgnuplot.spec b/feedgnuplot.spec new file mode 100644 index 0000000..d972b1e --- /dev/null +++ b/feedgnuplot.spec @@ -0,0 +1,58 @@ +# Sample spec file for rpm-based systems. Debian-based systems already have this +# packaged, so we do not ship those here + +Name: feedgnuplot +Version: 1.38 +Release: 1%{?dist} +Summary: Pipe-oriented frontend to Gnuplot +BuildArch: noarch + +License: Artistic or GPL-1+ +URL: https://www.github.com/dkogan/feedgnuplot/ +Source0: https://www.github.com/dkogan/feedgnuplot/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz + +BuildRequires: /usr/bin/pod2html +BuildRequires: perl-String-ShellQuote +BuildRequires: perl-ExtUtils-MakeMaker +BuildRequires: perl +BuildRequires: gawk +BuildRequires: gnuplot +BuildRequires: perl-IPC-Run + +Requires: gnuplot + +%description +Flexible, command-line-oriented frontend to Gnuplot. Creates plots from data +coming in on STDIN or given in a filename passed on the commandline. Various +data representations are supported, as is hardcopy output and streaming display +of live data. + +%prep +%setup -q + +%build +perl Makefile.PL INSTALLDIRS=vendor +make +pod2html --title=feedgnuplot bin/feedgnuplot > feedgnuplot.html + +%install +make install DESTDIR=%{buildroot} PREFIX=/usr + +mkdir -p %{buildroot}%{_defaultdocdir}/%{name} +cp Changes LICENSE feedgnuplot.html %{buildroot}%{_defaultdocdir}/%{name} + +mkdir -p %{buildroot}%{_datadir}/zsh/site-functions +cp completions/zsh/* %{buildroot}%{_datadir}/zsh/site-functions + +mkdir -p %{buildroot}%{_datadir}/bash-completion/completions +cp completions/bash/* %{buildroot}%{_datadir}/bash-completion/completions + +rm -rf %{buildroot}/usr/lib64 + + +%files +%{_bindir}/* +%{_datadir}/zsh/* +%{_datadir}/bash-completion/* +%doc %{_defaultdocdir}/%{name}/* +%doc %{_mandir} From 9e669044c70bfb235d63c5652aa4e56cb9f852f9 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Thu, 8 Sep 2016 23:02:31 -0700 Subject: [PATCH 05/11] can now ask for fnormal histograms --- bin/feedgnuplot | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 44393cb..8edfd09 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -333,9 +333,9 @@ sub interpretCommandline # --xlen implies an order to the data, so I force monotonicity $options{monotonic} = 1 if defined $options{xlen}; - if( $options{histstyle} !~ /freq|cum|uniq|cnorm/ ) + if( $options{histstyle} !~ /freq|cum|uniq|cnorm|fnorm/ ) { - print STDERR "unknown histstyle. Allowed are 'freq...', 'cum...', 'uniq...', 'cnorm...'\n"; + print STDERR "unknown histstyle. Allowed are 'freq...', 'fnorm...', 'cum...', 'uniq...', 'cnorm...'\n"; exit -1; } @@ -1539,14 +1539,11 @@ C<--histstyle style> Normally, histograms are generated with the 'smooth frequency' gnuplot style. C<--histstyle> can be used to select different C settings (see the gnuplot C page for more info). Allowed values are 'frequency' (the -default), 'unique', 'cumulative' and 'cnormal'. 'unique' indicates whether a bin -has at least one item in it: instead of counting the items, it'll always report -0 or 1. 'cumulative' is the integral of the 'frequency' histogram. 'cnormal' is -like 'cumulative', but rescaled to end up at 1.0. Note that there's no -normalized 'frequency' option because gnuplot does not provide one. - - -C +default), 'fnormal' (available in very recent gnuplots), 'unique', 'cumulative' +and 'cnormal'. 'fnormal' is a normalized histogram. 'unique' indicates whether a +bin has at least one item in it: instead of counting the items, it'll always +report 0 or 1. 'cumulative' is the integral of the 'frequency' histogram. +'cnormal' is like 'cumulative', but rescaled to end up at 1.0. =item From d4ca90e1bdf0f9ac2462e9e96a6d2a41965fb85c Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 15 Oct 2016 20:07:57 -0700 Subject: [PATCH 06/11] minor simplification curvestyle_hash doesn't really exist anymore --- bin/feedgnuplot | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 8edfd09..940ae42 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -571,9 +571,7 @@ sub mainThread if(@{$options{curvestyle}}) { # @{$options{curvestyle}} is a list where consecutive pairs are (curveID, - # style). I use $options{curvestyle} here instead of - # $options{curvestyle_hash} because I create a new curve when I see a new - # one, and the hash is unordered, thus messing up the ordering + # style). my $n = scalar @{$options{curvestyle}}/2; foreach my $idx (0..$n-1) { @@ -846,19 +844,6 @@ sub updateCurveOptions { $title = $id; } my $titleoption = defined $title ? "title \"$title\"" : "notitle"; - - my ($curvestyleall); - if( defined $options{curvestyle_hash}{$id} ) - { - # I have a curve-specific style set with --curvestyle. This style lives in - # $curve->{extraoptions}, and it overrides the global styles - $curvestyleall = ''; - } - else - { - $curvestyleall = $options{curvestyleall}; - } - my $histoptions = $curve->{histoptions} || ''; my $usingoptions = ''; @@ -879,7 +864,7 @@ sub updateCurveOptions $usingoptions = "using 1:" . join(':', @rest); } - $curve->{options} = "$histoptions $usingoptions $titleoption $curve->{extraoptions} $curvestyleall"; + $curve->{options} = "$histoptions $usingoptions $titleoption $curve->{extraoptions} $options{curvestyleall}"; } sub getCurve From 5123ca73d3eda279260b14420f56c4823e28700d Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 15 Oct 2016 20:14:33 -0700 Subject: [PATCH 07/11] minor simplification I delete the style and styleall options after I use them. This is defensive and clarifies the intent --- bin/feedgnuplot | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 940ae42..020707b 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -138,17 +138,13 @@ sub interpretCommandline # --curvestyleall, so fill that in if( $options{styleall} ) { - if($options{curvestyleall} ) - { - $options{curvestyleall} .= " $options{styleall}"; - } - else - { - $options{curvestyleall} = $options{styleall}; - } + if($options{curvestyleall} ) { $options{curvestyleall} .= " $options{styleall}"; } + else { $options{curvestyleall} = $options{styleall}; } + delete $options{styleall}; } - push @{$options{curvestyle}}, @{$options{style}}; + push @{$options{curvestyle}}, @{$options{style}}; + delete $options{style}; # --legend and --curvestyle options are conceptually hashes, but are parsed as # arrays in order to preserve the ordering. I parse both of these into hashes From 167e85d2a7bf6f0aef7f88518c076f1511c372ad Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 15 Oct 2016 20:17:08 -0700 Subject: [PATCH 08/11] minor simplification I delete the with option after I use it. This is defensive and clarifies the intent --- bin/feedgnuplot | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 020707b..bbe2673 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -146,6 +146,17 @@ sub interpretCommandline push @{$options{curvestyle}}, @{$options{style}}; delete $options{style}; + if( $options{curvestyleall} && $options{with} ) + { + print STDERR "--curvestyleall and --with are mutually exclusive. Please just use one.\n"; + exit -1; + } + if( $options{with} ) + { + $options{curvestyleall} = "with $options{with}"; + delete $options{with}; + } + # --legend and --curvestyle options are conceptually hashes, but are parsed as # 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 @@ -227,17 +238,6 @@ sub interpretCommandline } } - if( $options{curvestyleall} && $options{with} ) - { - print STDERR "--curvestyleall and --with are mutually exclusive. Please just use one.\n"; - exit -1; - } - if( $options{with} ) - { - $options{curvestyleall} = "with $options{with}"; - $options{with} = ''; - } - if ($options{colormap}) { # colormap styles all curves with palette. Seems like there should be a way to do this with a From 4f9adb6e112da1c9c87345964b095f0bd7538592 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 15 Oct 2016 20:35:48 -0700 Subject: [PATCH 09/11] histograms have the correct default style --- bin/feedgnuplot | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index bbe2673..7ca231f 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -8,7 +8,7 @@ use Getopt::Long; use Time::HiRes qw( usleep gettimeofday tv_interval ); use IO::Handle; use IO::Select; -use List::Util qw( first ); +use List::Util qw( first any ); use Scalar::Util qw( looks_like_number ); use Text::ParseWords; # for shellwords use Pod::Usage; @@ -157,6 +157,23 @@ sub interpretCommandline delete $options{with}; } + # If we're plotting histograms, then set the default histogram options for + # each histogram curve + # + # Apply this to plain (non-cumulative) histograms + if( !$options{curvestyleall} && $options{histstyle} =~ /freq|fnorm/ ) + { + for my $hist_curve(@{$options{histogram}}) + { + # If we don't specify any options specifically for this histogram, use + # the defaults: filled boxes with borders + if( !any { $options{curvestyle}[$_*2] eq $hist_curve } 0..(@{$options{curvestyle}}/2 - 1) ) + { + push @{$options{curvestyle}}, ($hist_curve, 'with boxes fill solid border lt -1'); + } + } + } + # --legend and --curvestyle options are conceptually hashes, but are parsed as # 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 @@ -1497,11 +1514,11 @@ passing something like C<--histogram curveID> - Set up a this specific curve to plot a histogram. The bin width is given with -the C<--binwidth> option (assumed 1.0 if omitted). C<--histogram> does I -touch the drawing style. It is often desired to plot these with boxes, and this -I be explicitly requested by C<--with boxes>. This works with C<--domain> +the C<--binwidth> option (assumed 1.0 if omitted). If a drawing style is not +specified for this curve (C<--curvestyle>) or all curves (C<--with>, +C<--curvestyleall>) then the default histogram style is set: filled boxes with +borders. This is what the user generally wants. This works with C<--domain> and/or C<--stream>, but in those cases the x-value is used I to cull old data because of C<--xlen> or C<--monotonic>. I.e. the x-values are I drawn in any way. Can be passed multiple times, or passed a comma- separated list @@ -1835,8 +1852,8 @@ in a Thinkpad. =head2 Plotting a histogram of file sizes in a directory, granular to 10MB $ ls -l | awk '{print $5/1e6}' | - feedgnuplot --histogram 0 --with boxes - --binwidth 10 --set 'style fill solid' + feedgnuplot --histogram 0 + --binwidth 10 --ymin 0 --xlabel 'File size (MB)' --ylabel Frequency =head1 ACKNOWLEDGEMENT From 3860d8281b07e0cbc3640778830ad3d1ab224541 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 15 Oct 2016 20:42:27 -0700 Subject: [PATCH 10/11] version bump --- bin/feedgnuplot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 7ca231f..d04626d 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -14,7 +14,7 @@ use Text::ParseWords; # for shellwords use Pod::Usage; use Time::Piece; -my $VERSION = 1.38; +my $VERSION = 1.39; my %options; interpretCommandline(); From 4958bda9123ed25f95bad3ef3a5cb2670eba1e40 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 15 Oct 2016 20:50:58 -0700 Subject: [PATCH 11/11] version bump --- Changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changes b/Changes index 472f367..8ec9e2f 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +feedgnuplot (1.39) + + * by default, histograms are plotted in expected ways + + -- Dima Kogan Sat, 15 Oct 2016 20:45:15 -0700 + feedgnuplot (1.38) * hardcopy defaults: