API for coders
Saving locally
PlotAPI supports saving visualizations locally. This includes saving to PNG, PDF, SVG, animated MP4, and interactive HTML.
We've already activated our license with the license activation instructions.
Let's demonstrate the different output formats we can output to a notebook -- inline!
Save locally or upload to cloud
You can do more within a script/notebook than just saving locally. You can display within a notebook and upload to cloud too!
We'll use the following data to create a Chord diagram in our examples.
from plotapi import Chord
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"]
Interactive HTML
Call .to_html(path)
to save an interactive visualization locally.
Chord(matrix, names).to_html()
The default path is out.html
.
Animated video
Call .to_mp4(path)
to save an animated MP4
video of the visualization locally.
Chord(matrix, names).to_mp4()
The default path is out.mp4
.
Static image
Call .to_png()
to save a static PNG
image of the visualization locally.
Chord(matrix, names).to_png()
The default path is out.png
.
The image quality can be controlled using the scale
parameter. The default is scale=2
, and the maximum is scale=5
.
Chord(matrix, names).to_png(scale=3)
Portable document (PDF)
Call .to_pdf()
to save a portable PDF
document of the visualization locally.
Chord(matrix, names).to_pdf()
The default path is out.pdf
.
Scalable Vector Graphics (SVG)
Call .to_svg()
to save a static SVG
document of the visualization locally.
Chord(matrix, names).to_svg()
The default path is out.svg
.