#include "../Test.h"
class PlotTestCase : public Test
{
bool TestPlot() {
Plot plot(
"Comparison of approximation with true value");
plot();
return true;
}
bool TestScatterPlot() {
ScatterPlot plot2(
"Test Scatter Plot: 2 Support Values");
plot2.
AddData(X, Y,
"support values");
plot2();
return true;
}
bool TestFunctionPlot() {
FunctionPlot plot3([](
const double& in) {
return in * in; },
"Function Plot: x^2");
plot3.
AddData(-5, 5, 0.1,
"support values");
plot3.xAxis("X");
plot3.yAxis("Y");
plot3();
return true;
}
bool TestSurfacePlot() {
plot.
AddData(dat,
"some data", DataTypes::LINE,
nullptr, 3);
plot();
return true;
}
bool TestImagePlot() {
for(size_t i = 0; i < 10; ++i) {
for(size_t j = 0; j < 10; ++j) {
if(i <= 5 && j <= 5) { in(i, j) = 0.5; }
if(i > 5 && j > 5) { in(i, j) = 1.0; }
}
}
plot();
return true;
}
public:
virtual void run() {
TestPlot();
TestScatterPlot();
TestFunctionPlot();
TestImagePlot();
TestSurfacePlot();
TestImagePlot();
}
};
int main() { PlotTestCase().run(); }
void AddData(const double &start, const double &end, const double &stepSize, const char *name)
Definition: Plot.h:389
void AddData(const Matrix< double > &mat, const std::string &name)
Definition: Plot.h:451
Definition: SupportValues.h:133
virtual Matrix< double > Evaluate(const Matrix< double > &in) const
Definition: SupportValues.h:173
constexpr Matrix< T > Transpose() const
Definition: Matrix.h:256
Matrix< T > Apply(const std::function< T(T)> &fun) const
Definition: Matrix.h:375
void AddData(const Matrix< double > &x, const Matrix< double > &y, const std::string &name, DataTypes dataType=DataTypes::NONE, const char *character=nullptr)
Definition: Plot.h:182
void yAxis(const std::string &name)
Definition: Plot.h:155
void xAxis(const std::string &name)
Definition: Plot.h:145
void pointSize(const int &size)
Definition: Plot.h:165
Matrix< T > HorizontalConcat(const Matrix< T > &lhs, const Matrix< T > &rhs)
Definition: matrix_utils.h:81
Matrix< double > ones(size_t rows, size_t columns=1, size_t elements=1)
Matrix< double > zeros(size_t rows, size_t columns, size_t elements=1)
Matrix< double > linspace(double start, double end, unsigned long num_elements)