{ "cells": [ { "cell_type": "markdown", "id": "2e8cff9a", "metadata": {}, "source": [ "# Goal: Recreate Gapminder's Bubble Chart*" ] }, { "cell_type": "markdown", "id": "0592be0b", "metadata": {}, "source": [ "![Gapminder](Gapminder.png)" ] }, { "cell_type": "markdown", "id": "7205f9df", "metadata": {}, "source": [ "*As much as possible..." ] }, { "cell_type": "markdown", "id": "a51e5440", "metadata": {}, "source": [ "See https://www.gapminder.org/tools/" ] }, { "cell_type": "markdown", "id": "fea83b75", "metadata": {}, "source": [ "## Import libraries" ] }, { "cell_type": "code", "execution_count": null, "id": "5f2b16b8", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import plotly.express as px\n", "import plotly.graph_objs as go" ] }, { "cell_type": "markdown", "id": "bc574529", "metadata": {}, "source": [ "## Load the data" ] }, { "cell_type": "code", "execution_count": null, "id": "088f9d42", "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv('Gapminder-data.csv', sep=',')" ] }, { "cell_type": "code", "execution_count": null, "id": "b3323617", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "9515c150", "metadata": {}, "outputs": [], "source": [ "df_info = pd.read_csv('Gapminder-info.csv', sep=',', index_col=0)" ] }, { "cell_type": "code", "execution_count": null, "id": "c27a468d", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "d096bd8f", "metadata": {}, "source": [ "## Create the bubble chart" ] }, { "cell_type": "code", "execution_count": null, "id": "872e455c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "e5629a50", "metadata": {}, "source": [ "## Add animation" ] }, { "cell_type": "code", "execution_count": null, "id": "aed99d63", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "2a7ea93d", "metadata": {}, "source": [ "## Use Dash" ] }, { "cell_type": "markdown", "id": "2851266c", "metadata": {}, "source": [ "- Dash html components: https://dash.plotly.com/dash-html-components\n", "- Dash core components: https://dash.plotly.com/dash-core-components" ] }, { "cell_type": "code", "execution_count": null, "id": "5c9e9d57", "metadata": {}, "outputs": [], "source": [ "from dash import Dash, html, dcc, callback, Output, Input" ] }, { "cell_type": "code", "execution_count": null, "id": "4a6a5520", "metadata": {}, "outputs": [], "source": [ "attributes = ['Income', 'Life expectancy', 'Fertility', 'Child mortality']\n", "external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']\n", "app = Dash(__name__, external_stylesheets=external_stylesheets)" ] }, { "cell_type": "code", "execution_count": null, "id": "a670d1c6", "metadata": {}, "outputs": [], "source": [] } ], "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.11.5" } }, "nbformat": 4, "nbformat_minor": 5 }