30239-notes/03.charts/examples.ipynb
2024-09-28 14:45:22 -05:00

291 lines
42 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 43,
"id": "4a015e87-cf20-47b0-b271-a9dc1c38f2b3",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<style>\n",
" #altair-viz-6e4fea272d6f4342b396f5d5f1715ba6.vega-embed {\n",
" width: 100%;\n",
" display: flex;\n",
" }\n",
"\n",
" #altair-viz-6e4fea272d6f4342b396f5d5f1715ba6.vega-embed details,\n",
" #altair-viz-6e4fea272d6f4342b396f5d5f1715ba6.vega-embed details summary {\n",
" position: relative;\n",
" }\n",
"</style>\n",
"<div id=\"altair-viz-6e4fea272d6f4342b396f5d5f1715ba6\"></div>\n",
"<script type=\"text/javascript\">\n",
" var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
" (function(spec, embedOpt){\n",
" let outputDiv = document.currentScript.previousElementSibling;\n",
" if (outputDiv.id !== \"altair-viz-6e4fea272d6f4342b396f5d5f1715ba6\") {\n",
" outputDiv = document.getElementById(\"altair-viz-6e4fea272d6f4342b396f5d5f1715ba6\");\n",
" }\n",
" const paths = {\n",
" \"vega\": \"https://cdn.jsdelivr.net/npm/vega@5?noext\",\n",
" \"vega-lib\": \"https://cdn.jsdelivr.net/npm/vega-lib?noext\",\n",
" \"vega-lite\": \"https://cdn.jsdelivr.net/npm/vega-lite@5.20.1?noext\",\n",
" \"vega-embed\": \"https://cdn.jsdelivr.net/npm/vega-embed@6?noext\",\n",
" };\n",
"\n",
" function maybeLoadScript(lib, version) {\n",
" var key = `${lib.replace(\"-\", \"\")}_version`;\n",
" return (VEGA_DEBUG[key] == version) ?\n",
" Promise.resolve(paths[lib]) :\n",
" new Promise(function(resolve, reject) {\n",
" var s = document.createElement('script');\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" s.async = true;\n",
" s.onload = () => {\n",
" VEGA_DEBUG[key] = version;\n",
" return resolve(paths[lib]);\n",
" };\n",
" s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
" s.src = paths[lib];\n",
" });\n",
" }\n",
"\n",
" function showError(err) {\n",
" outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
" throw err;\n",
" }\n",
"\n",
" function displayChart(vegaEmbed) {\n",
" vegaEmbed(outputDiv, spec, embedOpt)\n",
" .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
" }\n",
"\n",
" if(typeof define === \"function\" && define.amd) {\n",
" requirejs.config({paths});\n",
" require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
" } else {\n",
" maybeLoadScript(\"vega\", \"5\")\n",
" .then(() => maybeLoadScript(\"vega-lite\", \"5.20.1\"))\n",
" .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
" .catch(showError)\n",
" .then(() => displayChart(vegaEmbed));\n",
" }\n",
" })({\"config\": {\"view\": {\"continuousWidth\": 300, \"continuousHeight\": 300}}, \"layer\": [{\"data\": {\"name\": \"data-01eed797016d7a820140a15818a43ac7\"}, \"mark\": {\"type\": \"line\"}, \"encoding\": {\"color\": {\"field\": \"symbol\", \"type\": \"nominal\"}, \"x\": {\"field\": \"date\", \"type\": \"temporal\"}, \"y\": {\"field\": \"price\", \"type\": \"quantitative\"}}}, {\"data\": {\"name\": \"empty\"}, \"mark\": {\"type\": \"text\", \"color\": \"black\", \"dx\": -45, \"dy\": -130}, \"encoding\": {\"text\": {\"datum\": \"iPhone Released\"}, \"x\": {\"datum\": {\"month\": \"June\", \"year\": 2007}}}}, {\"data\": {\"name\": \"empty\"}, \"mark\": {\"type\": \"rule\", \"color\": \"black\", \"strokeWidth\": 1}, \"encoding\": {\"x\": {\"datum\": {\"month\": \"June\", \"year\": 2007}}}}, {\"data\": {\"name\": \"empty\"}, \"mark\": {\"type\": \"text\", \"color\": \"black\", \"dx\": 45, \"dy\": 60}, \"encoding\": {\"text\": {\"datum\": \"2008 Financial Crisis\"}, \"x\": {\"datum\": {\"month\": \"November\", \"year\": 2008}}}}, {\"data\": {\"name\": \"empty\"}, \"mark\": {\"type\": \"rect\", \"color\": \"#cccccc33\"}, \"encoding\": {\"text\": {\"datum\": \"2008 Financial Crisis\"}, \"x\": {\"datum\": {\"month\": \"January\", \"year\": 2008}}, \"x2\": {\"datum\": {\"month\": \"January\", \"year\": 2009}}}}], \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.20.1.json\", \"datasets\": {\"data-01eed797016d7a820140a15818a43ac7\": [{\"symbol\": \"MSFT\", \"date\": \"2005-02-01T00:00:00\", \"price\": 23.15}, {\"symbol\": \"MSFT\", \"date\": \"2005-03-01T00:00:00\", \"price\": 22.24}, {\"symbol\": \"MSFT\", \"date\": \"2005-04-01T00:00:00\", \"price\": 23.28}, {\"symbol\": \"MSFT\", \"date\": \"2005-05-01T00:00:00\", \"price\": 23.82}, {\"symbol\": \"MSFT\", \"date\": \"2005-06-01T00:00:00\", \"price\": 22.93}, {\"symbol\": \"MSFT\", \"date\": \"2005-07-01T00:00:00\", \"price\": 23.64}, {\"symbol\": \"MSFT\", \"date\": \"2005-08-01T00:00:00\", \"price\": 25.35}, {\"symbol\": \"MSFT\", \"date\": \"2005-09-01T00:00:00\", \"price\": 23.83}, {\"symbol\": \"MSFT\", \"date\": \"2005-10-01T00:00:00\", \"price\": 23.8}, {\"symbol\": \"MSFT\", \"date\": \"2005-11-01T00:00:00\", \"price\": 25.71}, {\"symbol\": \"MSFT\", \"date\": \"2005-12-01T00:00:00\", \"price\": 24.29}, {\"symbol\": \"MSFT\", \"date\": \"2006-01-01T00:00:00\", \"price\": 26.14}, {\"symbol\": \"MSFT\", \"date\": \"2006-02-01T00:00:00\", \"price\": 25.04}, {\"symbol\": \"MSFT\", \"date\": \"2006-03-01T00:00:00\", \"price\": 25.36}, {\"symbol\": \"MSFT\", \"date\": \"2006-04-01T00:00:00\", \"price\": 22.5}, {\"symbol\": \"MSFT\", \"date\": \"2006-05-01T00:00:00\", \"price\": 21.19}, {\"symbol\": \"MSFT\", \"date\": \"2006-06-01T00:00:00\", \"price\": 21.8}, {\"symbol\": \"MSFT\", \"date\": \"2006-07-01T00:00:00\", \"price\": 22.51}, {\"symbol\": \"MSFT\", \"date\": \"2006-08-01T00:00:00\", \"price\": 24.13}, {\"symbol\": \"MSFT\", \"date\": \"2006-09-01T00:00:00\", \"price\": 25.68}, {\"symbol\": \"MSFT\", \"date\": \"2006-10-01T00:00:00\", \"price\": 26.96}, {\"symbol\": \"MSFT\", \"date\": \"2006-11-01T00:00:00\", \"price\": 27.66}, {\"symbol\": \"MSFT\", \"date\": \"2006-12-01T00:00:00\", \"price\": 28.13}, {\"symbol\": \"MSFT\", \"date\": \"2007-01-01T00:00:00\", \"price\": 29.07}, {\"symbol\": \"MSFT\", \"date\": \"2007-02-01T00:00:00\", \"price\": 26.63}, {\"symbol\": \"MSFT\", \"date\": \"2007-03-01T00:00:00\", \"price\": 26.35}, {\"symbol\": \"MSFT\", \"date\": \"2007-04-01T00:00:00\", \"price\": 28.3}, {\"symbol\": \"MSFT\", \"date\": \"2007-05-01T00:00:00\", \"price\": 29.11}, {\"symbol\": \"MSFT\", \"date\": \"2007-06-01T00:00:00\", \"price\": 27.95}, {\"symbol\": \"MSFT\", \"date\": \"2007-07-01T00:00:00\", \"price\": 27.5}, {\"symbol\": \"MSFT\", \"date\": \"2007-08-01T00:00:00\", \"price\": 27.34}, {\"symbol\": \"MSFT\", \"date\": \"2007-09-01T00:00:00\", \"price\": 28.04}, {\"symbol\": \"MSFT\", \"date\": \"2007-10-01T00:00:00\", \"price\": 35.03}, {\"symbol\": \"MSFT\", \"date\": \"2007-11-01T00:00:00\", \"price\": 32.09}, {\"symbol\": \"MSFT\", \"date\": \"2007-12-01T00:00:00\", \"price\": 34.0}, {\"symbol\": \"MSFT\", \"date\": \"2008-01-01T00:00:00\", \"price\": 31.13}, {\"symbol\": \"MSFT\", \"date\": \"2008-02-01T00:00:00\", \"price\": 26.07}, {\"symbol\": \"MSFT\", \"date\": \"2008-03-01T00:00:00\", \"price\": 27.21}, {\"symbol\": \"MSFT\", \"date\": \"2008-04-01T00:00:00\", \"price\": 27.34}, {\"symbol\": \"MSFT\", \"date\": \"2008-05-01T00:00:00\", \"price\": 27.25}, {\"symbol\": \"MSFT\", \"date\": \"2008-06-01T00:00:00\", \"price\": 26.47}, {\"symbol\": \"MSFT\", \"date\": \"2008-07-01T00:00:00\", \"price\": 24.75}, {\"symbol\": \"MSFT\", \"date\": \"2008-08-01T00:00:00\", \"price\": 26.36}, {\"symbol\": \"MSFT\", \"date\": \"2008-09-01T00:00:00\", \"price\": 25.78}, {\"symbol\": \"MSFT\", \"date\": \"2008-10-01T00:00:00\", \"price\": 21.57}, {\"symbol\": \"MSFT\", \"date\": \"2008-11-01T00:00:00\", \"price\": 19.66}, {\"symbol\": \"MSFT\", \"date\": \"2008-12-01T00:00:00\", \"price\": 18.91}, {\"symbol\": \"MSFT\", \"date\": \"2009-01-01T00:00:00\", \"price\": 16.63}, {\"symbol\": \"MSFT\", \"date\": \"2009-02-01T00:00:00\", \"price\": 15.81}, {\"symbol\": \"MSFT\", \"date\": \"2009-03-01T00:00:00\", \"price\": 17.99}, {\"symbol\": \"MSFT\", \"date\": \"2009-04-01T00:00:00\", \"price\": 19.84}, {\"symbol\": \"MSFT\", \"date\": \"2009-05-01T00:00:00\", \"price\": 20.59}, {\"symbol\": \"MSFT\", \"date\": \"2009-06-01T00:00:00\", \"price\": 23.42}, {\"symbol\": \"MSFT\", \"date\": \"2009-07-01T00:00:00\", \"price\": 23.18}, {\"symbol\": \"MSFT\", \"date\": \"2009-08-01T00:00:00\", \"price\": 24.43}, {\"symbol\": \"MSFT\", \"date\": \"2009-09-01T00:00:00\", \"price\": 25.49}, {\"symbol\": \"MSFT\", \"date\": \"2009-10-01T00:00:00\", \"price\": 27.48}, {\"symbol\": \"MSFT\", \"date\": \"2009-11-01T00:00:00\", \"price\": 29.27}, {\"symbol\": \"MSFT\", \"date\": \"2009-12-01T00:00:00\", \"price\": 30.34}, {\"symbol\": \"MSFT\", \"date\": \"2010-01-01T00:00:00\", \"price\": 28.05}, {\"symbol\": \"MSFT\", \"date\": \"2010-02-01T00:00:00\", \"price\": 28.67}, {\"symbol\": \"MSFT\", \"date\": \"2010-03-01T00:00:00\", \"price\": 28.8}, {\"symbol\": \"AMZN\", \"date\": \"2005-02-01T00:00:00\", \"price\": 35.18}, {\"symbol\": \"AMZN\", \"date\": \"2005-03-01T00:00:00\", \"price\": 34.27}, {\"symbol\": \"AMZN\", \"date\": \"2005-04-01T00:00:00\", \"price\": 32.36}, {\"symbol\": \"AMZN\", \"date\": \"2005-05-01T00:00:00\", \"price\": 35.51}, {\"symbol\": \"AMZN\", \"date\": \"2005-06-01T00:00:00\", \"price\": 33.09}, {\"symbol\": \"AMZN\", \"date\": \"2005-07-01T00:00:00\", \"price\": 45.15}, {\"symbol\": \"AMZN\", \"date\": \"2005-08-01T00:00:00\", \"price\": 42.7}, {\"symbol\": \"AMZN\", \"date\": \"2005-09-01T00:00:00\", \"price\": 45.3}, {\"symbol\": \"AMZN\", \"date\": \"2005-10-01T00:00:00\", \"price\": 39.86}, {\"symbol\": \"AMZN\", \"date\": \"2005-11-01T00:00:00\", \"price\": 48.46}, {\"symbol\": \"AMZN\", \"date\": \"2005-12-01T00:00:00\", \"price\": 47.15}, {\"symbol\": \"AMZN\", \"date\": \"2006-01-01T00:00:00\", \"price\": 44.82}, {\"symbol\": \"AMZN\", \"date\": \"2006-02-01T00:00:00\", \"price\": 37.44}, {\"symbol\": \"AMZN\", \"date\": \"2006-03-01T00:00:00\", \"price\": 36.53}, {\"symbol\": \"AMZN\", \"date\": \"2006-04-01T00:00:00\", \"price\": 35.21}, {\"symbol\": \"AMZN\", \"date\": \"2006-05-01T00:00:00\", \"price\": 34.61}, {\"symbol\": \"AMZN\", \"date\": \"2006-06-01T00:00:00\", \"price\": 38.68}, {\"symbol\": \"AMZN\", \"date\": \"2006-07-01T00:00:00\", \"price\": 26.89}, {\"symbol\": \"AMZN\", \"date\": \"2006-08-01T00:00:00\", \"price\": 30.83}, {\"symbol\": \"AMZN\", \"date\": \"2006-09-01T00:00:00\", \"price\": 32.12}, {\"symbol\": \"AMZN\", \"date\": \"2006-10-01T00:00:00\", \"price\": 38.09}, {\"symbol\": \"AMZN\", \"date\": \"2006-11-01T00:00:00\", \"price\": 40.34}, {\"symbol\": \"AMZN\", \"date\": \"2006-12-01T00:00:00\", \"price\": 39.46}, {\"symbol\": \"AMZN\", \"date\": \"2007-01-01T00:00:00\", \"price\": 37.67}, {\"symbol\": \"AMZN\", \"date\": \"2007-02-01T00:00:00\", \"price\": 39.14}, {\"symbol\": \"AMZN\", \"date\": \"2007-03-01T00:00:00\", \"price\": 39.79}, {\"symbol\": \"AMZN\", \"date\": \"2007-04-01T00:00:00\", \"price\": 61.33}, {\"symbol\": \"AMZN\", \"date\": \"2007-05-01T00:00:00\", \"price\": 69.14}, {\"symbol\": \"AMZN\", \"date\": \"2007-06-01T00:00:00\", \"price\": 68.41}, {\"symbol\": \"AMZN\", \"date\": \"2007-07-01T00:00:00\", \"price\": 78.54}, {\"symbol\": \"AMZN\", \"date\": \"2007-08-01T00:00:00\", \"price\": 79.91}, {\"symbol\": \"AMZN\", \"date\": \"2007-09-01T00:00:00\", \"price\": 93.15}, {\"symbol\": \"AMZN\", \"date\": \"2007-10-01T00:00:00\", \"price\": 89.15}, {\"symbol\": \"AMZN\", \"date\": \"2007-11-01T00:00:00\", \"price\": 90.56}, {\"symbol\": \"AMZN\", \"date\": \"2007-12-01T00:00:00\", \"price\": 92.64}, {\"symbol\": \"AMZN\", \"date\": \"2008-01-01T00:00:00\", \"price\": 77.7}, {\"symbol\": \"AMZN\", \"date\": \"2008-02-01T00:00:00\", \"price\": 64.47}, {\"symbol\": \"AMZN\", \"date\": \"2008-03-01T00:00:00\", \"price\": 71.3}, {\"symbol\": \"AMZN\", \"date\": \"2008-04-01T00:00:00\", \"price\": 78.63}, {\"symbol\": \"AMZN\", \"date\": \"2008-05-01T00:00:00\", \"price\": 81.62}, {\"symbol\": \"AMZN\", \"date\": \"2008-06-01T00:00:00\", \"price\": 73.33}, {\"symbol\": \"AMZN\", \"date\": \"2008-07-01T00:00:00\", \"price\": 76.34}, {\"symbol\": \"AMZN\", \"date\": \"2008-08-01T00:00:00\", \"price\": 80.81}, {\"symbol\": \"AMZN\", \"date\": \"2008-09-01T00:00:00\", \"price\": 72.76}, {\"symbol\": \"AMZN\", \"date\": \"2008-10-01T00:00:00\", \"price\": 57.24}, {\"symbol\": \"AMZN\", \"date\": \"2008-11-01T00:00:00\", \"price\": 42.7}, {\"symbol\": \"AMZN\", \"date\": \"2008-12-01T00:00:00\", \"price\": 51.28}, {\"symbol\": \"AMZN\", \"date\": \"2009-01-01T00:00:00\", \"price\": 58.82}, {\"symbol\": \"AMZN\", \"date\": \"2009-02-01T00:00:00\", \"price\": 64.79}, {\"symbol\": \"AMZN\", \"date\": \"2009-03-01T00:00:00\", \"price\": 73.44}, {\"symbol\": \"AMZN\", \"date\": \"2009-04-01T00:00:00\", \"price\": 80.52}, {\"symbol\": \"AMZN\", \"date\": \"2009-05-01T00:00:00\", \"price\": 77.99}, {\"symbol\": \"AMZN\", \"date\": \"2009-06-01T00:00:00\", \"price\": 83.66}, {\"symbol\": \"AMZN\", \"date\": \"2009-07-01T00:00:00\", \"price\": 85.76}, {\"symbol\": \"AMZN\", \"date\": \"2009-08-01T00:00:00\", \"price\": 81.19}, {\"symbol\": \"AMZN\", \"date\": \"2009-09-01T00:00:00\", \"price\": 93.36}, {\"symbol\": \"AMZN\", \"date\": \"2009-10-01T00:00:00\", \"price\": 118.81}, {\"symbol\": \"AMZN\", \"date\": \"2009-11-01T00:00:00\", \"price\": 135.91}, {\"symbol\": \"AMZN\", \"date\": \"2009-12-01T00:00:00\", \"price\": 134.52}, {\"symbol\": \"AMZN\", \"date\": \"2010-01-01T00:00:00\", \"price\": 125.41}, {\"symbol\": \"AMZN\", \"date\": \"2010-02-01T00:00:00\", \"price\": 118.4}, {\"symbol\": \"AMZN\", \"date\": \"2010-03-01T00:00:00\", \"price\": 128.82}, {\"symbol\": \"IBM\", \"date\": \"2005-02-01T00:00:00\", \"price\": 85.78}, {\"symbol\": \"IBM\", \"date\": \"2005-03-01T00:00:00\", \"price\": 84.66}, {\"symbol\": \"IBM\", \"date\": \"2005-04-01T00:00:00\", \"price\": 70.77}, {\"symbol\": \"IBM\", \"date\": \"2005-05-01T00:00:00\", \"price\": 70.18}, {\"symbol\": \"IBM\", \"date\": \"2005-06-01T00:00:00\", \"price\": 68.93}, {\"symbol\": \"IBM\", \"date\": \"2005-07-01T00:00:00\", \"price\": 77.53}, {\"symbol\": \"IBM\", \"date\": \"2005-08-01T00:00:00\", \"price\": 75.07}, {\"symbol\": \"IBM\", \"date\": \"2005-09-01T00:00:00\", \"price\": 74.7}, {\"symbol\": \"IBM\", \"date\": \"2005-10-01T00:00:00\", \"price\": 76.25}, {\"symbol\": \"IBM\", \"date\": \"2005-11-01T00:00:00\", \"price\": 82.98}, {\"symbol\": \"IBM\", \"date\": \"2005-12-01T00:00:00\", \"price\": 76.73}, {\"symbol\": \"IBM\", \"date\": \"2006-01-01T00:00:00\", \"price\": 75.89}, {\"symbol\": \"IBM\", \"date\": \"2006-02-01T00:00:00\", \"price\": 75.09}, {\"symbol\": \"IBM\", \"date\": \"2006-03-01T00:00:00\", \"price\": 77.17}, {\"symbol\": \"IBM\", \"date\": \"2006-04-01T00:00:00\", \"price\": 77.05}, {\"symbol\": \"IBM\", \"date\": \"2006-05-01T00:00:00\", \"price\": 75.04}, {\"symbol\": \"IBM\", \"date\": \"2006-06-01T00:00:00\", \"price\": 72.15}, {\"symbol\": \"IBM\", \"date\": \"2006-07-01T00:00:00\", \"price\": 72.7}, {\"symbol\": \"IBM\", \"date\": \"2006-08-01T00:00:00\", \"price\": 76.35}, {\"symbol\": \"IBM\", \"date\": \"2006-09-01T00:00:00\", \"price\": 77.26}, {\"symbol\": \"IBM\", \"date\": \"2006-10-01T00:00:00\", \"price\": 87.06}, {\"symbol\": \"IBM\", \"date\": \"2006-11-01T00:00:00\", \"price\": 86.95}, {\"symbol\": \"IBM\", \"date\": \"2006-12-01T00:00:00\", \"price\": 91.9}, {\"symbol\": \"IBM\", \"date\": \"2007-01-01T00:00:00\", \"price\": 93.79}, {\"symbol\": \"IBM\", \"date\": \"2007-02-01T00:00:00\", \"price\": 88.18}, {\"symbol\": \"IBM\", \"date\": \"2007-03-01T00:00:00\", \"price\": 89.44}, {\"symbol\": \"IBM\", \"date\": \"2007-04-01T00:00:00\", \"price\": 96.98}, {\"symbol\": \"IBM\", \"date\": \"2007-05-01T00:00:00\", \"price\": 101.54}, {\"symbol\": \"IBM\", \"date\": \"2007-06-01T00:00:00\", \"price\": 100.25}, {\"symbol\": \"IBM\", \"date\": \"2007-07-01T00:00:00\", \"price\": 105.4}, {\"symbol\": \"IBM\", \"date\": \"2007-08-01T00:00:00\", \"price\": 111.54}, {\"symbol\": \"IBM\", \"date\": \"2007-09-01T00:00:00\", \"price\": 112.6}, {\"symbol\": \"IBM\", \"date\": \"2007-10-01T00:00:00\", \"price\": 111.0}, {\"symbol\": \"IBM\", \"date\": \"2007-11-01T00:00:00\", \"price\": 100.9}, {\"symbol\": \"IBM\", \"date\": \"2007-12-01T00:00:00\", \"price\": 103.7}, {\"symbol\": \"IBM\", \"date\": \"2008-01-01T00:00:00\", \"price\": 102.75}, {\"symbol\": \"IBM\", \"date\": \"2008-02-01T00:00:00\", \"price\": 109.64}, {\"symbol\": \"IBM\", \"date\": \"2008-03-01T00:00:00\", \"price\": 110.87}, {\"symbol\": \"IBM\", \"date\": \"2008-04-01T00:00:00\", \"price\": 116.23}, {\"symbol\": \"IBM\", \"date\": \"2008-05-01T00:00:00\", \"price\": 125.14}, {\"symbol\": \"IBM\", \"date\": \"2008-06-01T00:00:00\", \"price\": 114.6}, {\"symbol\": \"IBM\", \"date\": \"2008-07-01T00:00:00\", \"price\": 123.74}, {\"symbol\": \"IBM\", \"date\": \"2008-08-01T00:00:00\", \"price\": 118.16}, {\"symbol\": \"IBM\", \"date\": \"2008-09-01T00:00:00\", \"price\": 113.53}, {\"symbol\": \"IBM\", \"date\": \"2008-10-01T00:00:00\", \"price\": 90.24}, {\"symbol\": \"IBM\", \"date\": \"2008-11-01T00:00:00\", \"price\": 79.65}, {\"symbol\": \"IBM\", \"date\": \"2008-12-01T00:00:00\", \"price\": 82.15}, {\"symbol\": \"IBM\", \"date\": \"2009-01-01T00:00:00\", \"price\": 89.46}, {\"symbol\": \"IBM\", \"date\": \"2009-02-01T00:00:00\", \"price\": 90.32}, {\"symbol\": \"IBM\", \"date\": \"2009-03-01T00:00:00\", \"price\": 95.09}, {\"symbol\": \"IBM\", \"date\": \"2009-04-01T00:00:00\", \"price\": 101.29}, {\"symbol\": \"IBM\", \"date\": \"2009-05-01T00:00:00\", \"price\": 104.85}, {\"symbol\": \"IBM\", \"date\": \"2009-06-01T00:00:00\", \"price\": 103.01}, {\"symbol\": \"IBM\", \"date\": \"2009-07-01T00:00:00\", \"price\": 116.34}, {\"symbol\": \"IBM\", \"date\": \"2009-08-01T00:00:00\", \"price\": 117.0}, {\"symbol\": \"IBM\", \"date\": \"2009-09-01T00:00:00\", \"price\": 118.55}, {\"symbol\": \"IBM\", \"date\": \"2009-10-01T00:00:00\", \"price\": 119.54}, {\"symbol\": \"IBM\", \"date\": \"2009-11-01T00:00:00\", \"price\": 125.79}, {\"symbol\": \"IBM\", \"date\": \"2009-12-01T00:00:00\", \"price\": 130.32}, {\"symbol\": \"IBM\", \"date\": \"2010-01-01T00:00:00\", \"price\": 121.85}, {\"symbol\": \"IBM\", \"date\": \"2010-02-01T00:00:00\", \"price\": 127.16}, {\"symbol\": \"IBM\", \"date\": \"2010-03-01T00:00:00\", \"price\": 125.55}, {\"symbol\": \"GOOG\", \"date\": \"2005-02-01T00:00:00\", \"price\": 187.99}, {\"symbol\": \"GOOG\", \"date\": \"2005-03-01T00:00:00\", \"price\": 180.51}, {\"symbol\": \"GOOG\", \"date\": \"2005-04-01T00:00:00\", \"price\": 220.0}, {\"symbol\": \"GOOG\", \"date\": \"2005-05-01T00:00:00\", \"price\": 277.27}, {\"symbol\": \"GOOG\", \"date\": \"2005-06-01T00:00:00\", \"price\": 294.15}, {\"symbol\": \"GOOG\", \"date\": \"2005-07-01T00:00:00\", \"price\": 287.76}, {\"symbol\": \"GOOG\", \"date\": \"2005-08-01T00:00:00\", \"price\": 286.0}, {\"symbol\": \"GOOG\", \"date\": \"2005-09-01T00:00:00\", \"price\": 316.46}, {\"symbol\": \"GOOG\", \"date\": \"2005-10-01T00:00:00\", \"price\": 372.14}, {\"symbol\": \"GOOG\", \"date\": \"2005-11-01T00:00:00\", \"price\": 404.91}, {\"symbol\": \"GOOG\", \"date\": \"2005-12-01T00:00:00\", \"price\": 414.86}, {\"symbol\": \"GOOG\", \"date\": \"2006-01-01T00:00:00\", \"price\": 432.66}, {\"symbol\": \"GOOG\", \"date\": \"2006-02-01T00:00:00\", \"price\": 362.62}, {\"symbol\": \"GOOG\", \"date\": \"2006-03-01T00:00:00\", \"price\": 390.0}, {\"symbol\": \"GOOG\", \"date\": \"2006-04-01T00:00:00\", \"price\": 417.94}, {\"symbol\": \"GOOG\", \"date\": \"2006-05-01T00:00:00\", \"price\": 371.82}, {\"symbol\": \"GOOG\", \"date\": \"2006-06-01T00:00:00\", \"price\": 419.33}, {\"symbol\": \"GOOG\", \"date\": \"2006-07-01T00:00:00\", \"price\": 386.6}, {\"symbol\": \"GOOG\", \"date\": \"2006-08-01T00:00:00\", \"price\": 378.53}, {\"symbol\": \"GOOG\", \"date\": \"2006-09-01T00:00:00\", \"price\": 401.9}, {\"symbol\": \"GOOG\", \"date\": \"2006-10-01T00:00:00\", \"price\": 476.39}, {\"symbol\": \"GOOG\", \"date\": \"2006-11-01T00:00:00\", \"price\": 484.81}, {\"symbol\": \"GOOG\", \"date\": \"2006-12-01T00:00:00\", \"price\": 460.48}, {\"symbol\": \"GOOG\", \"date\": \"2007-01-01T00:00:00\", \"price\": 501.5}, {\"symbol\": \"GOOG\", \"date\": \"2007-02-01T00:00:00\", \"price\": 449.45}, {\"symbol\": \"GOOG\", \"date\": \"2007-03-01T00:00:00\", \"price\": 458.16}, {\"symbol\": \"GOOG\", \"date\": \"2007-04-01T00:00:00\", \"price\": 471.38}, {\"symbol\": \"GOOG\", \"date\": \"2007-05-01T00:00:00\", \"price\": 497.91}, {\"symbol\": \"GOOG\", \"date\": \"2007-06-01T00:00:00\", \"price\": 522.7}, {\"symbol\": \"GOOG\", \"date\": \"2007-07-01T00:00:00\", \"price\": 510.0}, {\"symbol\": \"GOOG\", \"date\": \"2007-08-01T00:00:00\", \"price\": 515.25}, {\"symbol\": \"GOOG\", \"date\": \"2007-09-01T00:00:00\", \"price\": 567.27}, {\"symbol\": \"GOOG\", \"date\": \"2007-10-01T00:00:00\", \"price\": 707.0}, {\"symbol\": \"GOOG\", \"date\": \"2007-11-01T00:00:00\", \"price\": 693.0}, {\"symbol\": \"GOOG\", \"date\": \"2007-12-01T00:00:00\", \"price\": 691.48}, {\"symbol\": \"GOOG\", \"date\": \"2008-01-01T00:00:00\", \"price\": 564.3}, {\"symbol\": \"GOOG\", \"date\": \"2008-02-01T00:00:00\", \"price\": 471.18}, {\"symbol\": \"GOOG\", \"date\": \"2008-03-01T00:00:00\", \"price\": 440.47}, {\"symbol\": \"GOOG\", \"date\": \"2008-04-01T00:00:00\", \"price\": 574.29}, {\"symbol\": \"GOOG\", \"date\": \"2008-05-01T00:00:00\", \"price\": 585.8}, {\"symbol\": \"GOOG\", \"date\": \"2008-06-01T00:00:00\", \"price\": 526.42}, {\"symbol\": \"GOOG\", \"date\": \"2008-07-01T00:00:00\", \"price\": 473.75}, {\"symbol\": \"GOOG\", \"date\": \"2008-08-01T00:00:00\", \"price\": 463.29}, {\"symbol\": \"GOOG\", \"date\": \"2008-09-01T00:00:00\", \"price\": 400.52}, {\"symbol\": \"GOOG\", \"date\": \"2008-10-01T00:00:00\", \"price\": 359.36}, {\"symbol\": \"GOOG\", \"date\": \"2008-11-01T00:00:00\", \"price\": 292.96}, {\"symbol\": \"GOOG\", \"date\": \"2008-12-01T00:00:00\", \"price\": 307.65}, {\"symbol\": \"GOOG\", \"date\": \"2009-01-01T00:00:00\", \"price\": 338.53}, {\"symbol\": \"GOOG\", \"date\": \"2009-02-01T00:00:00\", \"price\": 337.99}, {\"symbol\": \"GOOG\", \"date\": \"2009-03-01T00:00:00\", \"price\": 348.06}, {\"symbol\": \"GOOG\", \"date\": \"2009-04-01T00:00:00\", \"price\": 395.97}, {\"symbol\": \"GOOG\", \"date\": \"2009-05-01T00:00:00\", \"price\": 417.23}, {\"symbol\": \"GOOG\", \"date\": \"2009-06-01T00:00:00\", \"price\": 421.59}, {\"symbol\": \"GOOG\", \"date\": \"2009-07-01T00:00:00\", \"price\": 443.05}, {\"symbol\": \"GOOG\", \"date\": \"2009-08-01T00:00:00\", \"price\": 461.67}, {\"symbol\": \"GOOG\", \"date\": \"2009-09-01T00:00:00\", \"price\": 495.85}, {\"symbol\": \"GOOG\", \"date\": \"2009-10-01T00:00:00\", \"price\": 536.12}, {\"symbol\": \"GOOG\", \"date\": \"2009-11-01T00:00:00\", \"price\": 583.0}, {\"symbol\": \"GOOG\", \"date\": \"2009-12-01T00:00:00\", \"price\": 619.98}, {\"symbol\": \"GOOG\", \"date\": \"2010-01-01T00:00:00\", \"price\": 529.94}, {\"symbol\": \"GOOG\", \"date\": \"2010-02-01T00:00:00\", \"price\": 526.8}, {\"symbol\": \"GOOG\", \"date\": \"2010-03-01T00:00:00\", \"price\": 560.19}, {\"symbol\": \"AAPL\", \"date\": \"2005-02-01T00:00:00\", \"price\": 44.86}, {\"symbol\": \"AAPL\", \"date\": \"2005-03-01T00:00:00\", \"price\": 41.67}, {\"symbol\": \"AAPL\", \"date\": \"2005-04-01T00:00:00\", \"price\": 36.06}, {\"symbol\": \"AAPL\", \"date\": \"2005-05-01T00:00:00\", \"price\": 39.76}, {\"symbol\": \"AAPL\", \"date\": \"2005-06-01T00:00:00\", \"price\": 36.81}, {\"symbol\": \"AAPL\", \"date\": \"2005-07-01T00:00:00\", \"price\": 42.65}, {\"symbol\": \"AAPL\", \"date\": \"2005-08-01T00:00:00\", \"price\": 46.89}, {\"symbol\": \"AAPL\", \"date\": \"2005-09-01T00:00:00\", \"price\": 53.61}, {\"symbol\": \"AAPL\", \"date\": \"2005-10-01T00:00:00\", \"price\": 57.59}, {\"symbol\": \"AAPL\", \"date\": \"2005-11-01T00:00:00\", \"price\": 67.82}, {\"symbol\": \"AAPL\", \"date\": \"2005-12-01T00:00:00\", \"price\": 71.89}, {\"symbol\": \"AAPL\", \"date\": \"2006-01-01T00:00:00\", \"price\": 75.51}, {\"symbol\": \"AAPL\", \"date\": \"2006-02-01T00:00:00\", \"price\": 68.49}, {\"symbol\": \"AAPL\", \"date\": \"2006-03-01T00:00:00\", \"price\": 62.72}, {\"symbol\": \"AAPL\", \"date\": \"2006-04-01T00:00:00\", \"price\": 70.39}, {\"symbol\": \"AAPL\", \"date\": \"2006-05-01T00:00:00\", \"price\": 59.77}, {\"symbol\": \"AAPL\", \"date\": \"2006-06-01T00:00:00\", \"price\": 57.27}, {\"symbol\": \"AAPL\", \"date\": \"2006-07-01T00:00:00\", \"price\": 67.96}, {\"symbol\": \"AAPL\", \"date\": \"2006-08-01T00:00:00\", \"price\": 67.85}, {\"symbol\": \"AAPL\", \"date\": \"2006-09-01T00:00:00\", \"price\": 76.98}, {\"symbol\": \"AAPL\", \"date\": \"2006-10-01T00:00:00\", \"price\": 81.08}, {\"symbol\": \"AAPL\", \"date\": \"2006-11-01T00:00:00\", \"price\": 91.66}, {\"symbol\": \"AAPL\", \"date\": \"2006-12-01T00:00:00\", \"price\": 84.84}, {\"symbol\": \"AAPL\", \"date\": \"2007-01-01T00:00:00\", \"price\": 85.73}, {\"symbol\": \"AAPL\", \"date\": \"2007-02-01T00:00:00\", \"price\": 84.61}, {\"symbol\": \"AAPL\", \"date\": \"2007-03-01T00:00:00\", \"price\": 92.91}, {\"symbol\": \"AAPL\", \"date\": \"2007-04-01T00:00:00\", \"price\": 99.8}, {\"symbol\": \"AAPL\", \"date\": \"2007-05-01T00:00:00\", \"price\": 121.19}, {\"symbol\": \"AAPL\", \"date\": \"2007-06-01T00:00:00\", \"price\": 122.04}, {\"symbol\": \"AAPL\", \"date\": \"2007-07-01T00:00:00\", \"price\": 131.76}, {\"symbol\": \"AAPL\", \"date\": \"2007-08-01T00:00:00\", \"price\": 138.48}, {\"symbol\": \"AAPL\", \"date\": \"2007-09-01T00:00:00\", \"price\": 153.47}, {\"symbol\": \"AAPL\", \"date\": \"2007-10-01T00:00:00\", \"price\": 189.95}, {\"symbol\": \"AAPL\", \"date\": \"2007-11-01T00:00:00\", \"price\": 182.22}, {\"symbol\": \"AAPL\", \"date\": \"2007-12-01T00:00:00\", \"price\": 198.08}, {\"symbol\": \"AAPL\", \"date\": \"2008-01-01T00:00:00\", \"price\": 135.36}, {\"symbol\": \"AAPL\", \"date\": \"2008-02-01T00:00:00\", \"price\": 125.02}, {\"symbol\": \"AAPL\", \"date\": \"2008-03-01T00:00:00\", \"price\": 143.5}, {\"symbol\": \"AAPL\", \"date\": \"2008-04-01T00:00:00\", \"price\": 173.95}, {\"symbol\": \"AAPL\", \"date\": \"2008-05-01T00:00:00\", \"price\": 188.75}, {\"symbol\": \"AAPL\", \"date\": \"2008-06-01T00:00:00\", \"price\": 167.44}, {\"symbol\": \"AAPL\", \"date\": \"2008-07-01T00:00:00\", \"price\": 158.95}, {\"symbol\": \"AAPL\", \"date\": \"2008-08-01T00:00:00\", \"price\": 169.53}, {\"symbol\": \"AAPL\", \"date\": \"2008-09-01T00:00:00\", \"price\": 113.66}, {\"symbol\": \"AAPL\", \"date\": \"2008-10-01T00:00:00\", \"price\": 107.59}, {\"symbol\": \"AAPL\", \"date\": \"2008-11-01T00:00:00\", \"price\": 92.67}, {\"symbol\": \"AAPL\", \"date\": \"2008-12-01T00:00:00\", \"price\": 85.35}, {\"symbol\": \"AAPL\", \"date\": \"2009-01-01T00:00:00\", \"price\": 90.13}, {\"symbol\": \"AAPL\", \"date\": \"2009-02-01T00:00:00\", \"price\": 89.31}, {\"symbol\": \"AAPL\", \"date\": \"2009-03-01T00:00:00\", \"price\": 105.12}, {\"symbol\": \"AAPL\", \"date\": \"2009-04-01T00:00:00\", \"price\": 125.83}, {\"symbol\": \"AAPL\", \"date\": \"2009-05-01T00:00:00\", \"price\": 135.81}, {\"symbol\": \"AAPL\", \"date\": \"2009-06-01T00:00:00\", \"price\": 142.43}, {\"symbol\": \"AAPL\", \"date\": \"2009-07-01T00:00:00\", \"price\": 163.39}, {\"symbol\": \"AAPL\", \"date\": \"2009-08-01T00:00:00\", \"price\": 168.21}, {\"symbol\": \"AAPL\", \"date\": \"2009-09-01T00:00:00\", \"price\": 185.35}, {\"symbol\": \"AAPL\", \"date\": \"2009-10-01T00:00:00\", \"price\": 188.5}, {\"symbol\": \"AAPL\", \"date\": \"2009-11-01T00:00:00\", \"price\": 199.91}, {\"symbol\": \"AAPL\", \"date\": \"2009-12-01T00:00:00\", \"price\": 210.73}, {\"symbol\": \"AAPL\", \"date\": \"2010-01-01T00:00:00\", \"price\": 192.06}, {\"symbol\": \"AAPL\", \"date\": \"2010-02-01T00:00:00\", \"price\": 204.62}, {\"symbol\": \"AAPL\", \"date\": \"2010-03-01T00:00:00\", \"price\": 223.02}], \"empty\": [{}]}}, {\"mode\": \"vega-lite\"});\n",
"</script>"
],
"text/plain": [
"alt.LayerChart(...)"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import altair as alt\n",
"from vega_datasets import data\n",
"\n",
"source = data.stocks()\n",
"source = source[source[\"date\"] > \"2005-01-01\"]\n",
"\n",
"lines = (\n",
" alt.Chart(source)\n",
" .mark_line()\n",
" .encode(x=\"date\", y=\"price\", color=\"symbol\")\n",
")\n",
"\n",
"xrule = (\n",
" alt.Chart()\n",
" .mark_rule(color=\"black\", strokeWidth=1)\n",
" .encode(x=alt.datum(alt.DateTime(year=2007, month=\"June\")))\n",
")\n",
"\n",
"label = (\n",
" alt.Chart()\n",
" .mark_text(color=\"black\", dx=-45, dy=-130)\n",
" .encode(\n",
" x=alt.datum(alt.DateTime(year=2007, month=\"June\")),\n",
" text=alt.datum(\"iPhone Released\"),\n",
" )\n",
")\n",
"\n",
"xrule2 = (\n",
" alt.Chart()\n",
" .mark_text(color=\"black\", dx=45, dy=60)\n",
" .encode(x=alt.datum(alt.DateTime(year=2008, month=\"November\")),\n",
" text=alt.datum(\"2008 Financial Crisis\"),\n",
" )\n",
"\n",
")\n",
"\n",
"label2 = (\n",
" alt.Chart()\n",
" .mark_rect(color=\"#cccccc33\")\n",
" .encode(\n",
" x=alt.datum(alt.DateTime(year=2008, month=\"January\")),\n",
" x2=alt.datum(alt.DateTime(year=2009, month=\"January\")),\n",
" text=alt.datum(\"2008 Financial Crisis\"),\n",
" )\n",
")\n",
"\n",
"\n",
"lines + label + xrule + xrule2 + label2"
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "44096965-f500-4ebf-81c5-c1e8df9d4ea1",
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"import polars as pl"
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "f652c1e0-ed86-45cd-b299-4ab662f2437d",
"metadata": {},
"outputs": [],
"source": [
"rows = []\n",
"for pt in range(100):\n",
" rows.append({\"percentage\": pt, \"theta\":pt / 100 * 2 * math.pi, \"area\": (pt / 100 * 100**2) / (100**2)})\n",
"area_df = pl.DataFrame(rows)"
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "813f6626-9ff4-4d9f-ad60-6a2bf508490a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<style>\n",
" #altair-viz-a9400806b87f46f4b7a6bcdd420dc59f.vega-embed {\n",
" width: 100%;\n",
" display: flex;\n",
" }\n",
"\n",
" #altair-viz-a9400806b87f46f4b7a6bcdd420dc59f.vega-embed details,\n",
" #altair-viz-a9400806b87f46f4b7a6bcdd420dc59f.vega-embed details summary {\n",
" position: relative;\n",
" }\n",
"</style>\n",
"<div id=\"altair-viz-a9400806b87f46f4b7a6bcdd420dc59f\"></div>\n",
"<script type=\"text/javascript\">\n",
" var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
" (function(spec, embedOpt){\n",
" let outputDiv = document.currentScript.previousElementSibling;\n",
" if (outputDiv.id !== \"altair-viz-a9400806b87f46f4b7a6bcdd420dc59f\") {\n",
" outputDiv = document.getElementById(\"altair-viz-a9400806b87f46f4b7a6bcdd420dc59f\");\n",
" }\n",
" const paths = {\n",
" \"vega\": \"https://cdn.jsdelivr.net/npm/vega@5?noext\",\n",
" \"vega-lib\": \"https://cdn.jsdelivr.net/npm/vega-lib?noext\",\n",
" \"vega-lite\": \"https://cdn.jsdelivr.net/npm/vega-lite@5.20.1?noext\",\n",
" \"vega-embed\": \"https://cdn.jsdelivr.net/npm/vega-embed@6?noext\",\n",
" };\n",
"\n",
" function maybeLoadScript(lib, version) {\n",
" var key = `${lib.replace(\"-\", \"\")}_version`;\n",
" return (VEGA_DEBUG[key] == version) ?\n",
" Promise.resolve(paths[lib]) :\n",
" new Promise(function(resolve, reject) {\n",
" var s = document.createElement('script');\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" s.async = true;\n",
" s.onload = () => {\n",
" VEGA_DEBUG[key] = version;\n",
" return resolve(paths[lib]);\n",
" };\n",
" s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
" s.src = paths[lib];\n",
" });\n",
" }\n",
"\n",
" function showError(err) {\n",
" outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
" throw err;\n",
" }\n",
"\n",
" function displayChart(vegaEmbed) {\n",
" vegaEmbed(outputDiv, spec, embedOpt)\n",
" .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
" }\n",
"\n",
" if(typeof define === \"function\" && define.amd) {\n",
" requirejs.config({paths});\n",
" require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
" } else {\n",
" maybeLoadScript(\"vega\", \"5\")\n",
" .then(() => maybeLoadScript(\"vega-lite\", \"5.20.1\"))\n",
" .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
" .catch(showError)\n",
" .then(() => displayChart(vegaEmbed));\n",
" }\n",
" })({\"config\": {\"view\": {\"continuousWidth\": 300, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fcf14b8ce611854e95dc031312dd6590\"}, \"mark\": {\"type\": \"point\"}, \"encoding\": {\"x\": {\"field\": \"percentage\", \"type\": \"quantitative\"}, \"y\": {\"field\": \"area\", \"type\": \"quantitative\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.20.1.json\", \"datasets\": {\"data-fcf14b8ce611854e95dc031312dd6590\": [{\"percentage\": 0, \"theta\": 0.0, \"area\": 0.0}, {\"percentage\": 1, \"theta\": 0.06283185307179587, \"area\": 0.01}, {\"percentage\": 2, \"theta\": 0.12566370614359174, \"area\": 0.02}, {\"percentage\": 3, \"theta\": 0.18849555921538758, \"area\": 0.03}, {\"percentage\": 4, \"theta\": 0.25132741228718347, \"area\": 0.04}, {\"percentage\": 5, \"theta\": 0.3141592653589793, \"area\": 0.05}, {\"percentage\": 6, \"theta\": 0.37699111843077515, \"area\": 0.06}, {\"percentage\": 7, \"theta\": 0.4398229715025711, \"area\": 0.07}, {\"percentage\": 8, \"theta\": 0.5026548245743669, \"area\": 0.08}, {\"percentage\": 9, \"theta\": 0.5654866776461628, \"area\": 0.09}, {\"percentage\": 10, \"theta\": 0.6283185307179586, \"area\": 0.1}, {\"percentage\": 11, \"theta\": 0.6911503837897545, \"area\": 0.11}, {\"percentage\": 12, \"theta\": 0.7539822368615503, \"area\": 0.12}, {\"percentage\": 13, \"theta\": 0.8168140899333463, \"area\": 0.13}, {\"percentage\": 14, \"theta\": 0.8796459430051422, \"area\": 0.14}, {\"percentage\": 15, \"theta\": 0.9424777960769379, \"area\": 0.15}, {\"percentage\": 16, \"theta\": 1.0053096491487339, \"area\": 0.16}, {\"percentage\": 17, \"theta\": 1.0681415022205298, \"area\": 0.17}, {\"percentage\": 18, \"theta\": 1.1309733552923256, \"area\": 0.18}, {\"percentage\": 19, \"theta\": 1.1938052083641213, \"area\": 0.19}, {\"percentage\": 20, \"theta\": 1.2566370614359172, \"area\": 0.2}, {\"percentage\": 21, \"theta\": 1.319468914507713, \"area\": 0.21}, {\"percentage\": 22, \"theta\": 1.382300767579509, \"area\": 0.22}, {\"percentage\": 23, \"theta\": 1.4451326206513049, \"area\": 0.23}, {\"percentage\": 24, \"theta\": 1.5079644737231006, \"area\": 0.24}, {\"percentage\": 25, \"theta\": 1.5707963267948966, \"area\": 0.25}, {\"percentage\": 26, \"theta\": 1.6336281798666925, \"area\": 0.26}, {\"percentage\": 27, \"theta\": 1.6964600329384885, \"area\": 0.27}, {\"percentage\": 28, \"theta\": 1.7592918860102844, \"area\": 0.28}, {\"percentage\": 29, \"theta\": 1.82212373908208, \"area\": 0.29}, {\"percentage\": 30, \"theta\": 1.8849555921538759, \"area\": 0.3}, {\"percentage\": 31, \"theta\": 1.9477874452256718, \"area\": 0.31}, {\"percentage\": 32, \"theta\": 2.0106192982974678, \"area\": 0.32}, {\"percentage\": 33, \"theta\": 2.0734511513692637, \"area\": 0.33}, {\"percentage\": 34, \"theta\": 2.1362830044410597, \"area\": 0.34}, {\"percentage\": 35, \"theta\": 2.199114857512855, \"area\": 0.35}, {\"percentage\": 36, \"theta\": 2.261946710584651, \"area\": 0.36}, {\"percentage\": 37, \"theta\": 2.324778563656447, \"area\": 0.37}, {\"percentage\": 38, \"theta\": 2.3876104167282426, \"area\": 0.38}, {\"percentage\": 39, \"theta\": 2.4504422698000385, \"area\": 0.39}, {\"percentage\": 40, \"theta\": 2.5132741228718345, \"area\": 0.4}, {\"percentage\": 41, \"theta\": 2.57610597594363, \"area\": 0.41}, {\"percentage\": 42, \"theta\": 2.638937829015426, \"area\": 0.42}, {\"percentage\": 43, \"theta\": 2.701769682087222, \"area\": 0.43}, {\"percentage\": 44, \"theta\": 2.764601535159018, \"area\": 0.44}, {\"percentage\": 45, \"theta\": 2.827433388230814, \"area\": 0.45}, {\"percentage\": 46, \"theta\": 2.8902652413026098, \"area\": 0.46}, {\"percentage\": 47, \"theta\": 2.9530970943744053, \"area\": 0.47}, {\"percentage\": 48, \"theta\": 3.015928947446201, \"area\": 0.48}, {\"percentage\": 49, \"theta\": 3.078760800517997, \"area\": 0.49}, {\"percentage\": 50, \"theta\": 3.141592653589793, \"area\": 0.5}, {\"percentage\": 51, \"theta\": 3.204424506661589, \"area\": 0.51}, {\"percentage\": 52, \"theta\": 3.267256359733385, \"area\": 0.52}, {\"percentage\": 53, \"theta\": 3.330088212805181, \"area\": 0.53}, {\"percentage\": 54, \"theta\": 3.392920065876977, \"area\": 0.54}, {\"percentage\": 55, \"theta\": 3.455751918948773, \"area\": 0.55}, {\"percentage\": 56, \"theta\": 3.518583772020569, \"area\": 0.56}, {\"percentage\": 57, \"theta\": 3.581415625092364, \"area\": 0.57}, {\"percentage\": 58, \"theta\": 3.64424747816416, \"area\": 0.58}, {\"percentage\": 59, \"theta\": 3.707079331235956, \"area\": 0.59}, {\"percentage\": 60, \"theta\": 3.7699111843077517, \"area\": 0.6}, {\"percentage\": 61, \"theta\": 3.8327430373795477, \"area\": 0.61}, {\"percentage\": 62, \"theta\": 3.8955748904513436, \"area\": 0.62}, {\"percentage\": 63, \"theta\": 3.958406743523139, \"area\": 0.63}, {\"percentage\": 64, \"theta\": 4.0212385965949355, \"area\": 0.64}, {\"percentage\": 65, \"theta\": 4.084070449666731, \"area\": 0.65}, {\"percentage\": 66, \"theta\": 4.1469023027385274, \"area\": 0.66}, {\"percentage\": 67, \"theta\": 4.209734155810323, \"area\": 0.67}, {\"percentage\": 68, \"theta\": 4.272566008882119, \"area\": 0.68}, {\"percentage\": 69, \"theta\": 4.335397861953914, \"area\": 0.69}, {\"percentage\": 70, \"theta\": 4.39822971502571, \"area\": 0.7}, {\"percentage\": 71, \"theta\": 4.461061568097506, \"area\": 0.71}, {\"percentage\": 72, \"theta\": 4.523893421169302, \"area\": 0.72}, {\"percentage\": 73, \"theta\": 4.586725274241098, \"area\": 0.73}, {\"percentage\": 74, \"theta\": 4.649557127312894, \"area\": 0.74}, {\"percentage\": 75, \"theta\": 4.71238898038469, \"area\": 0.75}, {\"percentage\": 76, \"theta\": 4.775220833456485, \"area\": 0.76}, {\"percentage\": 77, \"theta\": 4.838052686528282, \"area\": 0.77}, {\"percentage\": 78, \"theta\": 4.900884539600077, \"area\": 0.78}, {\"percentage\": 79, \"theta\": 4.9637163926718735, \"area\": 0.79}, {\"percentage\": 80, \"theta\": 5.026548245743669, \"area\": 0.8}, {\"percentage\": 81, \"theta\": 5.089380098815465, \"area\": 0.81}, {\"percentage\": 82, \"theta\": 5.15221195188726, \"area\": 0.82}, {\"percentage\": 83, \"theta\": 5.215043804959056, \"area\": 0.83}, {\"percentage\": 84, \"theta\": 5.277875658030852, \"area\": 0.84}, {\"percentage\": 85, \"theta\": 5.340707511102648, \"area\": 0.85}, {\"percentage\": 86, \"theta\": 5.403539364174444, \"area\": 0.86}, {\"percentage\": 87, \"theta\": 5.46637121724624, \"area\": 0.87}, {\"percentage\": 88, \"theta\": 5.529203070318036, \"area\": 0.88}, {\"percentage\": 89, \"theta\": 5.592034923389832, \"area\": 0.89}, {\"percentage\": 90, \"theta\": 5.654866776461628, \"area\": 0.9}, {\"percentage\": 91, \"theta\": 5.717698629533424, \"area\": 0.91}, {\"percentage\": 92, \"theta\": 5.7805304826052195, \"area\": 0.92}, {\"percentage\": 93, \"theta\": 5.843362335677016, \"area\": 0.93}, {\"percentage\": 94, \"theta\": 5.9061941887488105, \"area\": 0.94}, {\"percentage\": 95, \"theta\": 5.969026041820607, \"area\": 0.95}, {\"percentage\": 96, \"theta\": 6.031857894892402, \"area\": 0.96}, {\"percentage\": 97, \"theta\": 6.094689747964199, \"area\": 0.97}, {\"percentage\": 98, \"theta\": 6.157521601035994, \"area\": 0.98}, {\"percentage\": 99, \"theta\": 6.220353454107791, \"area\": 0.99}]}}, {\"mode\": \"vega-lite\"});\n",
"</script>"
],
"text/plain": [
"alt.Chart(...)"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"alt.Chart(area_df).mark_point().encode(x=\"percentage\", y=\"area\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "abf756b4-3ccd-4ea3-972b-ac36926a39b3",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4c75d21-2a82-4326-87b0-8f4b788a3d38",
"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.10.15"
}
},
"nbformat": 4,
"nbformat_minor": 5
}