Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Chord package to realize colorful string Diagram in Python

Shulou Source: shulou.com Published: 2022-06-03 08:38:19 10月03日 Update

This article mainly introduces Python how to use Chord package to achieve colorful string diagrams, the article is very detailed, has a certain reference value, interested friends must read it!

First of all, let's introduce what is a chord diagram.

The chord graph is mainly used to show the relationship between multiple objects. The segment connecting any two points on a circle is called a chord, and the chord (the connection between the two points) represents the relationship between the two.

Although the string diagram looks a little dazzling, it is very suitable for users to analyze the relationships of complex data.

There are some packages in Python that can draw chord diagrams. This article mainly introduces how to use chord library to make cool chord diagrams. You can view the official documentation.

You need to install with pip before using:

Pip install chord

The instructions for using API are clearly listed in the official documents. API is divided into two versions: free and pro, in which the pro version adds a lot of new parameters based on free, but pro requires users to pay a certain fee, about 10 pounds.

Free API:

Chord (self, matrix, names, colors= "d3.schemeSet1", opacity=0.8, padding=0.01, width=700, label_color= "# 454545", wrap_labels=False, margin=0, credit=False, font_size= "16px", font_size_large= "20px")

Pro API:

Chord (self, matrix, names, colors= "d3.schemeSet1", opacity=0.8, padding=0.01, width=700, label_color= "# 454545", wrap_labels=False, margin=0, credit=False, font_size= "16px", font_size_large= "20px", details= [], details_thumbs= [], thumbs_width=85 Thumbs_margin=5, thumbs_font_size=14, popup_width=350, noun= "instances", details_separator= ",", divide=False, divide_idx=0, divide_size=0.5, instances=0, verb= "occur together in", symmetric=True, title= ", arc_numbers=False, divide_left_label=" Divide_right_label= "", inner_radius_scale=0.39, outer_radius_scale=1.1, allow_download=False,)

Chord supports exporting html files or displaying them in Jupyter Lab:

Chord (matrix, names). To_html ()

Chord (matrix, names). Show ()

Finally, I will show a small example of drawing with chord. Chord also supports interactive operation, which is very cool and good-looking.

The above is all the contents of the article "how to use the Chord package to achieve colorful string diagrams in Python". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Between colorful content official document version user article relevance support complex good-looking dazzling dazzling two representatives value instructions examples interests Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MariaDB Shulou Information MySQL Linux