Get the Books

Enjoying these notebooks and want to support the work? Check out the practical books on Data Science, Visualisation, and Evolutionary Algorithms.

Get the books

How Do Degree Classes Vary By Graduates' Gender?

Support this work

You can support this work by getting the e-books. This notebook will always be available for free in its online format.

Preamble

In [1]:
from plotapi import Terminus
import json

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

Introduction

In this notebook we're going to use Plotapi Terminus to visualise how degree classes vary by graduates' gender. 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 gender 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" was not included due to a small sample size..

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

In [2]:
data = [
    {"source": "Female", "target": "First class", "value": 68190},
    {"source": "Female", "target": "Second class (upper)", "value": 90935},
    {"source": "Female", "target": "Second class (lower)", "value": 25700},
    {"source": "Female", "target": "Third class", "value": 4940},
    {"source": "Female", "target": "Unclassified", "value": 10660},
    
    {"source": "Male", "target": "First class", "value": 47175},
    {"source": "Male", "target": "Second class (upper)", "value": 63870},
    {"source": "Male", "target": "Second class (lower)", "value": 21455},
    {"source": "Male", "target": "Third class", "value": 4350},
    {"source": "Male", "target": "Unclassified", "value": 6860}
]

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 pixels_per_unit=40 to represent $40$ graduates with a single pixel. This effects the length of the animation, making it shorter than the default of setting.

In [3]:
Terminus(data, bundled=True, pipe_alignment="middle", pixel_size=4, pixels_per_unit=40,
         title="Watch <plotapi_count> graduate's collect their degree").show()

Support this work

You can support this work by getting the e-books. This notebook will always be available for free in its online format.

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