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))
def test_colormap(self): self.figs.append( dcs.plot_correlation_matrix(self.data, colormap='seismic_r'))
def test_within_minus_one(self): large_data = self.data - 0.5 self.figs.append(dcs.plot_correlation_matrix(large_data, self.labels))
def test_above_one_part2(self): large_data = self.data * 1000 self.figs.append( dcs.plot_correlation_matrix(large_data, self.labels, cmax=2000))
def test_symmetric(self): self.figs.append(dcs.plot_correlation_matrix(self.sym))
def test_type(self): self.figs.append( dcs.plot_correlation_matrix(self.data, type_=self.type_))
def test_nonsquare(self): self.figs.append(dcs.plot_correlation_matrix(self.data[:5, :3], [self.labels[:3], \ self.labels[:5]]))
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)
def test_symmetric_all(self): self.figs.append(dcs.plot_correlation_matrix(self.sym, plot_lower_only=False))
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))
def test_type(self): self.figs.append(dcs.plot_correlation_matrix(self.data, type_=self.type_))
def test_default_labels(self): self.figs.append(dcs.plot_correlation_matrix(self.data[:5, :3]))
def test_normal(self): self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels))
def test_x_label_rotation(self): self.figs.append( dcs.plot_correlation_matrix(self.data, self.labels, x_lab_rot=0))
def test_bad_labels(self): with self.assertRaises(ValueError): self.figs.append(dcs.plot_correlation_matrix(self.data, ['a']))
def test_above_one_part2(self): large_data = self.data * 1000 self.figs.append(dcs.plot_correlation_matrix(large_data, self.labels, cmax=2000))
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))
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))
def test_symmetric_all(self): self.figs.append( dcs.plot_correlation_matrix(self.sym, plot_lower_only=False))
def test_colormap(self): self.figs.append(dcs.plot_correlation_matrix(self.data, colormap='seismic_r'))
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))
def test_ylabel(self): self.figs.append(dcs.plot_correlation_matrix(self.data, ylabel='Testing Label'))
def test_x_label_rotation(self): self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels, x_lab_rot=0))
def test_nans(self): self.data[0, 0] = np.nan self.figs.append(dcs.plot_correlation_matrix(self.data, self.labels))
def test_ylabel(self): self.figs.append( dcs.plot_correlation_matrix(self.data, ylabel='Testing Label'))
def test_label_values(self): self.figs.append(dcs.plot_correlation_matrix(self.data, label_values=True))
def test_label_values(self): self.figs.append( dcs.plot_correlation_matrix(self.data, label_values=True))
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)