Engaging plots, made easy.

Easily turn your data into engaging visualizations. Powerful API for coders. Powerful app for everyone.

main.py
notebook.ipynb
main.rs
from plotapi import Chord

Chord(matrix, names).show()

Visualizations Showcase

Degree Classification by Graduate Ethnicity with Terminus

In this notebook we're going to use PlotAPI Terminus to visualise how degree classes vary by graduates' ethnicity. We"ll use Python, but PlotAPI can be used from any programming language.


Preamble

from plotapi import Terminus
import json

Introduction

In this notebook we're going to use PlotAPI Terminus to visualise how degree classes vary by graduates' ethnicity. We"ll use Python, but PlotAPI can be used from any programming language.

In the Terminus diagram (a type of flow diagram), we can watch the journey of something or someone from some starting category to some ending category. In this case, we'll be watching each unit travel from a graduate's ethnicity to their awarded degree classification.

Dataset

We're going to use data that has been published by the Higher Education Statistics Agency (HESA) in the UK. The data table is titled "UK domiciled first degree qualifiers by classification of first degree, religious belief, sex, age group, disability marker, ethnicity marker, mode of study and academic year" and it can be found at this link.

We will use data from all countries, all modes of study, and from the academic year 2019/20. "Other" and "Not known" have been combined.

The degree class is the result achieved by a student UK, similar to a Grade Point Average (GPA). You can find a mapping between UK degree classifications and GPA here

data = [
    {"source": "White", "target": "First class", "value": 92260},
    {"source": "White", "target": "Second class (upper)", "value": 114885},
    {"source": "White", "target": "Second class (lower)", "value": 29325},
    {"source": "White", "target": "Third class", "value": 4775},
    {"source": "White", "target": "Unclassified", "value": 12585},
    
    {"source": "Black", "target": "First class", "value": 4340},
    {"source": "Black", "target": "Second class (upper)", "value": 10640},
    {"source": "Black", "target": "Second class (lower)", "value": 6245},
    {"source": "Black", "target": "Third class", "value": 1555},
    {"source": "Black", "target": "Unclassified", "value": 750},
    
    {"source": "Asian", "target": "First class", "value": 11515},
    {"source": "Asian", "target": "Second class (upper)", "value": 17925},
    {"source": "Asian", "target": "Second class (lower)", "value": 7080},
    {"source": "Asian", "target": "Third class", "value": 1440},
    {"source": "Asian", "target": "Unclassified", "value": 2710},
    
    {"source": "Mixed", "target": "First class", "value": 4575},
    {"source": "Mixed", "target": "Second class (upper)", "value": 6740},
    {"source": "Mixed", "target": "Second class (lower)", "value": 2095},
    {"source": "Mixed", "target": "Third class", "value": 355},
    {"source": "Mixed", "target": "Unclassified", "value": 565},
    
    {"source": "Other/NA", "target": "First class", "value": 1415 + 1370},
    {"source": "Other/NA", "target": "Second class (upper)", "value": 2385 + 2350},
    {"source": "Other/NA", "target": "Second class (lower)", "value": 1065 + 1380},
    {"source": "Other/NA", "target": "Third class", "value": 190 + 985},
    {"source": "Other/NA", "target": "Unclassified", "value": 290 + 635}
]

Visualisation

Let's use PlotAPI Terminus for this visualisation, you can see more examples in the Gallery.

We're going to adjust some layout and template parameters. We're setting percentage_by_source=True to see the degree class awarded as a percentage within ethnicity, i.e. each percentage column will sum to 100. We'll also set pixels_per_percentage=50 to control the length of the animation, making it shorter than the default of setting.

plot = Terminus(
    data,
    width=1000,
    percentage_by_source=True,
    pixels_per_percentage=50,
    title="Watch graduate's collect their degree (by percentage within ethnicity)",
)

Display inline

plot

Upload to cloud

With our plot created, let's upload it to PlotAPI cloud and get a shareable link.

plot.upload(
    name="Degree Classification By Graduate Ethnicity",
    description="""We're going to use PlotAPI Terminus to visualise how degree classes vary by graduates' ethnicity. We're going to use data that has been published by the Higher Education Statistics Agency (HESA) in the UK. The data table is titled "UK domiciled first degree qualifiers by classification of first degree, religious belief, sex, age group, disability marker, ethnicity marker, mode of study and academic year".""",
    public=True,
)
Your visualization has been uploaded successfully! You can view and share it at https://plotapi.com/explore/view/b7e5de9e-471d-4219-84e9-0abc75b2b7a9.
Previous
Showcase