Coloured and Invisible Diagonals
source link: https://datacrayon.com/posts/plotapi/chord/coloured-and-invisible-diagonals/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Preamble¶
from plotapi import Chord Chord.set_license("your username", "your license key")
Introduction¶
By default, Plotapi Chord displays occurrences where a category is not related to another category. These values appear in the diagonal of the matrix. It may be desirable to hide (but not remove) these values, this is possible with Plotapi.
As we can see, we have set our license details in the preamble with Chord.set_license()
Dataset¶
Chord expects a list of names (list[str]
) and a co-occurence matrix (list[list[float]]
) as input.
names=['one','two','three','four','five','six'] matrix = [ [19, 5, 6, 4, 7, 4], [5, 4, 5, 4, 6, 5], [6, 5, 0, 4, 5, 5], [4, 4, 4, 0, 5, 5], [7, 6, 5, 5, 0, 4], [4, 5, 5, 5, 4, 0], ]
It may look more clear if we present this as a table with the columns and indices labelled. This is entirely optional.
import pandas as pd pd.DataFrame(matrix, columns=names, index=names)
one two three four five six one 19 5 6 4 7 4 two 5 4 5 4 6 5 three 6 5 0 4 5 5 four 4 4 4 0 5 5 five 7 6 5 5 0 4 six 4 5 5 5 4 0
Visualisation¶
The representation of the diagonal values can be hidden by setting colored_diagonals=False
.
Let's first see what they look like when they're visible.
Here we're using .show()
which outputs to a Jupyter Notebook cell, however, we may want to output to a HTML file with .to_html()
instead. More on the different output methods later!
Be sure to interact with the visualisation to see what the default settings can do!
Chord(matrix, names, title="Diagonals coloured").show()
Plotapi - Chord Diagram
Now let's see what it looks like when they're not visible.
Chord(matrix, names, title="Diagonals not coloured", colored_diagonals=False).show()
Plotapi - Chord Diagram
You can do so much more than what's presented in this example, and we'll cover this in later sections. If you want to see the full list of growing features, check out the Plotapi Documentation. and the Plotapi Gallery.
Recommend
-
114
Invisible reCAPTCHA Why Invisible reCAPTCHA? Invisible reCAPTCHA is an improved version of reCAPTCHA v2(no captcha). In reCAPTCHA v2, users need to click the button: "I'm not a robot" to prove they are human. In invisible reCAPTC...
-
29
cli-progress-animation Example of progress animations and colour for a Golang CLI ASCII Cinema: Status: This is a sample which could be extended or make more generic as part of a task...
-
8
(notice: this chapter is intended to be short) Recall from the previous post, we have max, min, neg and we can construct paths of symmetry....
-
3
Women Multi-Coloured Printed Top – WLOOKFit-True to size, Order usual size Size- M/ L/ XL/ XXL Price are all inclusive Shipping Time- Within 3-4 days Multi-color printed to has a three-fourth sleeves
-
3
Invisible files and Apple's Finder, tar, rsync, and GNU tar solouki macrumors 6502 Original poster
-
10
[Golang] Number spiral diagonals - Problem 28 - Project Euler October 24, 201...
-
7
Python Program to Print Square Star Pattern with diagonalsSkip to content
-
5
The Jungle of Metrics Layers and its Invisible Elephant Discussion about the metrics layer (a.k.a. metrics store, a.k.a. headless BI, a.k.a semantic layers) within the modern data analytics stack is one of the hottest topics...
-
2
Duplicate, Redundant, and Invisible Indexes Back to the Blog
-
1
FaaS or not to FaaS Visible and Invisible Benefits of the Serverless Paradigm Serverless ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK