mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-05 22:11:12 +08:00
added --equation-above and --equation-below
This commit is contained in:
parent
3c8c84ed59
commit
5a608b72b9
@ -99,6 +99,8 @@ sub interpretCommandline
|
||||
$options{set} = [];
|
||||
$options{unset} = [];
|
||||
$options{equation} = [];
|
||||
$options{'equation-below'} = [];
|
||||
$options{'equation-above'} = [];
|
||||
|
||||
$options{curvestyleall} = '';
|
||||
$options{styleall} = '';
|
||||
@ -120,7 +122,7 @@ sub interpretCommandline
|
||||
'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s', 'extracmds=s@', 'set=s@', 'unset=s@',
|
||||
'every=s{2}', 'everyall=s',
|
||||
'square!', 'square_xy!', 'square-xy!', 'squarexy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s',
|
||||
'equation=s@',
|
||||
'equation=s@', 'equation-below=s@', 'equation-above=s@',
|
||||
'image=s',
|
||||
'histogram=s@', 'binwidth=f', 'histstyle=s',
|
||||
'terminal=s',
|
||||
@ -503,6 +505,10 @@ sub interpretCommandline
|
||||
unshift @{$options{equation}}, qq{"$options{image}" binary filetype=auto flipy with rgbimage title "$options{image}"};
|
||||
delete $options{image};
|
||||
}
|
||||
|
||||
# --equation-below is a synonym of --equation
|
||||
push @{$options{equation}}, @{$options{'equation-below'}};
|
||||
@{$options{'equation-below'}} = [];
|
||||
}
|
||||
|
||||
sub getGnuplotVersion
|
||||
@ -1157,6 +1163,7 @@ sub plotStoredData
|
||||
|
||||
my $body = join('', map { "$_," } @{$options{equation}});
|
||||
$body .= join(', ' , map({ "'-' $_" } @extraopts) );
|
||||
$body .= join('', map { ",$_" } @{$options{'equation-above'}});
|
||||
|
||||
if($options{'3d'}) { print PIPE "splot $body\n"; }
|
||||
else { print PIPE "plot $body\n"; }
|
||||
@ -2079,6 +2086,8 @@ the y-axis extents are not specified (C<--ymin>, C<--ymax>, C<--set 'yrange
|
||||
properly. Since this option is just a passthrough to gnuplot, finer control can
|
||||
be achieved by passing in C<--equation> and C<--set yrange ...> directly.
|
||||
|
||||
=item
|
||||
|
||||
C<--equation xxx>
|
||||
|
||||
Gnuplot can plot both data and symbolic equations. C<feedgnuplot> generally
|
||||
@ -2107,6 +2116,18 @@ points, and I I<also> plot a true circle as a parametric equation.
|
||||
|
||||
=item
|
||||
|
||||
C<--equation-below xxx>
|
||||
|
||||
Synonym for C<--equation>. These are rendered I<below> all the other data.
|
||||
|
||||
=item
|
||||
|
||||
C<--equation-above xxx>
|
||||
|
||||
Like C<--equation>, but is rendered I<on top> of all the other data.
|
||||
|
||||
=item
|
||||
|
||||
C<--square>
|
||||
|
||||
Plot data with aspect ratio 1. For 3D plots, this controls the aspect ratio for
|
||||
|
@ -25,6 +25,8 @@ complete -W \
|
||||
--set \
|
||||
--unset \
|
||||
--equation \
|
||||
--equation-below \
|
||||
--equation-above \
|
||||
--image \
|
||||
--geometry \
|
||||
--hardcopy \
|
||||
|
@ -39,6 +39,8 @@ _arguments -S
|
||||
'*--set[Additional 'set' gnuplot commands]:set-option' \
|
||||
'*--unset[Additional 'unset' gnuplot commands]:unset-option' \
|
||||
'*--equation[Raw symbolic equation]:equation' \
|
||||
'*--equation-below[Raw symbolic equation]:equation' \
|
||||
'*--equation-above[Raw symbolic equation to plot on top]:equation' \
|
||||
'--image[Image file to render beneath the data]:image:_files -g "(#i)*.(jpg|jpeg|png|gif)"' \
|
||||
'--square[Plot data with square aspect ratio]' \
|
||||
'--square-xy[For 3D plots, set square aspect ratio for ONLY the x,y axes]' \
|
||||
|
11
t/plots.t
11
t/plots.t
@ -39,7 +39,7 @@ BEGIN {
|
||||
}
|
||||
}
|
||||
|
||||
use Test::More tests => 82;
|
||||
use Test::More tests => 84;
|
||||
use File::Temp 'tempfile';
|
||||
use IPC::Run 'run';
|
||||
use String::ShellQuote;
|
||||
@ -279,6 +279,15 @@ tryplot( testname => 'xticlabels styles with tuplesize',
|
||||
'--ymax', '6'],
|
||||
refplot => 'xticlabels-styles-with-tuplesize.ref' );
|
||||
|
||||
tryplot( testname => 'equations',
|
||||
cmd => qq{seq 10 15},
|
||||
options => [qw(--equation x),
|
||||
qw(--equation-above x+1),
|
||||
qw(--equation-below x-1),
|
||||
'--with', 'boxes fill solid border lt -1',
|
||||
'--ymin', '0'],
|
||||
refplot => 'equations.ref' );
|
||||
|
||||
SKIP:
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user