3 XY datasets to plot:
A) Function plot XY
B) Polynomial, shares X with function, Y is poly_eval(x)
C) Polynomial_error; X, Y=poly(x) - fct(x)
Range X: ]0.0 .. 1.0[ (full range 0->1 plus some extra, both sides
Range Y: ]0.0 .. 1.0[
Wanted: All 3, XY datasets to plot auto-scaled as if it were the ONLY dataset.
Expect: "Small", whitespace above/below
Error data spanning entire Y range, not ~0 range near Y=0
Result: Y Range [-10 .. 10]
Error line is flat line in the middle of the graph with ~0 content.
In the entire 20 unit Y range, only [0 .. 1] has any data, so 95% is blank space.
IDEAL "Auto" scaling: Support "standard deviation" scaling where a few "outlying" data points will be pushed off the graph to better show the bulk of the data.
Case in point: Error XY data. On the extreme ends, Y error values are gigantic compared to the average, some 14 sigmas out. The auto scaling squashes the 98% of data to within a pixel of zero.
If I calculate the standard deviation and manually set yrange=>[$ylo, $yhi] to something like average +- 1 sigma, it looks informative.
Is there any way to get REASONABLE-SCALE other than max/min or order of magnitude AUTOSCALE?
#!/usr/local/bin/perl -w
use PDL::IO::Misc;
use PDL::Graphics::Gnuplot;
use PDL::Fit::Polynomial;
use PDL::Core;
use List::Util qw(max min);
for($mi=0; $mi < scalar @mxa; $mi++) {
@xara = @{$mxa[$mi]}; # @MXA => Array of @xara
@yara = @{$mya[$mi]}; # @MYA => Array of @yara
$px = pdl(\@xara);
$py = pdl(\@yara);
if($mi > 0) {
$pw->replot(with=>"lines", linewidth=>5, $px, $py); # autoscale=>'',
next;
}
# Use autoscale=>'' to "set [autoscale] all the axes at once"
$pw=gpwin("png", output=>"$imgfn", size=>[$pxres,$pyres,'px'],font=>"=11");
$pw->plot(title=>"$title", xrange=>[$xlo, $xhi], xlab=>"$xlbl",
ylab=>["$ylbl", "offset 1"], autoscale=>'',
with=>"lines", linewidth=>5, linetype=>2, linestyle=>1, $px, $py);
} # End For MI