mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 08:55:37 +00:00
Plot: more ways to plot data
This commit is contained in:
parent
cebf2334fa
commit
6202ed4518
55
lib/Plot.cpp
55
lib/Plot.cpp
@ -112,6 +112,61 @@ PlotHeadCommand::PlotHeadCommand(const string &command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PlotData constructor ////////////////////////////////////////////////////////
|
// PlotData constructor ////////////////////////////////////////////////////////
|
||||||
|
PlotData::PlotData(const DMatSample &x, const DMatSample &y)
|
||||||
|
{
|
||||||
|
if (x[central].rows() != y[central].rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "x and y vector does not have the same size");
|
||||||
|
}
|
||||||
|
|
||||||
|
DMat d(x[central].rows(), 4);
|
||||||
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
|
d.col(0) = x[central];
|
||||||
|
d.col(2) = y[central];
|
||||||
|
d.col(1) = x.variance().cwiseSqrt();
|
||||||
|
d.col(3) = y.variance().cwiseSqrt();
|
||||||
|
tmpFileName = dumpToTmpFile(d);
|
||||||
|
pushTmpFile(tmpFileName);
|
||||||
|
setCommand("'" + tmpFileName + "' u 1:3:2:4 w xyerr");
|
||||||
|
}
|
||||||
|
|
||||||
|
PlotData::PlotData(const DVec &x, const DMatSample &y)
|
||||||
|
{
|
||||||
|
if (x.rows() != y[central].rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "x and y vector does not have the same size");
|
||||||
|
}
|
||||||
|
|
||||||
|
DMat d(x.rows(), 3);
|
||||||
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
|
d.col(0) = x;
|
||||||
|
d.col(1) = y[central];
|
||||||
|
d.col(2) = y.variance().cwiseSqrt();
|
||||||
|
tmpFileName = dumpToTmpFile(d);
|
||||||
|
pushTmpFile(tmpFileName);
|
||||||
|
setCommand("'" + tmpFileName + "' u 1:2:3 w yerr");
|
||||||
|
}
|
||||||
|
|
||||||
|
PlotData::PlotData(const DMatSample &x, const DVec &y)
|
||||||
|
{
|
||||||
|
if (x[central].rows() != y.rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "x and y vector does not have the same size");
|
||||||
|
}
|
||||||
|
|
||||||
|
DMat d(x[central].rows(), 3), xerr, yerr;
|
||||||
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
|
d.col(0) = x[central];
|
||||||
|
d.col(2) = y;
|
||||||
|
d.col(1) = x.variance().cwiseSqrt();
|
||||||
|
tmpFileName = dumpToTmpFile(d);
|
||||||
|
pushTmpFile(tmpFileName);
|
||||||
|
setCommand("'" + tmpFileName + "' u 1:3:2 w xerr");
|
||||||
|
}
|
||||||
|
|
||||||
PlotData::PlotData(const XYStatData &data, const Index i, const Index j)
|
PlotData::PlotData(const XYStatData &data, const Index i, const Index j)
|
||||||
{
|
{
|
||||||
DMat d(data.getNData(), 4);
|
DMat d(data.getNData(), 4);
|
||||||
|
@ -88,6 +88,9 @@ class PlotData: public PlotObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
|
PlotData(const DMatSample &x, const DMatSample &y);
|
||||||
|
PlotData(const DVec &x, const DMatSample &y);
|
||||||
|
PlotData(const DMatSample &x, const DVec &y);
|
||||||
PlotData(const XYStatData &data, const Index i = 0, const Index j = 0);
|
PlotData(const XYStatData &data, const Index i = 0, const Index j = 0);
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~PlotData(void) = default;
|
virtual ~PlotData(void) = default;
|
||||||
|
Loading…
Reference in New Issue
Block a user