

Animations: Intros and Loops
source link: https://datacrayon.com/posts/plotapi/chord/animations-intros-and-loops/
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¶
Plotapi Chord supports animations - both for looping and for nice introductions to your visualisation.
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.
matrix = [ [0, 5, 6, 4, 7, 4], [5, 0, 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], ] names = ["Action", "Adventure", "Comedy", "Drama", "Fantasy", "Thriller"]
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)
Action Adventure Comedy Drama Fantasy Thriller Action 0 5 6 4 7 4 Adventure 5 0 5 4 6 5 Comedy 6 5 0 4 5 5 Drama 4 4 4 0 5 5 Fantasy 7 6 5 5 0 4 Thriller 4 5 5 5 4 0
Visualisation¶
Animations can be controlled with the following parameters:
-
animated_loop
will result in an animation that loops forever, this is primarily useful in combination with theto_mp4()
end-point to create a looping video. -
animated_intro
will result in an animation that loops once, and serves as a nice introduction to your visualisation as it loads. -
animated_duration
determines how long a single loop will take.
Let's try both approaches.
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!
You may miss the first - you can refresh the page and scroll back down here to catch it!
Chord(matrix, names, wrap_labels=True, animated_intro=True, animated_duration=3000).show()
Plotapi - Chord Diagram
This next one will loop forever.
Chord(matrix, names, wrap_labels=True, animated_loop=True, animated_duration=3000).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
-
13
Hired in Taipei? Cool Intros.otsukare Thoughts after a day of workHired in Taipei? Cool Intros. Jeu 2...
-
12
TikTok Adds Live-Stream Intros to Better Facilitate Engagement Published Dec. 21, 2021 By
-
10
The new league is live now on PC, next week on console Every few months the folks at Grinding Gear Games release new content for their long-running free-to-play action RPG, Path of Exile. Although F...
-
9
Bonitasoft intros devops tool for digital process automation
-
7
Script that synthesizes EasyApple intros with Azure's text-to-speech APIs · GitHub Instantly share code, notes, and snippets. Script that sy...
-
7
Apple intros all-new M2 MacBook Air; 13-inch MacBook Pro also gets M2 Monday, June 6, 2022 3:30 pmMonday, June 6, 2022
-
7
News Visual Studio Extension Guru Intros Rainbow Braces to Make Sense of...
-
10
GoPro releases three new Hero 11 cameras, including a Mini version ...
-
4
HomeAIChina’s ByteDance Intros Different Approach to Recommendation at Scale
-
7
We've gathered up the most popular content from Red Hat Developer for October 2022, and we hope you find it informative and helpful. We've divided them into product announcements, topic roundups, lear...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK