scikit_posthocs.sign_plot

scikit_posthocs.sign_plot(x: Union[List, numpy.ndarray, pandas.core.frame.DataFrame], g: Optional[Union[List, numpy.ndarray]] = None, flat: bool = False, labels: bool = True, cmap: Optional[List] = None, cbar_ax_bbox: Optional[List] = None, ax: Optional[matplotlib.axes._subplots.SubplotBase] = None, **kwargs) Union[matplotlib.axes._subplots.SubplotBase, Tuple[matplotlib.axes._subplots.SubplotBase, matplotlib.colorbar.Colorbar]]

Significance plot, a heatmap of p values (based on Seaborn).

Parameters
  • x (Union[List, np.ndarray, DataFrame]) – If flat is False (default), x must be an array, any object exposing the array interface, containing p values. If flat is True, x must be a sign_array (returned by scikit_posthocs.sign_array() function).

  • g (Union[List, np.ndarray]) – An array, any object exposing the array interface, containing group names.

  • flat (bool) – If flat is True, plots a significance array as a heatmap using seaborn. If flat is False (default), plots an array of p values. Non-flat mode is useful if you need to differentiate significance levels visually. It is the preferred mode.

  • labels (bool) – Plot axes labels (default) or not.

  • cmap (list) –

    1) If flat is False (default): List consisting of five elements, that will be exported to ListedColormap method of matplotlib. First is for diagonal elements, second is for non-significant elements, third is for p < 0.001, fourth is for p < 0.01, fifth is for p < 0.05.

    2) If flat is True: List consisting of three elements, that will be exported to ListedColormap method of matplotlib. First is for diagonal elements, second is for non-significant elements, third is for significant ones. 3) If not defined, default colormaps will be used.

  • cbar_ax_bbox (list) – Colorbar axes position rect [left, bottom, width, height] where all quantities are in fractions of figure width and height. Refer to matplotlib.figure.Figure.add_axes for more information. Default is [0.95, 0.35, 0.04, 0.3].

  • ax (SubplotBase) – Axes in which to draw the plot, otherwise use the currently-active Axes.

  • kwargs – Keyword arguments to be passed to seaborn heatmap method. These keyword args cannot be used: cbar, vmin, vmax, center.

Returns

  • ax (matplotlib.axes._subplots.AxesSubplot) – Axes object with the heatmap.

  • cbar (matplotlib.colorbar.Colorbar) – ColorBar object if flat is set to False.

Examples

>>> x = np.array([[ 1, 1, 1],
                  [ 1, 1, 0],
                  [ 1, 0, 1]])
>>> ph.sign_plot(x, flat = True)