{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Preamble" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from plotapi import PieFight\n", "import json\n", "\n", "PieFight.set_license(\"your username\", \"your license key\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction\n", "\n", "In this notebook we're going to use Plotapi **Pie Fight** to visualise desktop browser market share over time. We\"ll use Python, but Plotapi can be used from any programming language." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Dataset" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We're going to use data that has been published by multiple sources for different periods, as there is no single data source that covers everything. These are:\n", "- 1994 - 1995: GVU WWW user survey\n", "- 1996 - 1998: EWS Web Server at UIUC \n", "- 1999 - 2001: WebSideStory\n", "- 2002 - 2008: OneStat.com\n", "- 2009-2021: StatCounter\n", "\n", "The popup text that describes different events was taken from Wikipedia.\n", "\n", "Browsers that did not have significant market share have been grouped and labelled as \"Others\"." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "with open(\"desktop_browsers.json\", \"r\") as f:\n", " data = json.load(f)\n", " \n", "samples = data['samples']\n", "nodes = data['nodes']\n", "events = data['events']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Visualisation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's use Plotapi Pie Fight for this visualisation, you can see more examples [in the Gallery](https://plotapi.com/gallery/).\n", "\n", "
" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", " \n", " Plotapi - Pie Fight Diagram\n", "\n", " \n", "\n", " \n", "\n", "\n", "\n", "
\n", " \n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "PieFight(samples, \n", " nodes=nodes,\n", " events=events,\n", " rotate=30,\n", " interval=750,\n", " event_pause=False,\n", " event_duration=10000,\n", " format_current_order=\"0.2f\", \n", " value_suffix=\"%\",\n", " autohide_labels=False).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 }