Example #1
0
    def test_simple_plot2(self):
        '''
		Test the capability of plotting a simple loadings plot for original variables and the principal components (using a numpy array)
		'''

        output_file = os.path.join(self.out_dir, 'loadings_plot2.png')

        try:
            _ = gs.loadings_plot(self.loadmat.values, output_file=output_file)

        except Exception as ex:
            self.fail(
                'Unable to test the loadings_plot with simple settings (using a numpy array)\n{}'
                .format(str(ex)))

        self.assertEqual(os.path.isfile(output_file), True)
Example #2
0
    def test_with_labels(self):
        '''
		Test the capability of plotting a loadings plot with detailed settings for original variables and the principal components
		'''

        output_file = os.path.join(self.out_dir, 'loadings_plot3.png')

        try:
            _ = gs.loadings_plot(self.loadmat.values,
                                 figsize=(4, 4),
                                 xticklabels=['PC1', 'PC2', 'PC3'],
                                 yticklabels=[
                                     'InputVariable1', 'InputVariable2',
                                     'InputVariable3'
                                 ],
                                 output_file=output_file)

        except Exception as ex:
            self.fail(
                'Unable to test the loadings_plot with  tick labels and figsize\n{}'
                .format(str(ex)))

        self.assertEqual(os.path.isfile(output_file), True)
import pygeostat as gs
data_file = gs.ExampleData('3d_correlation')
loadmat = data_file.data.corr().iloc[3:6,6:9]
gs.loadings_plot(loadmat.values, figsize=(5,5), xticklabels=['PC1', 'PC2', 'PC3'], yticklabels=['InputVariable1', 'InputVariable2', 'InputVariable3'])