{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Preamble" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from plotapi import Terminus\n", "import json\n", "\n", "Terminus.set_license(\"your username\", \"your license key\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction\n", "\n", "In this notebook we're going to use Plotapi Terminus to visualise the average daily email & spam volume for August 2021.\n", "\n", "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 emails travel from their classification (legitimate or spam) to their recipients represented by a single inbox.\n", "\n", "_There is no doubt that this data would be better communicated with a bar or pie chart. This is a fun exercise._" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Dataset" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We're going to use the Email & Spam data published by Talos Intelligence over at [this page](https://talosintelligence.com/reputation_center/email_rep). The numbers we're interested in are under the heading _TOTAL GLOBAL EMAIL & SPAM VOLUME FOR AUGUST 2021_, labelled with _Average Daily Legitimate Email Volume_ and _Average Daily Spam Volume_." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "data = [\n", " {\"source\": \"Legitimate\", \"target\": \"Inboxes\", \"value\": 12.30*(10**9)}, \n", " {\"source\": \"Spam\", \"target\": \"Inboxes\", \"value\": 65.50*(10**9)},\n", "]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Visualisation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's use Plotapi Terminus for this visualisation, you can see more examples [in the Gallery](https://plotapi.com/gallery/).\n", "\n", "We're going to adjust some layout and template parameters. We're setting `pixels_per_unit=10**7` to represent $10$ million emails with a single pixel. This effects the length of the animation, making it shorter than the default of setting.
" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " Plotapi - Terminus Diagram\n", " \n", " \n", " \n", "\n", " \n", "
\n", " \n", " \n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Terminus(data, colors=['#56c885','#ea647e'],\n", " title=\"Watch emails sent during an Aug-2021 day\",\n", " vertical=True, width=400, pipe_alignment=\"middle\", \n", " pixels_per_unit=10**7).show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.1" } }, "nbformat": 4, "nbformat_minor": 4 }