From ed99cd89d1786bf51b30db931216d6a1afb3c8a6 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Wed, 2 Mar 2022 19:27:33 -0800 Subject: [PATCH 1/5] Added --cblabel to label the color bar --- bin/feedgnuplot | 9 ++++++--- completions/bash/feedgnuplot | 1 + completions/zsh/_feedgnuplot | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index e5e7ccf..2199578 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -115,11 +115,12 @@ sub interpretCommandline '3d!', 'colormap!', 'lines!', 'points!', 'circles', 'legend=s{2}', 'autolegend!', - 'xlabel=s', 'x2label=s', 'ylabel=s', 'y2label=s', 'zlabel=s', + 'xlabel=s', 'x2label=s', 'ylabel=s', 'y2label=s', 'zlabel=s', 'cblabel=s', 'title=s', 'xlen=f', 'xmin=s', 'xmax=s', 'x2min=s', 'x2max=s', 'ymin=f', 'ymax=f', 'y2min=f', 'y2max=f', 'zmin=f', 'zmax=f', + 'cbmin=f', 'cbmax=f', 'x2=s@', 'y2=s@', 'x1y2=s@', 'x2y1=s@', 'x2y2=s@', 'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s', 'extracmds=s@', 'cmds=s@', @@ -796,6 +797,7 @@ sub mainThread print(PIPE "set ylabel \"$options{ylabel }\"\n") if defined $options{ylabel}; print(PIPE "set y2label \"$options{y2label}\"\n") if defined $options{y2label}; print(PIPE "set zlabel \"$options{zlabel }\"\n") if defined $options{zlabel}; + print(PIPE "set cblabel \"$options{cblabel}\"\n") if defined $options{cblabel}; print(PIPE "set title \"$options{title }\"\n") if defined $options{title}; if($options{square}) @@ -2003,10 +2005,11 @@ instance C<--set 'xrange [20:10]'> to set the given inverted bounds. =item -C<--xlabel/x2label/ylabel/y2label/zlabel xxx> +C<--xlabel/x2label/ylabel/y2label/zlabel/cblabel xxx> Label the given axis. The x2/y2-axis labels do not apply to 3d plots while the -z-axis label applies I to 3d plots. +z-axis label applies I to 3d plots. The "cblabel" applies to the colorbar, +if there is one. =item diff --git a/completions/bash/feedgnuplot b/completions/bash/feedgnuplot index 4b7d992..1c80bb4 100644 --- a/completions/bash/feedgnuplot +++ b/completions/bash/feedgnuplot @@ -66,6 +66,7 @@ complete -W \ --zlabel \ --zmax \ --zmin \ + --cblabel \ --xticlabels \ --using \ --usingall \ diff --git a/completions/zsh/_feedgnuplot b/completions/zsh/_feedgnuplot index 624c921..3380417 100644 --- a/completions/zsh/_feedgnuplot +++ b/completions/zsh/_feedgnuplot @@ -14,6 +14,7 @@ _arguments -S '--ylabel:Y-axis label:' \ '--y2label:Y2-axis label:' \ '--zlabel:Z-axis label:' \ + '--cblabel:Colorbar label:' \ '--title:Plot title:' \ '--autolegend[Label each plot with its data ID]' \ '(--3d)--xlen[the size of the x-window to plot]:window size:' \ From c99b377083800adbebd3306498253a3eedae8351 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Wed, 2 Mar 2022 19:32:19 -0800 Subject: [PATCH 2/5] --zmin,--zmax,--zlabel are sent if requested I don't try to figure out if they make sense or not: gnuplot can do that --- bin/feedgnuplot | 9 --------- 1 file changed, 9 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 2199578..aaaf08c 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -423,15 +423,6 @@ sub interpretCommandline exit -1; } - if(!$options{colormap}) - { - if ( defined $options{zmin} || defined $options{zmax} || defined $options{zlabel} ) - { - print STDERR "--zmin/zmax/zlabel only makes sense with --3d or --colormap\n"; - exit -1; - } - } - if ( defined $options{square_xy} ) { print STDERR "--square_xy only makes sense with --3d\n"; From 8c0f3df285e3ba443c2e0256c94edaff16fc80e8 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Wed, 2 Mar 2022 19:38:44 -0800 Subject: [PATCH 3/5] Added --cbmin, --cbmax These are used unless --colormap. Added more docs to describe what --colormap does. It is legacy. --- bin/feedgnuplot | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index aaaf08c..bac9666 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -881,7 +881,15 @@ sub mainThread sendRangeCommand( "xrange", $options{xmin}, $options{xmax} ); sendRangeCommand( "yrange", $options{ymin}, $options{ymax} ); sendRangeCommand( "zrange", $options{zmin}, $options{zmax} ); - sendRangeCommand( "cbrange", $options{zmin}, $options{zmax} ) if($options{colormap}); + if($options{colormap}) + { + # legacy behavior. Nobody should really be using --colormap + sendRangeCommand( "cbrange", $options{zmin}, $options{zmax} ); + } + else + { + sendRangeCommand( "cbrange", $options{cbmin},$options{cbmax}); + } # add the extra global options print(PIPE "$_\n") foreach (@{$options{extracmds}}); @@ -1917,9 +1925,16 @@ Interpret the X data as a time/date, parsed with the given format C<--colormap> -Show a colormapped xy plot. Requires extra data for the color. zmin/zmax can be -used to set the extents of the colors. Automatically sets the -C<--rangesize>/C<--tuplesize>. +This is a legacy option used to who a colormapped xy plot. It does: + +- Adds C to C<--curvestyleall> + +- Adds 1 to the default C<--tuplesize> (if C<--tuplesizeall> is not given + +- Uses C<--zmin>, C<--zmax> to set the colorbar range + +It's clearer to set the relevant options explicitly, but C<--colormap> still +exists for compatibility =item From fce128aa14a9646415772dfb35728892b5b5937b Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 4 Mar 2022 14:40:13 -0800 Subject: [PATCH 4/5] Plotting with no STDIN data works This command now works: echo "" | ./bin/feedgnuplot --equation 'x' --image /tmp/1.jpg Prior to the patch, there's a trailing , in the command --- bin/feedgnuplot | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index bac9666..ffc3a66 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -1177,9 +1177,10 @@ sub plotStoredData my @nonemptyCurves = grep { $_->{datastring} } @curves; my @extraopts = map {$_->{options}} @nonemptyCurves; - my $body = join('', map { "$_," } @{$options{equation}}); - $body .= join(', ' , map({ "'-' $_" } @extraopts) ); - $body .= join('', map { ",$_" } @{$options{'equation-above'}}); + my @components = (@{$options{equation}}, + map({ "'-' $_" } @extraopts), + @{$options{'equation-above'}}); + my $body = join(',', @components); if($options{'3d'}) { print PIPE "splot $body\n"; } else { print PIPE "plot $body\n"; } From db4fdcb9331e0b4783fd8b2842dc77913db35b73 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 4 Mar 2022 14:45:49 -0800 Subject: [PATCH 5/5] changelog bump --- Changes | 10 ++++++++++ bin/feedgnuplot | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index ca25466..16f82cd 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,13 @@ +feedgnuplot (1.61) + + * #! line uses /usr/bin/env to work with nonstandard installations + * Added --cblabel to label the color bar + * Added --cbmin, --cbmax + * --zmin,--zmax,--zlabel are always sent, if requested + * Plotting with no STDIN data works + + -- Dima Kogan Fri, 04 Mar 2022 14:45:36 -0800 + feedgnuplot (1.60) * Test suite fix: we have the right number of tests diff --git a/bin/feedgnuplot b/bin/feedgnuplot index ffc3a66..37002ab 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -16,7 +16,7 @@ use Pod::Usage; use Time::Piece; # Makefile.PL assumes this is in '' -my $VERSION = '1.60'; +my $VERSION = '1.61'; my %options; interpretCommandline();