whatstk.graph.figures package

Submodules

whatstk.graph.figures.boxplot module

Boxplot figures.

Functions:

fig_boxplot_msglen(df[, username_to_color, ...])

Visualize boxplot.

whatstk.graph.figures.boxplot.fig_boxplot_msglen(df: DataFrame, username_to_color: Dict[str, str] | None = None, title: str = '', xlabel: str | None = None) Figure[source]

Visualize boxplot.

Parameters:
  • df (pandas.DataFrame) – Chat data.

  • username_to_color (dict, optional) –

  • title (str, optional) – Title for plot. Defaults to “”.

  • xlabel (str, optional) – x-axis label title. Defaults to None.

Returns:

plotly.graph_objs.Figure

whatstk.graph.figures.heatmap module

Heatmap plot figures.

Functions:

fig_heatmap(df_matrix[, title])

Generate heatmap figure from NxN matrix.

whatstk.graph.figures.heatmap.fig_heatmap(df_matrix: DataFrame, title: str = '') Figure[source]

Generate heatmap figure from NxN matrix.

Parameters:
  • df_matrix (pandas.DataFrame) – Matrix as DataFrame. Index values and column values must be equal.

  • title (str) – Title of plot. Defaults to “”.

Returns:

plotly.graph_objs.Figure

whatstk.graph.figures.sankey module

Sankey plot figures.

Functions:

fig_sankey(label, color, source, target, value)

Generate sankey image.

whatstk.graph.figures.sankey.fig_sankey(label: List[str], color: List[str], source: List[str], target: List[str], value: List[int], title: str = '') Figure[source]

Generate sankey image.

Parameters:
  • label (list) – List with node labels.

  • color (list) – List with node colors.

  • source (list) – List with link source id.

  • target (list) – List with linke target id.

  • value (list) – List with link value.

  • title (str, optional) – Title. Defaults to “”.

Returns:

plotly.graph_objs.Figure

whatstk.graph.figures.scatter module

Scatter plot figures.

Functions:

fig_scatter_time(user_data[, ...])

Obtain Figure to plot using plotly.

whatstk.graph.figures.scatter.fig_scatter_time(user_data: DataFrame, username_to_color: Dict[str, str] | None = None, title: str = '', xlabel: str | None = None) Figure[source]

Obtain Figure to plot using plotly.

user_data must be a pandas.DataFrame with timestamps as index and a column for each user. You can easily generate suitable user_data using the function get_interventions_count (disclaimer: not compatible with date_mode='hourweekday').

Parameters:
  • user_data (pandas.DataFrame) – Input data. Shape nrows x ncols, where nrows = number of timestaps and ncols = number of users.

  • username_to_color (dict, optional) –

  • title (str, optional) – Title of figure. Defaults to “”.

  • xlabel (str, optional) – x-axis label title. Defaults to None.

Returns:

plotly.graph_objs.Figure

whatstk.graph.figures.utils module

Utils for library plots.

Functions:

hex_color_palette(n_colors)

Get palette of n_colors color hexadecimal codes.

whatstk.graph.figures.utils.hex_color_palette(n_colors: int) List[str][source]

Get palette of n_colors color hexadecimal codes.

Parameters:

n_colors (int) – Size of the color palette.

Module contents

Build Plotly compatible Figures.