API for coders
Uploading to cloud
PlotAPI supports uploading visualizations to the cloud, where they can be embedded and shared privately, publicly, or within your Team.
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 uploading to the cloud. You can save locally and display within a notebook 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_upload()
to upload an interactive visualization to the cloud.
The name
paramater is required. Calling .upload()
to the same name
will overwrite a visualization if it exists.
project = Chord(matrix, names).upload(name="My Visualization", public=True)
This will return a dict
that you can use in your application, containing:
-
message
: A friendly message indicating the outcome of the upload. -
view_url
: The URL at which the visualization can be viewed. -
edit_url
: The URL at which the project settings can be modified. -
embed_url
: The URL which can be used to embed in other platforms and websites, typically using aniFrame
. -
public
: Indicating the project's visibility. By default, it is set toFalse
, meaning only you can see it.
Let's print the view_url
and share it with our colleagues.
Customizing the view page
Uploading to the cloud supports additional customizations.
-
description
: Descriptive text that will appear alongside the visualization at theview_url
. -
maximized
: When set toTrue
, the visualization will be expanded by default. -
full_width
: When set toTrue
, the visualization can take up the full width of the window. -
public
: Can be set toTrue
orFalse
. -
custom_css
: Allows the specification of custom CSS.
custom_project = Chord(matrix, names).upload(
name="My customized visualization",
description="A demonstration from the PlotAPI documentation.",
maximized=True,
full_width=True,
public=True,
custom_css="text { fill: white; stroke: black; paint-order: stroke; stroke-width: 3px; }",
)
Let's print the view_url
and share it with our colleagues.