(steps_df, n_top_examples=None, show=True)


Plot a Sankey Diagram of the Funnel with Plotly.

This method requires the dataframe from FunnelDiscovery.get_navigation_paths: steps_df. Out of steps_df Bach dataframe we construct a new Bach dataframe (in order to plot the sankey diagram), which has the following structure:

  • ‘source’, ‘target’, ‘value’
  • ‘step1’, ‘step2’, ‘val1’
  • ‘step2’, ‘step3’, ‘val2’
  • ‘…’, ‘…’, ‘…’

The navigation steps are our nodes (source and target), the value shows how many source -> target links we have.


  • steps_df (bach.dataframe.DataFrame) – the dataframe which we get from FunnelDiscovery.get_navigation_paths.
  • n_top_examples (Optional[int]) – number of top examples to plot (if we have too many examples to plot it can slow down the browser).
  • show (bool) – if True, it shows the plot, if False it only returns the DataFrame with the data that is to be plotted.


Bach DataFrame with source, target and value columns.

Return type