def linear_regression_test(): x = np.linspace(0, 1, 100) y = 2 * x + 3 + np.random.normal(0, 0.3, len(x)) ax = plot.get_axis(preset='large') plot.linear_regression(x, y, ax=ax) ax = plot.get_axis(preset='medium') plot.linear_regression(x, y, regression=False, ax=ax)
def histogram_test(): iris = sns.load_dataset('iris') ax = plot.get_axis(preset='wide') plot.histogram(iris.sepal_length, bins=22, xlabel='Sepal Length', ylabel='Frequency', ax=ax)
def line_test(): fmri = sns.load_dataset('fmri') ax = plot.get_axis(preset='wide') plot.line( data=fmri, x='timepoint', y='signal', )
def frequency_sort_by_values_test(): data = [np.random.choice(a=range(10)) for _ in range(100)] ax = plot.get_axis(preset='wide') plot.frequency( data=data, ax=ax, sort_by_values=True, )
def umap_test(): iris = sns.load_dataset('iris') ax = plot.get_axis(preset='wide') plot.umap( iris[['sepal_length', 'sepal_width', 'petal_length', 'petal_width']], ax=ax, s=5, labels=iris['species'] )
def dimensionality_reduction_test(): iris = sns.load_dataset('iris') ax = plot.get_axis(figsize=(8.4 * 3, 8.4)) plot.dimensionality_reduction( data=iris[['sepal_length', 'sepal_width', 'petal_length', 'petal_width']], labels=iris.species, ax=ax, xticklabels=False, yticklabels=False, )
def pca_with_no_xyticklabels_test(): iris = sns.load_dataset('iris') ax = plot.get_axis(figsize=(8.4, 8.4)) plot.pca( data=iris[['sepal_length', 'sepal_width', 'petal_length', 'petal_width']], labels=iris.species, s=5, ax=ax, xticklabels=False, yticklabels=False, )
def mutation_signature_test(): data = Counter() c_contexts = [p + 'C' + n for (p, n) in itertools.product('ACGT', 'ACGT')] t_contexts = [p + 'T' + n for (p, n) in itertools.product('ACGT', 'ACGT')] c_alts, t_alts = 'AGT', 'ACG' for context, alt in itertools.product(c_contexts, c_alts): data[(context, alt)] = np.random.randint(1, 30) for context, alt in itertools.product(t_contexts, t_alts): data[(context, alt)] = np.random.randint(1, 30) ax = plot.get_axis(figsize=(20.4, 3.4)) plot.mutation_signature(data, ax=ax) plot.set_suptitle('Mutational signatures.')
def boxplot_test(): iris = sns.load_dataset('iris') ax = plot.get_axis(preset='wide', transpose=True) plot.boxplot(data=iris, x='species', y='sepal_length', ax=ax)
def frequency_test(): data = [np.random.choice(a=range(10)) for _ in range(100)] ax = plot.get_axis(preset='wide') plot.frequency(data, ax=ax, xlabel='Your numbers', ylabel='Frequency')