diff --git a/lib/Plot.hpp b/lib/Plot.hpp index bea3d92..95b3308 100644 --- a/lib/Plot.hpp +++ b/lib/Plot.hpp @@ -149,7 +149,7 @@ public: #define PlotMatrix(m)\ PlotRange(Axis::x, -.5, (m).cols() - .5) <<\ -PlotRange(Axis::y, -.5, (m).rows() - .5) <<\ +PlotRange(Axis::y, (m).rows() - .5, -.5) <<\ PlotMatrixNoRange(m) /****************************************************************************** diff --git a/utils/Makefile.am b/utils/Makefile.am index 83648cc..6dcb7cd 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -10,6 +10,7 @@ bin_PROGRAMS = \ latan_create_rg_state \ latan_make_fake_sample\ latan_sample_combine \ + latan_sample_plot_corr\ latan_sample_read \ latan_resample @@ -25,6 +26,10 @@ latan_sample_combine_SOURCES = sample_combine.cpp latan_sample_combine_CXXFLAGS = $(COM_CXXFLAGS) latan_sample_combine_LDFLAGS = -L../lib/.libs -lLatAnalyze +latan_sample_plot_corr_SOURCES = sample_plot_corr.cpp +latan_sample_plot_corr_CXXFLAGS = $(COM_CXXFLAGS) +latan_sample_plot_corr_LDFLAGS = -L../lib/.libs -lLatAnalyze + latan_sample_read_SOURCES = sample_read.cpp latan_sample_read_CXXFLAGS = $(COM_CXXFLAGS) latan_sample_read_LDFLAGS = -L../lib/.libs -lLatAnalyze diff --git a/utils/sample_plot_corr.cpp b/utils/sample_plot_corr.cpp new file mode 100644 index 0000000..2f540f5 --- /dev/null +++ b/utils/sample_plot_corr.cpp @@ -0,0 +1,51 @@ +/* + * sample_plot_corr.cpp, part of LatAnalyze 3 + * + * Copyright (C) 2013 - 2016 Antonin Portelli + * + * LatAnalyze 3 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LatAnalyze 3 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LatAnalyze 3. If not, see . + */ + +#include +#include +#include +#include + +using namespace std; +using namespace Latan; +using namespace Math; + +int main(int argc, char *argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " " << endl; + + return EXIT_FAILURE; + } + + string fileName = argv[1], name; + DMatSample sample; + DMat var; + Plot p; + + cout << "-- computing variance matrix from '" << fileName << "'..." << endl; + name = Io::getFirstName(fileName); + sample = Io::load(fileName); + var = sample.varianceMatrix(); + p << PlotMatrix(varToCorr(var)); + p.display(); + + return EXIT_SUCCESS; +}