retentioneering.visualization package

Submodules

retentioneering.visualization.layouts module

retentioneering.visualization.layouts.sugiyama_layout(g)[source]

Position nodes using Sugiyama algorithm. Returns dictionary of positions keyed by node.

Parameters:g (networkx.classes.digraph.DiGraph) – NetworkX graph. A position will be assigned to every node in G.
Returns:dict

retentioneering.visualization.plot module

retentioneering.visualization.plot.bars(x, y, settings={}, figsize=(8, 5), save=True, plot_name=None)[source]

Plot bar graph

Parameters:
  • x (list) – bars names
  • y (list) – bars values
  • settings (dict) – experiment config (can be empty dict here)
  • figsize (tuple) – width, height in inches. If not provided, defaults to rcParams[“figure.figsize”] = [6.4, 4.8]
  • save (bool) – True if the graph should be saved
  • plot_name (str) – name of file with graph plot
Returns:

None

retentioneering.visualization.plot.cluster_stats(data, labels=None, settings={}, plot_count=2, figsize=(10, 5), save=True, plot_name=None)[source]

Plot pie chart with different events

Parameters:
  • data (list) – list of lists with size of each group
  • labels (list or tuple) – list of labels for each group
  • settings (dict) – experiment config (can be empty dict here)
  • plot_count (int) – number of plots to visualize
  • figsize (tuple) – width, height in inches. If not provided, defaults to rcParams[“figure.figsize”] = [6.4, 4.8]
  • save (bool) – True if the graph should be saved
  • plot_name (str) – name of file with graph plot
Returns:

None

retentioneering.visualization.plot.heatmap(x, labels=None, settings={}, figsize=(10, 15), save=True, plot_name=None)[source]

Plot heatmap graph

Parameters:
  • x (list[list]) – data to visualize
  • labels (str) – list of labels for x ticks
  • settings (dict) – experiment config (can be empty dict here)
  • figsize (tuple) – width, height in inches. If not provided, defaults to rcParams[“figure.figsize”] = [6.4, 4.8]
  • save (bool) – True if the graph should be saved
  • plot_name (str) – name of file with graph plot
Returns:

None

retentioneering.visualization.plot.plot_graph(df_agg, agg_type, settings, layout=<function random_layout>, save=True, figsize=(20, 10), plot_name=None)[source]

Visualize trajectories from aggregated tables (with python)

Parameters:
  • df_agg (pd.DataFrame) – table with aggregates (from retentioneering.analysis.get_all_agg function)
  • agg_type (str) – name of col for weighting graph nodes (column name from df)
  • settings (dict) – experiment config (can be empty dict here)
  • layout (func) – function that return dictionary of positions keyed by node for NetworkX graph
  • save (bool) – True if the graph should be saved
  • figsize (tuple) – width, height in inches. If not provided, defaults to rcParams[“figure.figsize”] = [6.4, 4.8]
  • plot_name (str) – name of file with graph plot
Returns:

None

retentioneering.visualization.plot.plot_graph_api(df, settings, users='all', task='lost', order='all', threshold=0.5, start_event=None, end_event=None)[source]

Visualize trajectories from event clickstream (with Mathematica)

Parameters:
  • df – data from BQ or your own (clickstream). Should have at least three columns: event_name, event_timestamp and user_pseudo_id
  • settings – experiment config (can be empty dict here)
  • usersall or list of user ids to plot specific group
  • task – type of task for different visualization (can be lost or prunned_welcome)
  • order – depth in sessions for filtering
  • threshold – threshold for session splitting
  • start_event – name of start event in trajectory
  • end_event – name of last event in trajectory
  • df – pd.DataFrame
  • settings – dict
  • users – str or list
  • task – str
  • order – int
  • threshold – float
  • start_event – str
  • end_event – str
Returns:

None

retentioneering.visualization.tree_selectors module

retentioneering.visualization.tree_selectors.print_checkboxes(data, checkbox_id='1', is_checked=True, sep='_')[source]

Module contents