From 20e9adbae49eb62572d83dac723e974160be05e1 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 24 Jan 2014 14:39:34 -0800 Subject: [PATCH] added "set" and "unset" options --- bin/feedgnuplot | 44 ++++++++++++++++++++++++++---------- completions/bash/feedgnuplot | 2 ++ completions/zsh/_feedgnuplot | 2 ++ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 4ee506a..c36094c 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -113,12 +113,14 @@ sub interpretCommandline $options{histogram} = []; $options{y2} = []; $options{extracmds} = []; + $options{set} = []; + $options{unset} = []; GetOptions(\%options, 'stream:s', 'domain!', 'dataid!', '3d!', 'colormap!', 'lines!', 'points!', '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', 'zmin=f', 'zmax=f', 'y2=s@', - 'curvestyle=s{2}', 'curvestyleall=s', 'extracmds=s@', + 'curvestyle=s{2}', 'curvestyleall=s', 'extracmds=s@', 'set=s@', 'unset=s@', 'square!', 'square_xy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s', 'histogram=s@', 'binwidth=f', 'histstyle=s', 'terminal=s', @@ -531,6 +533,8 @@ sub mainThread # add the extra global options print(PIPE "$_\n") foreach (@{$options{extracmds}}); + print(PIPE "set $_\n") foreach (@{$options{set}}); + print(PIPE "unset $_\n") foreach (@{$options{unset}}); # set up histograms $options{binwidth} ||= 1; # if no binwidth given, set it to 1 @@ -1014,14 +1018,15 @@ plotting. Input parsing is flexible; every line need not have the same number of points. New curves will be created as needed. The most commonly used functionality of gnuplot is supported directly by the -script. Anything not directly supported can still be done with the -C<--extracmds> and C<--curvestyle> options. Arbitrary gnuplot commands can be -passed in with C<--extracmds>. For example, to turn off the grid, pass in -C<--extracmds 'unset grid'>. As many of these options as needed can be passed -in. To add arbitrary curve styles, use C<--curvestyle curveID extrastyle>. Pass -these more than once to affect more than one curve. To apply an extra style to -I the curves that lack an explicit C<--curvestyle>, pass in -C<--curvestyleall extrastyle>. +script. Anything not directly supported can still be done with options such as +C<--set>, C<--extracmds> C<--curvestyle>, etc. Arbitrary gnuplot commands can be +passed in with C<--extracmds>. For example, to turn off the grid, you can pass +in C<--extracmds 'unset grid'>. Commands C<--set> and C<--unset> exists to +provide nicer syntax, so this is equivalent to passing C<--unset grid>. As many +of these options as needed can be passed in. To add arbitrary curve styles, use +C<--curvestyle curveID extrastyle>. Pass these more than once to affect more +than one curve. To apply an extra style to I the curves that lack an +explicit C<--curvestyle>, pass in C<--curvestyleall extrastyle>. =head2 Data formats @@ -1118,7 +1123,7 @@ C<--timefmt>. Example: awk '$1 ~ /..:..:../ && $8 ~/^[0-9\.]*$/ {print $1,$8; fflush()}' | feedgnuplot --stream --domain --lines --timefmt '%H:%M:%S' - --extracmds 'set format x "%H:%M:%S"' + --set 'format x "%H:%M:%S"' This plots the 'idle' CPU consumption against time. @@ -1458,8 +1463,23 @@ Additional styles for all curves that have no --curvestyle --extracmds xxx -Additional commands. These could contain extra global styles for instance. Can -be passed multiple times. +Additional commands to pass on to gnuplot verbatim. These could contain extra +global styles for instance. Can be passed multiple times. + +=item + +--set xxx + +Additional 'set' commands to pass on to gnuplot verbatim. C<--set 'a b c'> will +result in gnuplot seeing a C command. Can be passed multiple times. + +=item + +--unset xxx + +Additional 'unset' commands to pass on to gnuplot verbatim. C<--unset 'a b c'> +will result in gnuplot seeing a C command. Can be passed multiple +times. =item diff --git a/completions/bash/feedgnuplot b/completions/bash/feedgnuplot index c0614f1..9ac627c 100644 --- a/completions/bash/feedgnuplot +++ b/completions/bash/feedgnuplot @@ -13,6 +13,8 @@ complete -W \ --exit \ --extraValuesPerPoint \ --extracmds \ + --set \ + --unset \ --geometry \ --hardcopy \ --help \ diff --git a/completions/zsh/_feedgnuplot b/completions/zsh/_feedgnuplot index fbc1a42..6c1ebec 100644 --- a/completions/zsh/_feedgnuplot +++ b/completions/zsh/_feedgnuplot @@ -28,6 +28,8 @@ _arguments -S '*--y2:plot to place on the Y2 axis:' \ '--curvestyleall[Additional styles for ALL curves]:style' \ '*--extracmds[Additional gnuplot commands]:command' \ + '*--set[Additional 'set' gnuplot commands]:set-option' \ + '*--unset[Additional 'unset' gnuplot commands]:unset-option' \ '--square[Plot data with square aspect ratio]' \ '--square_xy[For 3D plots, set square aspect ratio for ONLY the x,y axes]' \ '--hardcopy[Plot to a file]:filename' \