1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

band plot does not rely anymore on tac & tail -r commands

This commit is contained in:
Antonin Portelli 2020-01-28 17:34:00 +00:00
parent f826f30e82
commit 1bde8822b1

View File

@ -236,14 +236,21 @@ PlotFunction::PlotFunction(const DoubleFunction &function, const double xMin,
// PlotPredBand constructor //////////////////////////////////////////////////// // PlotPredBand constructor ////////////////////////////////////////////////////
void PlotPredBand::makePredBand(const DMat &low, const DMat &high, const double opacity) void PlotPredBand::makePredBand(const DMat &low, const DMat &high, const double opacity)
{ {
string lowFileName, highFileName; string lowFileName, highFileName, contFileName;
DMat contour(low.rows() + high.rows() + 1, 2);
lowFileName = dumpToTmpFile(low); FOR_MAT(low, i, j)
highFileName = dumpToTmpFile(high); {
pushTmpFile(lowFileName); contour(i, j) = low(i, j);
pushTmpFile(highFileName); }
setCommand("'< (cat " + lowFileName + "; tac " + highFileName + FOR_MAT(high, i, j)
"; head -n1 " + lowFileName + ")' u 1:2 w filledcurves closed" + {
contour(low.rows() + i, j) = high(high.rows() - i - 1, j);
}
contour.row(low.rows() + high.rows()) = low.row(0);
contFileName = dumpToTmpFile(contour);
pushTmpFile(contFileName);
setCommand("'" + contFileName + "' u 1:2 w filledcurves closed" +
" fs solid " + strFrom(opacity) + " noborder"); " fs solid " + strFrom(opacity) + " noborder");
} }