diff --git a/bin/feedGnuplot b/bin/feedGnuplot index 28cea9e..2f363fb 100755 --- a/bin/feedGnuplot +++ b/bin/feedGnuplot @@ -121,8 +121,10 @@ As an example, if line 3 of the input is "0 9 1 20" --title xxx Set the title of the plot - --legend xxx Set the label for a curve plot. Give this option multiple - times for multiple curves + --legend curveID=legend + Set the label for a curve plot. Use this option multiple times + for multiple curves. With --dataid, curveID is the ID. Otherwise, + it's the index of the curve, starting at 0 --autolegend Use the curve IDs for the legend. Titles given with --legend override these @@ -146,8 +148,10 @@ As an example, if line 3 of the input is "0 9 1 20" Without --dataid, the ID is just an ordered 0-based index. Does not apply to 3d plots. - --curvestyle xxx Additional style per curve. Give this option multiple - times for multiple curves + --curvestyle curveID=style + Additional styles per curve. With --dataid, curveID is the + ID. Otherwise, it's the index of the curve, starting at 0. Use + this option multiple times for multiple curves --curvestyleall xxx Additional styles for ALL curves. @@ -207,9 +211,9 @@ OEF $options{ maxcurves } = 100; GetOptions($options, 'stream!', 'domain!', 'dataid!', '3d!', 'colormap!', 'lines!', 'points!', - 'circles', 'legend=s@', 'autolegend!', 'xlabel=s', 'ylabel=s', 'y2label=s', 'zlabel=s', + 'circles', 'legend=s%', 'autolegend!', 'xlabel=s', 'ylabel=s', 'y2label=s', 'zlabel=s', 'title=s', 'xlen=f', 'ymin=f', 'ymax=f', 'xmin=f', 'xmax=f', 'y2min=f', 'y2max=f', - 'zmin=f', 'zmax=f', 'y2=s@', 'curvestyle=s@', 'curvestyleall=s', 'extracmds=s@', + 'zmin=f', 'zmax=f', 'y2=s@', 'curvestyle=s%', 'curvestyleall=s', 'extracmds=s@', 'size=s', 'square!', 'square_xy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'extraValuesPerPoint=i', 'help', 'dump') or die($usage); @@ -426,20 +430,18 @@ sub mainThread # For the specified values, set the legend entries to 'title "blah blah"' if($options{legend}) { - my $id = 0; - foreach (@{$options{legend}}) + foreach my $id (keys %{$options{legend}}) { - setCurveLabel($id++, $_); + setCurveLabel($id, $options{legend}{$id}); } } # add the extra curve options if($options{curvestyle}) { - my $id = 0; - foreach (@{$options{curvestyle}}) + foreach my $id (keys %{$options{curvestyle}}) { - addCurveOption($id++, $_); + addCurveOption($id, $options{curvestyle}{$id}); } } @@ -701,7 +703,7 @@ Simple plotting of stored data: 10 25 $ seq 5 | awk '{print 2*$1, $1*$1}' | - feedGnuplot --lines --points --legend "data 0" --title "Test plot" --y2 1 + feedGnuplot --lines --points --legend 0="data 0" --title "Test plot" --y2 1 Simple real-time plotting example: plot how much data is received on the wlan0 network interface in bytes/second (uses bash, awk and Linux): @@ -731,9 +733,9 @@ 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 extrastyle>. Pass these -more than once to affect more than one curve. To apply an extra style to I -the curves, pass in C<--curvestyleall extrastyle>. +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, pass in C<--curvestyleall extrastyle>. =head2 Data formats