mirror of
				https://github.com/aportelli/LatAnalyze.git
				synced 2025-11-04 08:04:32 +00:00 
			
		
		
		
	external tool to plot correlation heatmap
This commit is contained in:
		@@ -18,6 +18,7 @@ bin_PROGRAMS =            \
 | 
			
		||||
    latan_create_rg_state \
 | 
			
		||||
    latan_make_fake_sample\
 | 
			
		||||
    latan_sample_combine  \
 | 
			
		||||
    latan_sample_plot_corr\
 | 
			
		||||
    latan_sample_read     \
 | 
			
		||||
    latan_resample
 | 
			
		||||
 | 
			
		||||
@@ -33,6 +34,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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										51
									
								
								utils/sample_plot_corr.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								utils/sample_plot_corr.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <LatAnalyze/Io.hpp>
 | 
			
		||||
#include <LatAnalyze/Math.hpp>
 | 
			
		||||
#include <LatAnalyze/Plot.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
using namespace Latan;
 | 
			
		||||
using namespace Math;
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
    if (argc != 2)
 | 
			
		||||
    {
 | 
			
		||||
        cerr << "usage: " << argv[0] << " <file>" << 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<DMatSample>(fileName);
 | 
			
		||||
    var    = sample.varianceMatrix();
 | 
			
		||||
    p << PlotMatrix(varToCorr(var));
 | 
			
		||||
    p.display();
 | 
			
		||||
    
 | 
			
		||||
    return EXIT_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user