mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-06 06:21:16 +08:00
I can now have more than one value for a point. This is useful for colors, point sizes, error bars, etc
This commit is contained in:
parent
400ed04b31
commit
f30a842af6
@ -118,6 +118,14 @@ As an example, if line 3 of the input is "0 9 1 20"
|
|||||||
data is kept. Does not make sense with 3d plots.
|
data is kept. Does not make sense with 3d plots.
|
||||||
No --monotonic by default.
|
No --monotonic by default.
|
||||||
|
|
||||||
|
--extraValuesPerPoint xxx
|
||||||
|
How many extra values are given for each data point. Normally this
|
||||||
|
is 0, and does not need to be specified, but sometimes we want
|
||||||
|
extra data, like for colors or point sizes or error bars, etc.
|
||||||
|
Feedgnuplot options that require this (colormap, circles) are
|
||||||
|
automatically set. This option is ONLY needed if unknown styles are used,
|
||||||
|
with --curvestyleall for instance
|
||||||
|
|
||||||
--dump Instead of printing to gnuplot, print to STDOUT. For
|
--dump Instead of printing to gnuplot, print to STDOUT. For
|
||||||
debugging.
|
debugging.
|
||||||
OEF
|
OEF
|
||||||
@ -171,6 +179,7 @@ GetOptions(\%options,
|
|||||||
'hardcopy=s',
|
'hardcopy=s',
|
||||||
'maxcurves=i',
|
'maxcurves=i',
|
||||||
'monotonic!',
|
'monotonic!',
|
||||||
|
'extraValuesPerPoint=i',
|
||||||
'help',
|
'help',
|
||||||
'dump') or die($usage);
|
'dump') or die($usage);
|
||||||
|
|
||||||
@ -288,6 +297,9 @@ sub plotThread
|
|||||||
|
|
||||||
sub mainThread
|
sub mainThread
|
||||||
{
|
{
|
||||||
|
my $valuesPerPoint = 1;
|
||||||
|
if($options{extraValuesPerPoint}) { $valuesPerPoint += $options{extraValuesPerPoint}; }
|
||||||
|
|
||||||
local *PIPE;
|
local *PIPE;
|
||||||
my $dopersist = '';
|
my $dopersist = '';
|
||||||
|
|
||||||
@ -415,6 +427,12 @@ sub mainThread
|
|||||||
|
|
||||||
# regexp for a possibly floating point, possibly scientific notation number
|
# regexp for a possibly floating point, possibly scientific notation number
|
||||||
my $numRE = '[-]?[\d\.]+(?:e[-+]?\d+)?';
|
my $numRE = '[-]?[\d\.]+(?:e[-+]?\d+)?';
|
||||||
|
|
||||||
|
# a point may be preceded by an id
|
||||||
|
my $pointRE = $options{dataid} ? '(\w+)\s+' : '()';
|
||||||
|
$pointRE .= '(' . join('\s+', ($numRE) x $valuesPerPoint) . ')';
|
||||||
|
$pointRE = qr/$pointRE/;
|
||||||
|
|
||||||
my @domain;
|
my @domain;
|
||||||
my $haveNewData;
|
my $haveNewData;
|
||||||
|
|
||||||
@ -460,26 +478,15 @@ sub mainThread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($options{dataid})
|
my $id = -1;
|
||||||
|
while (/$pointRE/go)
|
||||||
{
|
{
|
||||||
while(/(\w+)\s+($numRE)/go)
|
if($1 ne '') {$id = $1;}
|
||||||
{
|
else {$id++; }
|
||||||
my $point = $2;
|
|
||||||
|
|
||||||
$haveNewData = 1;
|
$haveNewData = 1;
|
||||||
pushPoint(getCurve($1),
|
pushPoint(getCurve($id),
|
||||||
[@domain, $point]);
|
[@domain, split( /\s+/, $2)]);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
my $id = 0;
|
|
||||||
foreach my $point (/$numRE/go)
|
|
||||||
{
|
|
||||||
$haveNewData = 1;
|
|
||||||
pushPoint(getCurve($id++),
|
|
||||||
[@domain, $point]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user