{ "cells": [ { "cell_type": "markdown", "id": "ea4e3349-9fc2-41e9-834c-f784c843a95e", "metadata": {}, "source": [ "# Example Visualizations using CyberGIS-Vis" ] }, { "cell_type": "markdown", "id": "f595ccc2-a25e-4745-b18a-555938b037ea", "metadata": {}, "source": [ "#### Documentations and Demos about CyberGIS-Vis are available at: https://github.com/su-gis/CyberGIS-Vis" ] }, { "cell_type": "markdown", "id": "4ff57881-5852-4900-87a8-4479da615c77", "metadata": {}, "source": [ "## Adaptive Choropleth Mapper with Multiple Line Chart (MLC): Temporal Patterns of Covid-19 Crude Rate and Death Rate in US Counties" ] }, { "cell_type": "markdown", "id": "ed09b33e-a504-44c4-b208-aea277961934", "metadata": {}, "source": [ "## Setup environment" ] }, { "cell_type": "code", "execution_count": 1, "id": "f2fea90f-ace0-49a7-ba55-832f941eb6c4", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import geopandas as gpd\n", "from Adaptive_Choropleth_Mapper import CLC, MLC, Initial_Layers" ] }, { "cell_type": "markdown", "id": "30bb97d9-c261-479f-9f15-eb3ac440cb14", "metadata": {}, "source": [ "### Set input Data" ] }, { "cell_type": "markdown", "id": "efa40adb-9028-48ca-a516-515d586ae06c", "metadata": {}, "source": [ "1. Load U.S. counties from the Shapefile. Note: New York is an exception, represented by New York City with the city ID 777777, instead of county names and IDs.\n", "- Read the Shapefile \"County_NY_TIMES.shp\" into a GeoDataFrame\n", "- The Shapefile is located in the \"shp/US/\" directory\n", "- The 'geoid' column is explicitly set to be read as a string (str)\n", "- The first column in both the attribute file and the shapefile must be named 'geoid,' as it serves as the key for joining the shapefile with the attribute data.\n", "- The second column should contain the names of the corresponding regions, which will be directly displayed on the resulting map." ] }, { "cell_type": "code", "execution_count": 2, "id": "2c3b778c-7391-4288-b198-097f7059b763", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | geoid | \n", "name | \n", "Shape_Leng | \n", "Shape_Area | \n", "geometry | \n", "
---|---|---|---|---|---|
0 | \n", "10001 | \n", "Kent,DE | \n", "2.029682 | \n", "0.215240 | \n", "POLYGON ((-75.74776 39.14334, -75.75600 39.246... | \n", "
1 | \n", "10003 | \n", "New Castle,DE | \n", "1.798779 | \n", "0.134081 | \n", "POLYGON ((-75.78860 39.72220, -75.77379 39.722... | \n", "
2 | \n", "10005 | \n", "Sussex,DE | \n", "2.369084 | \n", "0.320841 | \n", "POLYGON ((-75.70157 38.56074, -75.70744 38.635... | \n", "
3 | \n", "1001 | \n", "Autauga,AL | \n", "1.994948 | \n", "0.150242 | \n", "POLYGON ((-86.41312 32.70739, -86.41279 32.625... | \n", "
4 | \n", "1003 | \n", "Baldwin,AL | \n", "3.977560 | \n", "0.494110 | \n", "POLYGON ((-87.59883 30.99745, -87.59650 30.987... | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
3212 | \n", "9007 | \n", "Middlesex,CT | \n", "1.878172 | \n", "0.122471 | \n", "POLYGON ((-72.75218 41.57889, -72.75294 41.592... | \n", "
3213 | \n", "9009 | \n", "New Haven,CT | \n", "2.629868 | \n", "0.240237 | \n", "POLYGON ((-73.31047 41.46881, -73.32091 41.477... | \n", "
3214 | \n", "9011 | \n", "New London,CT | \n", "2.390277 | \n", "0.215441 | \n", "POLYGON ((-72.46673 41.58390, -72.41723 41.590... | \n", "
3215 | \n", "9013 | \n", "Tolland,CT | \n", "1.812081 | \n", "0.117074 | \n", "POLYGON ((-72.13572 42.03025, -72.10217 42.028... | \n", "
3216 | \n", "9015 | \n", "Windham,CT | \n", "1.754612 | \n", "0.146376 | \n", "POLYGON ((-71.78970 41.72456, -71.78725 41.656... | \n", "
3217 rows × 5 columns
\n", "\n", " | geoid | \n", "period | \n", "confirmed_rate | \n", "death_rate | \n", "confirmed_rate_total | \n", "death_rate_total | \n", "visitor_flows_to_selected_area | \n", "visitor_flows_from_selected_area | \n", "pop_flows_to_selected_area | \n", "pop_flows_from_selected_area | \n", "confirmed_cases_total | \n", "death_total | \n", "cases | \n", "death | \n", "pop | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "25021 | \n", "2020-03-02 | \n", "76.34 | \n", "0.000000 | \n", "76.34 | \n", "0.000000 | \n", "225932.0 | \n", "222941.0 | \n", "4296827.0 | \n", "4489797.0 | \n", "1 | \n", "0 | \n", "1 | \n", "0 | \n", "131 | \n", "
1 | \n", "17031 | \n", "2020-03-02 | \n", "0.27 | \n", "0.000000 | \n", "1.88 | \n", "0.000000 | \n", "2410769.0 | \n", "2203579.0 | \n", "34150598.0 | \n", "31518502.0 | \n", "7 | \n", "0 | \n", "1 | \n", "0 | \n", "37172 | \n", "
2 | \n", "6095 | \n", "2020-03-02 | \n", "0.12 | \n", "0.000000 | \n", "2.97 | \n", "0.000000 | \n", "155015.0 | \n", "176145.0 | \n", "2935064.0 | \n", "3281805.0 | \n", "24 | \n", "0 | \n", "1 | \n", "0 | \n", "80680 | \n", "
3 | \n", "6075 | \n", "2020-03-02 | \n", "0.00 | \n", "0.000000 | \n", "3.45 | \n", "0.000000 | \n", "291306.0 | \n", "221035.0 | \n", "5711711.0 | \n", "4196901.0 | \n", "6 | \n", "0 | \n", "0 | \n", "0 | \n", "17376 | \n", "
4 | \n", "12057 | \n", "2020-03-02 | \n", "7.16 | \n", "0.000000 | \n", "14.33 | \n", "0.000000 | \n", "943468.0 | \n", "855974.0 | \n", "10914786.0 | \n", "9880641.0 | \n", "2 | \n", "0 | \n", "1 | \n", "0 | \n", "1396 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
276123 | \n", "42109 | \n", "2021-11-22 | \n", "261.53 | \n", "0.000000 | \n", "57660.29 | \n", "1214.848144 | \n", "27845.0 | \n", "15230.0 | \n", "415693.0 | \n", "228453.0 | \n", "20504 | \n", "432 | \n", "93 | \n", "0 | \n", "3556 | \n", "
276124 | \n", "42107 | \n", "2021-11-22 | \n", "134.07 | \n", "2.180000 | \n", "22966.91 | \n", "532.710791 | \n", "40167.0 | \n", "52320.0 | \n", "568134.0 | \n", "733340.0 | \n", "84114 | \n", "1951 | \n", "491 | \n", "8 | \n", "36624 | \n", "
276125 | \n", "27139 | \n", "2021-11-22 | \n", "75.85 | \n", "0.622421 | \n", "8641.97 | \n", "61.708636 | \n", "53778.0 | \n", "75885.0 | \n", "725802.0 | \n", "979598.0 | \n", "97191 | \n", "694 | \n", "853 | \n", "7 | \n", "112464 | \n", "
276126 | \n", "42121 | \n", "2021-11-22 | \n", "1559.36 | \n", "35.210000 | \n", "148385.31 | \n", "3143.863179 | \n", "14101.0 | \n", "15193.0 | \n", "196044.0 | \n", "202678.0 | \n", "29499 | \n", "625 | \n", "310 | \n", "7 | \n", "1988 | \n", "
276127 | \n", "9015 | \n", "2021-11-22 | \n", "25.40 | \n", "0.120000 | \n", "6932.50 | \n", "109.875203 | \n", "32688.0 | \n", "43879.0 | \n", "502565.0 | \n", "641831.0 | \n", "56217 | \n", "891 | \n", "206 | \n", "1 | \n", "81092 | \n", "
276128 rows × 15 columns
\n", "