mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
latan-plot now takes extra option: spacing between data points, adjustable plot range
This commit is contained in:
parent
36fb53b0f6
commit
125ad02159
@ -17,13 +17,18 @@ int main(int argc, char *argv[])
|
|||||||
OptParser opt;
|
OptParser opt;
|
||||||
bool parsed;
|
bool parsed;
|
||||||
string plotFileName, outFileName, xName, yName, title;
|
string plotFileName, outFileName, xName, yName, title;
|
||||||
|
double xLow, xHigh, spacing;
|
||||||
|
|
||||||
opt.addOption("o", "output", OptParser::OptType::value , true,
|
opt.addOption("o", "output", OptParser::OptType::value , true,
|
||||||
"output file", "");
|
"output file", "");
|
||||||
opt.addOption("x", "xAxis", OptParser::OptType::value , true,
|
opt.addOption("x", "xAxis", OptParser::OptType::value , true,
|
||||||
"x-axis name", "");
|
"x-axis name", "");
|
||||||
|
opt.addOption("l", "xLow", OptParser::OptType::value , true,
|
||||||
|
"x-axis lower bound", "0");
|
||||||
opt.addOption("y", "yAxis", OptParser::OptType::value , true,
|
opt.addOption("y", "yAxis", OptParser::OptType::value , true,
|
||||||
"y-axis name", "");
|
"y-axis name", "");
|
||||||
|
opt.addOption("s", "spacing", OptParser::OptType::value , true,
|
||||||
|
"spacing between points", "1");
|
||||||
opt.addOption("t", "title", OptParser::OptType::value , true,
|
opt.addOption("t", "title", OptParser::OptType::value , true,
|
||||||
"plot title", "");
|
"plot title", "");
|
||||||
opt.addOption("", "help" , OptParser::OptType::trigger, true,
|
opt.addOption("", "help" , OptParser::OptType::trigger, true,
|
||||||
@ -38,10 +43,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
plotFileName = opt.getArgs()[0];
|
plotFileName = opt.getArgs()[0];
|
||||||
xName = opt.optionValue("x");
|
xName = opt.optionValue("x");
|
||||||
|
xLow = opt.optionValue<double>("l");
|
||||||
yName = opt.optionValue("y");
|
yName = opt.optionValue("y");
|
||||||
|
spacing = opt.optionValue<double>("s");
|
||||||
title = opt.optionValue("t");
|
title = opt.optionValue("t");
|
||||||
// corrFileName = opt.getArgs()[1];
|
|
||||||
// corr0FileName = opt.getArgs()[2];
|
|
||||||
outFileName = opt.optionValue<string>("o");
|
outFileName = opt.optionValue<string>("o");
|
||||||
|
|
||||||
// load file /////////////////////////////////////////////////////////
|
// load file /////////////////////////////////////////////////////////
|
||||||
@ -57,11 +62,11 @@ int main(int argc, char *argv[])
|
|||||||
Plot p;
|
Plot p;
|
||||||
DVec tAxis;
|
DVec tAxis;
|
||||||
|
|
||||||
tAxis.setLinSpaced(nt, 0, nt-1);
|
xHigh= xLow+spacing*(nt-1);
|
||||||
|
tAxis.setLinSpaced(nt, xLow, xHigh);
|
||||||
p << Label(xName, Axis::x);
|
p << Label(xName, Axis::x);
|
||||||
p << Label(yName, Axis::y);
|
p << Label(yName, Axis::y);
|
||||||
p << PlotRange(Axis::x, 0, nt);
|
p << PlotRange(Axis::x, xLow, xHigh);
|
||||||
p << PlotRange(Axis::y, -0.1, 0.1);
|
|
||||||
p << Color("rgb 'red'") << PlotData(tAxis, tmp);
|
p << Color("rgb 'red'") << PlotData(tAxis, tmp);
|
||||||
p << Caption(title);
|
p << Caption(title);
|
||||||
p.display();
|
p.display();
|
||||||
|
Loading…
Reference in New Issue
Block a user