Skip to content
The Chat Archive
Gemini (model unspecified)· Google ShareLM (browser-extension contributions)

Given two lists, write me python code that creates a sanky plot for them

  1. User

    Given two lists, write me python code that creates a sanky plot for them

  2. Assistant

    I'll write a Python script for you that uses the plotly library. It's generally the best tool for Sankey diagrams in Python because it creates interactive plots and handles the layout automatically.This script assumes your two lists represent paired data (e.g., source_list[0] flows to target_list[0]). It will automatically calculate the "flow" (frequency) of identical pairs.Sankey Plot Generator26 Nov, 21:41 Try again without Canvas How to use this:Install requirements: You will need pandas and plotly installed.Bashpip install pandas plotly 2. Run the script: It will generate an interactive HTML file (or open in your browser) showing the flow between the items in your two lists. Customize: You can simply replace the sources and targets lists in the if name == "main": block with your own data. The script automatically handles counting duplicates to determine the width of the streams.