diff --git a/Changes b/Changes index 6d275a4..4ec0603 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +feedgnuplot (1.53) + + * Full support for all 4 axes. Added --x2... + + -- Dima Kogan Wed, 08 Jan 2020 18:55:29 -0800 + feedgnuplot (1.52) * Added --squarexy and --square-xy as synonyms to --square_xy diff --git a/bin/feedgnuplot b/bin/feedgnuplot index c3c6a37..b5672ed 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.52'; +my $VERSION = '1.53'; my %options; interpretCommandline(); @@ -91,7 +91,9 @@ sub interpretCommandline $options{curvestyle} = []; $options{style} = []; $options{histogram} = []; - $options{y2} = []; + $options{x1y2} = []; + $options{x2y1} = []; + $options{x2y2} = []; $options{extracmds} = []; $options{set} = []; $options{unset} = []; @@ -105,9 +107,12 @@ sub interpretCommandline $options{tuplesize} = []; GetOptions(\%options, 'stream:s', 'domain!', 'dataid!', 'vnlog!', '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@', + 'circles', 'legend=s{2}', 'autolegend!', 'xlabel=s', 'x2label=s', 'ylabel=s', 'y2label=s', 'zlabel=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', + 'x2=s@', 'y2=s@', 'x1y2=s@', 'x2y1=s@', 'x2y2=s@', 'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s', 'extracmds=s@', 'set=s@', 'unset=s@', 'square!', 'square_xy!', 'square-xy!', 'squarexy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s', 'equation=s@', @@ -168,7 +173,7 @@ sub interpretCommandline } # expand options that are given as comma-separated lists - for my $listkey (qw(histogram y2)) + for my $listkey (qw(histogram x2 y2 x1y2 x2y1 x2y2)) { @{$options{$listkey}} = map split('\s*,\s*', $_), @{$options{$listkey}} if defined $options{$listkey}; @@ -192,6 +197,11 @@ sub interpretCommandline @{$options{$listkey}} = @out; } + # handle x2 == x2y1 and y2 == x1y2 + push @{$options{x2y1}}, @{$options{x2}} if defined $options{x2}; + push @{$options{x1y2}}, @{$options{y2}} if defined $options{y2}; + $options{x2} = []; + $options{y2} = []; # convert all tuplesize business to rangesize my $domainsize = $options{'3d'} ? 2 : 1; @@ -351,9 +361,11 @@ sub interpretCommandline exit -1; } - if ( defined $options{y2min} || defined $options{y2max} || @{$options{y2}} ) + if ( defined $options{x2min} || defined $options{x2max} || + defined $options{y2min} || defined $options{y2max} || + @{$options{x1y2}} || @{$options{x2y1}} || @{$options{x2y2}} ) { - print STDERR "--3d does not make sense with --y2...\n"; + print STDERR "--3d does not make sense with --x2... or --y2...\n"; exit -1; } @@ -749,9 +761,10 @@ sub mainThread print PIPE "set grid\n"; print(PIPE "set xlabel \"$options{xlabel }\"\n") if defined $options{xlabel}; + print(PIPE "set x2label \"$options{x2label}\"\n") if defined $options{x2label}; print(PIPE "set ylabel \"$options{ylabel }\"\n") if defined $options{ylabel}; - print(PIPE "set zlabel \"$options{zlabel }\"\n") if defined $options{zlabel}; 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 title \"$options{title }\"\n") if defined $options{title}; if($options{square}) @@ -800,8 +813,9 @@ sub mainThread } } - # For the values requested to be printed on the y2 axis, set that - addCurveOption($_, 'axes x1y2') foreach (@{$options{y2}}); + addCurveOption($_, 'axes x1y2') foreach (@{$options{x1y2}}); + addCurveOption($_, 'axes x2y1') foreach (@{$options{x2y1}}); + addCurveOption($_, 'axes x2y2') foreach (@{$options{x2y2}}); # timefmt if( $options{timefmt} ) @@ -818,7 +832,14 @@ sub mainThread setCurveAsHistogram( $_ ) foreach (@{$options{histogram}}); - if(@{$options{y2}}) + if(@{$options{x2y1}} || @{$options{x2y2}}) + { + print PIPE "set xtics nomirror\n"; + print PIPE "set x2tics\n"; + # if any of the ranges are given, set the range + sendRangeCommand( "x2range", $options{x2min}, $options{x2max} ); + } + if(@{$options{x1y2}} || @{$options{x2y2}}) { print PIPE "set ytics nomirror\n"; print PIPE "set y2tics\n"; @@ -1369,6 +1390,7 @@ Simple plotting of piped data: 2 +-----------------------------------------------------------------+ 0 1 1.5 2 2.5 3 3.5 4 4.5 5 +Here we asked for ASCII plotting, which is useful for documentation. Simple real-time plotting example: plot how much data is received on the wlan0 network interface in bytes/second (uses bash, awk and Linux): @@ -1831,10 +1853,10 @@ plot I histograms or I I-histograms. =item -C<--xmin/xmax/ymin/ymax/y2min/y2max/zmin/zmax xxx> +C<--xmin/xmax/x2min/x2max/ymin/ymax/y2min/y2max/zmin/zmax xxx> Set the range for the given axis. These x-axis bounds are ignored in a streaming -plot. The y2-axis bound do not apply in 3d plots. The z-axis bounds apply +plot. The x2/y2-axis bounds do not apply in 3d plots. The z-axis bounds apply I to 3d plots or colormaps. Note that there is no C<--xrange> to set both sides at once or C<--xinv> to flip the axis around: anything more than the basics supported in this option is clearly obtainable by talking to gnuplot, for @@ -1842,23 +1864,29 @@ instance C<--set 'xrange [20:10]'> to set the given inverted bounds. =item -C<--xlabel/ylabel/y2label/zlabel xxx> +C<--xlabel/x2label/ylabel/y2label/zlabel xxx> -Label the given axis. The y2-axis label does not apply to 3d plots while the +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. =item -C<--y2 xxx> +C<--x2/--y2/--x1y2/--x2y1/--x2y2 xxx> -Plot the data specified by this curve ID on the y2 axis. Without C<--dataid>, -the ID is just an ordered 0-based index. Does not apply to 3d plots. Can be -passed multiple times, or passed a comma-separated list. By default the y2-axis -curves look the same as the y-axis ones. I.e. the viewer of the resulting plot -has to be told which is which via an axes label, legend, etc. Prior to version -1.25 of feedgnuplot the curves plotted on the y2 axis were drawn with a thicker -line. This is no longer the case, but that behavior can be brought back by -passing something like +By default data is plotted against the x1 and y1 axes (the left and bottom one +respectively). If we want a particular curve plotted against a different axis, +we can specify that with these options. You pass C<--AXIS ID> where C +defines the axis (C or C or C or C or C) and the C +is the curve ID. C<--x2> is a synonym for C<--x2y1> and C<--y2> is a synonym for +C<--x1y2>. The curve ID is an ordered 0-based index or a specific ID if +C<--dataid> or C<--vnlog>. None of these apply to 3d plots. Can be passed +multiple times for different curve IDs, multiple IDs can be passed in as a +comma-separated list. By default the curves plotted against the various axes +aren not drawn in any differentiated way: the viewer of the resulting plot has +to be told which is which via an axes label, legend, colors, etc. Prior to +version 1.25 of C the curves plotted on the y2 axis were drawn with +a thicker line. This is no longer the case, but that behavior can be brought +back by passing something like --y2 curveid --style curveid 'linewidth 3' diff --git a/completions/bash/feedgnuplot b/completions/bash/feedgnuplot index 0509c6e..9159551 100644 --- a/completions/bash/feedgnuplot +++ b/completions/bash/feedgnuplot @@ -17,6 +17,8 @@ complete -W \ --extraValuesPerPoint \ --rangesizeall \ --rangesize \ + --tuplesizeall \ + --tuplesize \ --extracmds \ --set \ --unset \ @@ -39,17 +41,25 @@ complete -W \ --timefmt \ --title \ --version \ + --x2 \ + --y2 \ + --x2y1 \ + --x1y2 \ + --x2y2 \ --xlabel \ --xlen \ --xmax \ --xmin \ - --y2 \ - --y2label \ - --y2max \ - --y2min \ + --x2label \ + --x2max \ + --x2min \ --ylabel \ --ymax \ --ymin \ + --y2label \ + --y2max \ + --y2min \ --zlabel \ --zmax \ - --zmin' feedgnuplot + --zmin \ + --vnlog ' feedgnuplot diff --git a/completions/zsh/_feedgnuplot b/completions/zsh/_feedgnuplot index 465a0f1..5daa270 100644 --- a/completions/zsh/_feedgnuplot +++ b/completions/zsh/_feedgnuplot @@ -10,22 +10,28 @@ _arguments -S '--points' \ '--circles' \ '--xlabel:X-axis label:' \ + '--x2label:X2-axis label:' \ '--ylabel:Y-axis label:' \ '--y2label:Y2-axis label:' \ '--zlabel:Z-axis label:' \ - '--zlabel:Z-axis label:' \ '--title:Plot title:' \ '--autolegend[Label each plot with its data ID]' \ '(--3d)--xlen[the size of the x-window to plot]:window size:' \ '(--xlen)--xmin:min X:' \ '(--xlen)--xmax:max X:' \ + '--x2min:min X2:' \ + '--x2max:max X2:' \ '--ymin:min Y:' \ '--ymax:max Y:' \ '--y2min:min Y2:' \ '--y2max:max Y2:' \ '--zmin:min Z:' \ '--zmax:max Z:' \ - '*--y2:plot to place on the Y2 axis:' \ + '*--x2:curve to place on the X2Y1 axis:' \ + '*--y2:curve to place on the X1Y2 axis:' \ + '*--x2y1:curve to place on the X2Y1 axis:' \ + '*--x1y2:curve to place on the X1Y2 axis:' \ + '*--x2y2:curve to place on the X2Y2 axis:' \ '(--with)--curvestyleall[Additional styles for ALL curves]:style' \ '(--with)--styleall[Additional styles for ALL curves]:style' \ '(--curvestyleall)--with[Additional styles for ALL curves]:style' \ @@ -42,6 +48,8 @@ _arguments -S '(--rangesizeall)--extraValuesPerPoint[How many extra values are given for each data range]:N'\ '(--extraValuesPerPoint)--rangesizeall[How many values are given for each data range]:N'\ '*--rangesize[How many values comprise a data range in this curve]:curve id: :N:' \ + '(--extraValuesPerPoint)--tuplesizeall[How many values are given for each data tuple]:N'\ + '*--tuplesize[How many values comprise a data tuple in this curve]:curve id: :N:' \ '--dump[Instead of printing to gnuplot, print to STDOUT]' \ '--geometry[The X11 geometry string]:geometry string:' \ '*--curvestyle[Additional styles for a curve]:curve id: :style:' \ @@ -54,4 +62,5 @@ _arguments -S '--exit[Exit gnuplot after making the plot]' \ '--version' \ '--help' \ - '--timefmt[Format for time/date data]:time format' + '--timefmt[Format for time/date data]:time format' \ + '--vnlog[column IDs come from a vnlog header]'