[PYTHON] I want to visualize the transfer status of the 2020 J League, what should I do?

Motivation

About the sankey diagram

The Sankey diagram is a diagram that represents the flow rate between processes. The thickness of the arrow indicates the amount of flow. In particular, it is used to represent the displacement of energy, supplies, expenses, etc.

[Source: Free encyclopedia "Wikipedia"](https://ja.wikipedia.org/wiki/%E3%82%B5%E3%83%B3%E3%82%AD%E3%83%BC_ % E3% 83% 80% E3% 82% A4% E3% 82% A2% E3% 82% B0% E3% 83% A9% E3% 83% A0)

I don't understand the original matplotlib at all, and plotly is very beautiful but I don't understand at all. Try with the simplest demo: Exporting Images.ipynb!

Copying sutras

sankey.py


from ipysankeywidget import SankeyWidget
from ipywidgets import Layout
$ jupyter labextension install jupyter-sankey-widget @jupyter-widgets/jupyterlab-manager

And register the extension.

sankey.py


links = [
    {'source': 'start', 'target': 'A', 'value': 2},
    {'source': 'A', 'target': 'B', 'value': 2},
    {'source': 'C', 'target': 'A', 'value': 2},
    {'source': 'A', 'target': 'C', 'value': 2},
]

Since this is the data part, replace it with the transfer dummy data.

sankey.py


links = [
    {'source': 'Hokkaido_in', 'target': 'overseas_out', 'value': 1},
    {'source': 'Hokkaido_in', 'target': 'J2_out', 'value': 1},
    {'source': 'Hokkaido_in', 'target': 'University_out', 'value': 3},
    {'source': 'Shonan_in', 'target': 'Hokkaido_out', 'value': 1},
    {'source': 'J3_in', 'target': 'Hokkaido_out', 'value': 1},
]

sankey.py


layout = Layout(width="600", height="400")
sankey = SankeyWidget(links=links, layout=layout)
sankey.auto_save_png('./img/test.png')

The size of the output image is 600 pixels wide and 400 pixels high and is saved in PNG format. sample_sapporo.png

Needless to say, I was able to express the flow of 5 players who joined and 2 players who transferred. (Look at it, but it seems that you can express the flow for the time being)

Summary

Recommended Posts

I want to visualize the transfer status of the 2020 J League, what should I do?
real-time-Personal-estimation (What should I do to prevent the estimation of images outside the category) * Failure.
I want to get League of Legends data ③
I want to get League of Legends data ②
I want to customize the appearance of zabbix
I want to get League of Legends data ①
I want to grep the execution result of strace
I want to fully understand the basics of Bokeh
I tried to visualize the spacha information of VTuber
I want to increase the security of ssh connections
I want to use only the normalization process of SudachiPy
I want to get the operation information of yahoo route
[Python] I tried to visualize the follow relationship of Twitter
I want to judge the authenticity of the elements of numpy array
I want to know the features of Python and pip
Keras I want to get the output of any layer !!
I want to know the legend of the IT technology world
Make a note of what you want to do in the future with Raspberry Pi
I want to do ○○ with Pandas
Visualize the response status of the census 2020
I want to get the name of the function / method being executed
I want to manually assign the training parameters of the [Pytorch] model
I want to read the html version of "OpenCV-Python Tutorials" OpenCV 3.1 version
I want to output the beginning of the next month with Python
I want to check the position of my face with OpenCV!
What to do when you get "I can't see the site !!!!"
I want to know the population of each country in the world.
I tried to visualize the common condition of VTuber channel viewers
What should I do with the Python directory structure after all?
[Django] What to do if the model you want to create has a large number of fields
I want to pin Spyder to the taskbar
What skills do I need to program with the FBX SDK Python?
I want to output to the console coolly
[Note] I want to completely preprocess the data of the Titanic issue-Age version-
I tried to visualize the age group and rate distribution of Atcoder
I want to handle the rhyme part1
I don't want to admit it ... The dynamical representation of Neural Networks
What I did to keep track of the humidity and temperature of the archive
I want to handle the rhyme part3
(Python Selenium) I want to check the settings of the download destination of WebDriver
I want to batch convert the result of "string" .split () in Python
I want to explain the abstract class (ABCmeta) of Python in detail.
I want to sort a list in the order of other lists
I want to express my feelings with the lyrics of Mr. Children
I want to display the progress bar
I want to analyze the emotions of people who want to meet and tremble
I want to use the Qore SDK to predict the success of NBA players
I tried to visualize the text of the novel "Weathering with You" with WordCloud
I want to leave an arbitrary command in the command history of Shell
I want to stop the automatic deletion of the tmp area with RHEL7
Let's summarize what you want to do.
Python: I want to measure the processing time of a function neatly
After all, what should I use to do type comparisons in Python?
I want to handle the rhyme part2
I want to handle the rhyme part5
I want to handle the rhyme part4
I want to visualize where and how many people are in the factory
I want to get the path of the directory where the running file is stored.
Example of what to do when the sample script does not work (OpenCV-Python)
The story of IPv6 address that I want to keep at a minimum
I want to use Python in the environment of pyenv + pipenv on Windows 10