What are Sankey diagrams how to make them in plotly?

This recipe explains what are Sankey diagrams how to make them in plotly

Recipe Objective

What are Sankey diagrams how to make them in plotly?

Sankey diagrams these are the diagrams which are the type of flow diagram where the arrows width is comparative to the rate of flow. There are various parameters available which help in visualizing Sankey diagrams that are:

Source - It will represent the source node. Target - It will represent the target node. value - It is used to set the flow volume. label - It will display the name of node.

The representation of quantity is doubled when the flow is twice as wide.

Step 1 - Import library

import plotly.graph_objects as go

Step 2 - Plot the graph

dict(thickness = 8, line = dict(color="yellow", width = 0.3), label = ["First","Second","Third","Fourth","Fifth","Sixth"], color = "green"), link = dict( source = [1,3,4,6,8,9], target = [0,4,6,7,2,3], value = [9,8,4,5,2,1] ))]) fig.show()

What Users are saying..

profile image

Ed Godalle

Director Data Analytics at EY / EY Tech
linkedin profile url

I am the Director of Data Analytics with over 10+ years of IT experience. I have a background in SQL, Python, and Big Data working with Accenture, IBM, and Infosys. I am looking to enhance my skills... Read More

Relevant Projects

NLP Project for Beginners on Text Processing and Classification
This Project Explains the Basic Text Preprocessing and How to Build a Classification Model in Python

OpenCV Project to Master Advanced Computer Vision Concepts
In this OpenCV project, you will learn to implement advanced computer vision concepts and algorithms in OpenCV library using Python.

PyTorch Project to Build a LSTM Text Classification Model
In this PyTorch Project you will learn how to build an LSTM Text Classification model for Classifying the Reviews of an App .

Deep Learning Project for Time Series Forecasting in Python
Deep Learning for Time Series Forecasting in Python -A Hands-On Approach to Build Deep Learning Models (MLP, CNN, LSTM, and a Hybrid Model CNN-LSTM) on Time Series Data.

Loan Eligibility Prediction using Gradient Boosting Classifier
This data science in python project predicts if a loan should be given to an applicant or not. We predict if the customer is eligible for loan based on several factors like credit score and past history.

Build Customer Propensity to Purchase Model in Python
In this machine learning project, you will learn to build a machine learning model to estimate customer propensity to purchase.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Build CI/CD Pipeline for Machine Learning Projects using Jenkins
In this project, you will learn how to create a CI/CD pipeline for a search engine application using Jenkins.

Build a Autoregressive and Moving Average Time Series Model
In this time series project, you will learn to build Autoregressive and Moving Average Time Series Models to forecast future readings, optimize performance, and harness the power of predictive analytics for sensor data.

NLP Project to Build a Resume Parser in Python using Spacy
Use the popular Spacy NLP python library for OCR and text classification to build a Resume Parser in Python.