PyComplexHeatmap.oncoPrint module

class PyComplexHeatmap.oncoPrint.oncoPrintPlotter(data=None, x=None, y=None, values=None, cmap='Set1', colors=None, aspect=None, bgcolor='whitesmoke', row_gap=0.8, color_legend_kws={}, cmap_legend_kws={}, remove_empty_rows=True, remove_empty_columns=True, **kwargs)[source]

Bases: ClusterMapPlotter

DotClustermap (Heatmap) plotter, inherited from ClusterMapPlotter. Plot dot heatmap (clustermap) with annotation and legends.

Parameters:
  • data (dataframe) – pandas dataframe or numpy array.

  • x (str) – The column name in data.columns to be shown on the columns of heatmap / clustermap.

  • y (str) – The column name in data.columns to be shown on the rows of heatmap / clustermap.

  • values (str or list) – The column names in data.columns to control the sizes, or color of scatter (dot).

  • colors (list.) – colors for each column in values

  • cmap (str or dict, optional.) – If cmap is a dict, the keys should be the values from data[hue].values, and values should be cmap. If cmap is a string, it should be colormap, such as ‘Set1’.

  • bgcolor (str) – background color, default is whitesmoke (or lightgray)

  • color_legend_kws (dict) – legend_kws passed to plot_color_dict_legend

  • cmap_legend_kws (dict) – legend_kws passed to plot_cmap_legend

  • kwargs (dict) – Other kwargs passed to ClusterMapPlotter and oncoprint, such as width, align (will be passed to oncoprint).

Return type:

oncoPrintPlotter.

add_default_annotations()[source]
collect_legends()[source]
format_data(data, mask=None, z_score=None, standard_scale=None)[source]
get_samples_order(data, row_order)[source]

data is a dataframe, row_order is a list ([[],[]]).

plot_matrix(row_order, col_order)[source]
post_processing()[source]
PyComplexHeatmap.oncoPrint.oncoprint(data, ax=None, colors=None, cmap='Set1', nvar=None, aspect=None, bgcolor='whitesmoke', row_gap=1, xticklabels_kws=None, subplot_spec=None, yticklabels_kws=None, **plot_kws)[source]

Plot dot heatmap using a dataframe matrix as input.

Parameters:
  • data (pd.DataFrame) – input matrix (pandas.DataFrame), for each element in this dataframe, the value should be a list.

  • ax (ax) – ax

  • colors (dict) – colors to control the dot, keys should be the value in hue. if colors is a str, then colors will overwrite the parameter c.

  • cmap (str of dict) – control the colormap of the dot, if cmap is a dict, keys should be the values from hue dataframe. If cmap is a str (such as ‘Set1’), the parameter colors will overwrite the colors of dots. If cmap wisas a dict, then this paramter will overwrite the colors, and colors can only control the colors for markers.

  • bgcolor (str) – background color, default is whitesmoke (#CCCCCC)

  • kwargs (dict) – such as s,c,marker, s,marker and colors can also be pandas.DataFrame. other kwargs passed to plt.scatter

Return type:

ax,axes