예제 #1
0
 def test_within_minus_one_part2(self):
     large_data = self.data - 0.5
     self.figs.append(
         dcs.plot_correlation_matrix(large_data,
                                     self.labels,
                                     cmin=-1,
                                     cmax=1))
예제 #2
0
 def test_colormap(self):
     self.figs.append(
         dcs.plot_correlation_matrix(self.data, colormap='seismic_r'))
예제 #3
0
 def test_within_minus_one(self):
     large_data = self.data - 0.5
     self.figs.append(dcs.plot_correlation_matrix(large_data, self.labels))
예제 #4
0
 def test_above_one_part2(self):
     large_data = self.data * 1000
     self.figs.append(
         dcs.plot_correlation_matrix(large_data, self.labels, cmax=2000))
예제 #5
0
 def test_symmetric(self):
     self.figs.append(dcs.plot_correlation_matrix(self.sym))
예제 #6
0
 def test_type(self):
     self.figs.append(
         dcs.plot_correlation_matrix(self.data, type_=self.type_))
예제 #7
0
 def test_nonsquare(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data[:5, :3], [self.labels[:3], \
         self.labels[:5]]))
예제 #8
0
import numpy as np
import dstauffman as dcs

#%% Main function
if __name__ == '__main__':

    #%% Create some fake data
    # random data
    data = np.random.rand(10, 10)
    # normalize the random data
    data = dcs.unit(data, axis=0)
    # labels for the plot
    labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    # make some symmetric data
    sym = data.copy()
    num = sym.shape[0]
    for j in range(num):
        for i in range(num):
            if i == j:
                sym[i, j] = 1
            elif i > j:
                sym[i, j] = data[j, i]
            else:
                pass
    # create opts
    opts = dcs.Opts()

    #%% Create the plots
    fig1 = dcs.plot_correlation_matrix(data, labels, opts=opts)
    fig2 = dcs.plot_correlation_matrix(sym, labels, opts=opts)
예제 #9
0
 def test_symmetric_all(self):
     self.figs.append(dcs.plot_correlation_matrix(self.sym, plot_lower_only=False))
예제 #10
0
 def test_symmetric(self):
     self.figs.append(dcs.plot_correlation_matrix(self.sym))
예제 #11
0
 def test_all_args(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels, self.type_, self.opts, \
         matrix_name=self.matrix_name, cmin=0, cmax=1, colormap='viridis', xlabel='', ylabel='', \
         plot_lower_only=False, label_values=True, x_lab_rot=180))
예제 #12
0
 def test_type(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, type_=self.type_))
예제 #13
0
 def test_default_labels(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data[:5, :3]))
예제 #14
0
 def test_nonsquare(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data[:5, :3], [self.labels[:3], \
         self.labels[:5]]))
예제 #15
0
 def test_normal(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels))
예제 #16
0
 def test_x_label_rotation(self):
     self.figs.append(
         dcs.plot_correlation_matrix(self.data, self.labels, x_lab_rot=0))
예제 #17
0
 def test_bad_labels(self):
     with self.assertRaises(ValueError):
         self.figs.append(dcs.plot_correlation_matrix(self.data, ['a']))
예제 #18
0
 def test_above_one_part2(self):
     large_data = self.data * 1000
     self.figs.append(dcs.plot_correlation_matrix(large_data, self.labels, cmax=2000))
예제 #19
0
 def test_normal(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels))
예제 #20
0
 def test_below_one_part2(self):
     large_data = 1000*(self.data - 0.5)
     self.figs.append(dcs.plot_correlation_matrix(large_data, self.labels, cmin=-2))
예제 #21
0
 def test_default_labels(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data[:5, :3]))
예제 #22
0
 def test_within_minus_one(self):
     large_data = self.data - 0.5
     self.figs.append(dcs.plot_correlation_matrix(large_data, self.labels))
예제 #23
0
 def test_all_args(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels, self.type_, self.opts, \
         matrix_name=self.matrix_name, cmin=0, cmax=1, colormap='viridis', xlabel='', ylabel='', \
         plot_lower_only=False, label_values=True, x_lab_rot=180))
예제 #24
0
 def test_within_minus_one_part2(self):
     large_data = self.data - 0.5
     self.figs.append(dcs.plot_correlation_matrix(large_data, self.labels, cmin=-1, cmax=1))
예제 #25
0
 def test_symmetric_all(self):
     self.figs.append(
         dcs.plot_correlation_matrix(self.sym, plot_lower_only=False))
예제 #26
0
 def test_colormap(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, colormap='seismic_r'))
예제 #27
0
 def test_below_one_part2(self):
     large_data = 1000 * (self.data - 0.5)
     self.figs.append(
         dcs.plot_correlation_matrix(large_data, self.labels, cmin=-2))
예제 #28
0
 def test_ylabel(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, ylabel='Testing Label'))
예제 #29
0
 def test_x_label_rotation(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels, x_lab_rot=0))
예제 #30
0
 def test_nans(self):
     self.data[0, 0] = np.nan
     self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels))
예제 #31
0
 def test_ylabel(self):
     self.figs.append(
         dcs.plot_correlation_matrix(self.data, ylabel='Testing Label'))
예제 #32
0
 def test_bad_labels(self):
     with self.assertRaises(ValueError):
         self.figs.append(dcs.plot_correlation_matrix(self.data, ['a']))
예제 #33
0
 def test_nans(self):
     self.data[0, 0] = np.nan
     self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels))
예제 #34
0
 def test_label_values(self):
     self.figs.append(dcs.plot_correlation_matrix(self.data, label_values=True))
예제 #35
0
 def test_label_values(self):
     self.figs.append(
         dcs.plot_correlation_matrix(self.data, label_values=True))
예제 #36
0
import numpy as np
import dstauffman as dcs

#%% Main function
if __name__=='__main__':

    #%% Create some fake data
    # random data
    data = np.random.rand(10, 10)
    # normalize the random data
    data = dcs.unit(data, axis=0)
    # labels for the plot
    labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    # make some symmetric data
    sym = data.copy()
    num = sym.shape[0]
    for j in range(num):
        for i in range(num):
            if i == j:
                sym[i, j] = 1
            elif i > j:
                sym[i, j] = data[j, i]
            else:
                pass
    # create opts
    opts = dcs.Opts()

    #%% Create the plots
    fig1 = dcs.plot_correlation_matrix(data, labels, opts=opts)
    fig2 = dcs.plot_correlation_matrix(sym, labels, opts=opts)