pheatmap API
- pheatmap.pheatmap(mat: DataFrame, cmap: Union[str, Colormap, list] = 'bwr', vmin: Optional[float] = None, vmax: Optional[float] = None, name: Optional[str] = None, rownames: Optional[ndarray] = None, colnames: Optional[ndarray] = None, rownames_side: str = 'left', colnames_side: str = 'bottom', show_rownames: bool = True, show_colnames: bool = True, rownames_style: dict = {'rotation': 0, 'size': 6}, colnames_style: dict = {'rotation': 0, 'size': 6}, edgecolor: str = 'none', edgewidth: float = 1, annotation_row: Optional[DataFrame] = None, annotation_col: Optional[DataFrame] = None, annotation_row_cmaps: Optional[Dict[str, Union[str, Colormap, list]]] = None, annotation_col_cmaps: Optional[Dict[str, Union[str, Colormap, list]]] = None, show_annotation_row_names: bool = True, show_annotation_col_names: bool = True, legend_tick_locs: Optional[Dict[str, Sequence]] = None, legend_tick_labels: Optional[Dict[str, Sequence]] = None, legend_tick_labels_styles: Dict = {'size': 6}, legend_titles: Optional[Dict[str, bool]] = None, legend_title_styles: Dict = {'size': 6}, width: float = 8, height: float = 6, wspace: float = 0.1, hspace: float = 0.1, annotation_bar_width: float = 0.03, legend_bar_width: float = 0.045, annotation_bar_space: float = 0.2, legend_bar_space: float = 1) Figure
Plot heatmap with annotation bars
- matDataFrame
the main heatmap DataFrame
- cmapUnion[str, Colormap, list], optional
the colormap of heatmap, by default “bwr”
- vminfloat, optional
the minemum value scaled. by default None, use the minemum value of mat
- vmaxfloat, optional
the maximum value scaled. by default None, use the maximum value of mat
- namestr, optional
the name of heatmap, by default None, use “heatmap” as the name of heatmap
- rownamesndarray, optional
the row names provided, by default None, use the row names of main heatmap DataFrame
- colnamesndarray, optional
the column names provided, by default None, use the column names of main heatmap DataFrame
- rownames_sidestr, optional
show row names on which side(“left” or “right”)? by default “left”
- colnames_sidestr, optional
show column names on which side(“top” or “bottom”)? by default “bottom”
- show_rownamesbool, optional
whether show row names? by default True
- show_colnamesbool, optional
whether show column names? by default True
- rownames_styledict, optional
modify row names’ style, such as, fontsize, fontstyle, etc. See more information on [matplotlib.text.Text](https://matplotlib.org/stable/api/text_api.html#matplotlib.text.Text). by default dict(rotation=0, size=6)
- colnames_styledict, optional
see rownames_style, by default dict(rotation=0, size=6)
- edgecolorstr, optional
the color of heatmap’s cell edge, by default “none”, no edge. !Note: If provide None, will use the rcParams[“patch.edgecolor”], it default as “black”.
- edgewidthfloat, optional
the width of heatmap’s cell edge, by default 1
- annotation_rowDataFrame, optional
DataFrame used to create row Annotationbar, by default None
- annotation_colDataFrame, optional
DataFrame used to create column Annotationbar, by default None
- annotation_row_cmapsDict[str, Union[str, Colormap, list]], optional
Colormaps for each Annotationbar, keys are the DataFrame’s columns, by default None, use “viridis” for continuous and “tab20” for discrete
- annotation_col_cmapsDict[str, Union[str, Colormap, list]], optional
see annotation_row_cmaps, by default None
- show_annotation_row_namesbool, optional
whether show row Annotationbar’s name, by default True
- show_annotation_col_namesbool, optional
whether show column Annotationbar’s name, by default True
- legend_tick_locsDict[str, Sequence], optional
modify the tick locations of legend, keys are the name of heatmap or the column names of annotation DataFrame, by default None
- legend_tick_labelsDict[str, Sequence], optional
modify the tick labels of legend, keys are the name of heatmap or the column names of annotation DataFrame. The length of each legend tick labels must be matched with its tick locations. by default None
- legend_tick_labels_stylesDict, optional
modify the each legend tick labels’ style. Keys are the name of heatmap or the column names of annotation DataFrame. More informations see rownames_style. by default dict(size=6)
- legend_titlesDict[str, bool], optional
modify the each legend title. Others are the same as legend_tick_labels. by default None
- legend_title_stylesDict, optional
modify the each legend title’s style. Others are the same as legend_tick_labels_styles. by default dict(size=6)
- widthfloat, optional
the whole figure width, by default 8
- heightfloat, optional
the whole figure height, by default 6
- wspacefloat, optional
the space of whole figure at the width direction, by default 0.1. It’s the fraction of the average length of width’s axises
- hspacefloat, optional
see wspace, by default 0.1
- annotation_bar_widthfloat, optional
the width of Annotationbar, by default 0.03. It’s the fraction of the whole figure width
- legend_bar_widthfloat, optional
the width of legend bar, by default 1.5*0.03. It’s the fraction of the whole figure width. And it’s better, set it as 1.5 * annotation_bar_width.
- annotation_bar_spacefloat, optional
the space between Annotationbars, by default 0.2. It’s the fraction of the real Annotationbar width.
- legend_bar_spacefloat, optional
the space between legend bars, by default 1. It’s the fraction of the real legend bar width
Figure