dohlee.plot module¶
-
dohlee.plot.
save
(file, dpi=120, tight_layout=True)[source]¶ Save plot to a file.
- Attributes:
- file (str): Path to the resulting image file. dpi (int, default=120): Resolution. tight_layout (bool, default=True): Whether to run plt.tight_layout() before saving the plot.
-
dohlee.plot.
set_style
(style='white', palette='deep', context='talk', font='Helvetica Neue', font_scale=1.25, rcparams={'figure.figsize': (11.7, 8.27)})[source]¶
-
dohlee.plot.
frequency
(data, order=None, sort_by_values=False, ax=None, **kwargs)[source]¶ Plot frequency bar chart.
- Examples:
- frequency([1, 2, 2, 3, 3, 3], order=[3, 1, 2], sort_by_values=True)
- Attributes:
- data (list): A list of elements. order (list): A list of elements which represents the order of the elements to be plotted. sort_by_values (bool): If True, the plot will be sorted in decreasing order of frequency values. ax (pyplot axis): Axis to draw the plot.
-
dohlee.plot.
volcano
(data, x, y, padj, label, cutoff=0.05, sample1=None, sample2=None, ax=None)[source]¶ Draw a volcano plot.
>>> volcano(data=data, x='log2FoldChange', y='pvalue', label='Gene_Symbol', cutoff=0.05, padj='padj', figsize=(10.8, 8.4))
Parameters: - data (dataframe) – A dataframe resulting from DEG-discovery tool.
- x (str) – Column name denoting log2 fold change.
- y (str) – Column name denoting p-value. (Note that p-values will be log10-transformed, so they should not be transformed beforehand.)
- padj (str) – Column name denoting adjusted p-value.
- label (str) – Column name denoting gene identifier.
- cutoff (float) – (Optional) Adjusted p-value cutoff value to report significant DEGs.
- sample1 (str) – (Optional) First sample name.
- sample2 (str) – (Optional) Second sample name.
- ax (axis) – (Optional) Matplotlib axis to draw the plot on.
-
dohlee.plot.
pca
(data, labels=None, ax=None, **kwargs)[source]¶ Draw a simple principle component analysis plot of the data.
Parameters: - data (matrix) – Input data. Numpy array recommended.
- labels (list) – (Optional) Corresponding labels to each datum. If specified, data points in the plot will be colored according to the label.
- ax (axis) – (Optional) Matplotlib axis to draw the plot on.
- kwargs – Any other keyword arguments will be passed onto matplotlib.pyplot.scatter.