Plotapi, beautiful by default.

Let plotapi do the heavy lifting – enabling beautiful interactive visualisations with a single line of code (instead of hundreds).

Get Plotapi

Changing the Colours

Made with Plotapi

You can create beautiful, interactive, and engaging visualisations like this one with Plotapi in any programming language.

Preamble

In [1]:
from plotapi import Terminus

Terminus.set_license("your username", "your license key")

Introduction

Let's take a look at the colors parameter. This will allow us to select from a predefined set of colours, or even pass in our own!

As we can see, we have set our license details in the preamble with Terminus.set_license().

Dataset

Terminus expects a list of dictionary items, these will define the flow of pixels between a source and a target.

In [2]:
links = [
    {"source":"Germany", "target":"England", "value": 1000},
    {"source":"France",  "target":"England", "value": 3000},
    {"source":"Spain",   "target":"England", "value": 5000},
    {"source":"Italy",   "target":"England", "value": 4000},
    {"source":"Japan",   "target":"England", "value": 800},

    {"source":"Germany", "target":"Ireland", "value": 800},
    {"source":"France",  "target":"Ireland", "value": 4000},
    {"source":"Spain",   "target":"Ireland", "value": 5000},
    {"source":"Italy",   "target":"Ireland", "value": 3000},
    {"source":"Japan",   "target":"Ireland", "value": 1000},
]

We can add many source's and target's! As they increase, we may need to adjust Terminus layout properties to accomodate the diagram's size and throughput.

Visualisation

To specify colours, we can set the colors parameter to one of the following:

  • A list of colour strings, e.g. ["#264653","#2a9d8f","#e9c46a","#f4a261","#e76f51"]
  • The string name of a predefined set of colours from the following list: ['monsters', 'category10', 'accent', 'dark2', 'paired', 'pastel1', 'pastel2', 'set1', 'set2', 'set3', 'tableau10', 'rainbow', 'sinebow', 'yellow_red', 'yellow_brown', 'yellow_green', 'yellow_blue', 'red_purple', 'purple_red', 'purple_blue', 'orange_red', 'green_blue', 'blue_purple', 'blue_green', 'cubehelix', 'cool', 'warm', 'cividis', 'plasma', 'magma', 'inferno', 'viridis', 'turbo', 'brown_green', 'purple_green', 'pink_green', 'red_blue', 'red_grey', 'red_yellow_blue', 'red_yellow_green', 'spectral', 'blues', 'greens', 'greys', 'oranges', 'purples', 'reds'].

The default colour scheme is "rainbow".

Here we're using .show() and show_png() which outputs to a Jupyter Notebook cell, however, we may want to output to a file with .to_html() or .to_png() instead. More on the different output methods later!

In [5]:
Terminus(links).show()
Plotapi - Terminus Diagram

Let's demonstrate a few colour schemes.

In [8]:
Terminus(links, colors="viridis").show_png()
In [9]:
Terminus(links, colors="spectral").show_png()
In [10]:
Terminus(links, colors=["#264653","#2a9d8f","#e9c46a","#f4a261","#e76f51"]).show_png()
In [7]:
Terminus(links, colors="turbo").show_png()

You can do so much more than what's presented in this example, and this is covered in other sections. If you want to see the full list of growing features, check out the Plotapi API Documentation. or the Plotapi Gallery.

Made with Plotapi

You can create beautiful, interactive, and engaging visualisations like this one with Plotapi in any programming language.

Plotapi, beautiful by default.

Let plotapi do the heavy lifting – enabling beautiful interactive visualisations with a single line of code (instead of hundreds).

Get Plotapi