plotting - plotting utilities
Utilities for plotting.
- plotting.plot_2d_dim_red(df_dim_red, output_file, config, columns=['C1', 'C2'], groups_column=None, groups=None, plot_other_groups=False)
Plot the results of a two-dimensional dimensionality reduction.
- Parameters:
- df_dim_red
pandas.DataFrame A data frame containing the results of the dimensionality reduction.
The rows should contain the data points, while the columns should contain the values of each data point’s projection along the principal components.
- output_file
str The file where the plot will be saved.
- config
dict A dictionary containing the configuration for the plot’s aesthetics.
- columns
list,["PC1", "PC2"] A list with the names of the two columns that contain the values of the two dimensions of the projection’s space to be considered when plotting.
- groups_column
str, optional The name of the column containing the labels of different groups, if any.
If not provided, the data points will be assumed to belong to one group.
If provided, the data points will be colored according to the group they belong.
- groups
list, optional A list of groups of interest. If a list of groups is provided and
plot_other_groupsisFalse, only data points belonging to the groups of interest will be plotted. Ifplot_other_groupsisTrue, the other groups will be plotted according to the aesthetic specifications provided in the configuration.- plot_other_groups
bool,False If a list of
groupsof interest if provided, set whether to plot data points belonging to the other groups according to the aesthetic specifications provided in the configuration (True) or not to plot the data points belonging to the other groups at all (False).
- df_dim_red
- plotting.plots.plot_multiple_2d_dim_red(dfs_dim_red, output_prefix, output_fmt, config, plots_per_output=9, columns=['C1', 'C2'], groups_column=None, groups=None, plot_other_groups=False, dfs_names=None)
Plot the results of a series of dimensionality reduction analyses on a single figure (which may be split on multiple pages).
- Parameters:
- dfs_dim_red
pandas.DataFrame A list of data frames containing the results of the dimensionality reduction analyses.
The rows of each data frame should contain the data points, while the columns should contain the values of each data point’s projection along the principal components.
- output_prefix
str The prefix of the output file(s) that will be written.
The number of output files depends on the number of data frames passed and on the number of
plots_per_output.- output_fmt:class`str`
The format of the output file(s) that will be written.
- config
dict A dictionary containing the configuration for the plots’ aesthetics.
- plots_per_output
int,9 The maximum number of plots to draw on each output file.
- columns
list,["PC1", "PC2"] A list with the names of the two columns in each data frame that contain the values of the two dimensions of the projection’s space to be considered when plotting.
- groups_column
str, optional The name of the column containing the labels of different groups in the data frames, if any.
If not provided, the data points will be assumed to belong to one group.
If provided, the data points will be colored according to the group they belong.
- groups
list, optional A list of groups of interest. If a list of groups is provided and
plot_other_groupsisFalse, only data points belonging to the groups of interest will be plotted. Ifplot_other_groupsisTrue, the other groups will be plotted according to the aesthetic specifications provided in the configuration.- plot_other_groups
bool,False If a list of
groupsof interest if provided, set whether to plot data points belonging to the other groups according to the aesthetic specifications provided in the configuration (True) or not to plot the data points belonging to the other groups at all (False).- dfs_names
list, optional A list of names for the data frames passed. These names, if passed, will be used as the titles of the corresponding plots.
- dfs_dim_red
- plotting.plot_get_representations_time(df_time, output_file, config)
Plot the CPU/wall clock time spent in each epoch of each round of optimization when finding the representations for a set of samples (both for the full epoch and for the backward step performed in each epoch).
- Parameters:
- df_time
pandas.DataFrame A data frame containing the time data. This data frame is produced as an output by the
bulkDGD.core.model.DGDModel.get_representationsmethod.- output_file
str The file where the plot will be saved.
- config
dict A dictionary containing the configuration for the plot’s aesthetics.
- df_time
- plotting.plot_r_values_hist(r_values, output_file, config)
Plot a histogram of the r-values.
- Parameters:
- r_values
numpy.ndarray The r-values. This is a 1D array whose length is equal to the number of genes included in the DGD model.
- output_file
str The file where the plot will be saved.
- config
dict The configuration for the plot’s aesthetics.
- r_values