Example Visualizations using CyberGIS-Vis

Documentations and Demos about CyberGIS-Vis are available at: https://github.com/cybergis/CyberGIS-Vis

Setup environment

In [1]:
import pandas as pd
import geopandas as gpd
from Adaptive_Choropleth_Mapper import Adaptive_Choropleth_Mapper_viz, Adaptive_Choropleth_Mapper_log

Visualizations for Exploring Relationship between data

Set input data: Socioeconomic and Demographic Data from LTDB

In [2]:
input_attributes = pd.read_csv("attributes/Los_Angeles_1980_1990_2000_2010.csv", dtype={'geoid':str})
input_attributes = input_attributes.rename(columns={'geoid': 'geoid', 'year': 'period'})
input_attributes
Out[2]:
geoid period n_asian_under_15 n_black_under_15 n_hispanic_under_15 n_native_under_15 n_white_under_15 n_persons_under_18 n_asian_over_60 n_black_over_60 ... n_vietnamese_persons n_widowed_divorced n_white_persons n_total_housing_units_sample p_white_over_60 p_black_over_60 p_hispanic_over_60 p_native_over_60 p_asian_over_60 p_disabled
0 06037101110 1980 4.512923 0.0 17.805532 3.938551 118.074478 159.429260 0.328213 0.0 ... 0.164106 72.042664 NaN 216.045944 11.362683 0.0 0.181691 0.000000 0.055905 4.416492
1 06037101122 1980 49.069336 0.0 193.180725 42.705280 1281.120850 1729.904922 3.555239 0.0 ... 1.795797 781.720006 NaN 2344.410583 11.367037 0.0 0.181974 0.000000 0.055802 4.420126
2 06037101210 1980 5.341171 0.0 143.240494 2.913366 473.907501 649.680603 2.913366 0.0 ... 2.427805 468.080780 NaN 1035.216064 11.672832 0.0 1.294698 0.184957 0.123305 9.103987
3 06037101220 1980 5.658829 0.0 151.759506 3.086634 502.092438 688.319336 3.086634 0.0 ... 2.572195 495.919190 NaN 1096.783936 11.672832 0.0 1.294698 0.184957 0.123305 9.103987
4 06037101300 1980 60.132671 0.0 100.549713 13.800941 691.032837 959.165405 0.000000 0.0 ... 5.914689 437.686981 NaN 1358.406860 13.719433 0.0 0.334620 0.000000 0.000000 6.383527
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
9361 06037980031 2010 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 NaN NaN ... 0.000000 281.000000 NaN 25.000000 NaN NaN NaN NaN NaN NaN
9362 06037980033 2010 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 NaN NaN ... 0.000000 0.000000 NaN 0.000000 NaN NaN NaN NaN NaN NaN
9363 06037990100 2010 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 NaN NaN ... 0.000000 0.000000 NaN 0.000000 NaN NaN NaN NaN NaN NaN
9364 06037990200 2010 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 NaN NaN ... 0.000000 0.000000 NaN 0.000000 NaN NaN NaN NaN NaN NaN
9365 06037990300 2010 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 NaN NaN ... 0.000000 0.000000 NaN 0.000000 NaN NaN NaN NaN NaN NaN

9366 rows × 192 columns

In [3]:
shapefile = gpd.read_file("shp/Los_Angeles_tract/Los_Angeles_2.shp")
shapefile = shapefile.rename(columns={'tractID': 'geoid', 'tract_key': 'name'})
shapefile
Out[3]:
geoid name geometry
0 06037101110 101110 POLYGON ((-118.29792 34.26322, -118.29696 34.2...
1 06037101122 101122 POLYGON ((-118.29697 34.27881, -118.29410 34.2...
2 06037101210 101210 POLYGON ((-118.29945 34.25598, -118.29792 34.2...
3 06037101220 101220 POLYGON ((-118.27610 34.24648, -118.27618 34.2...
4 06037101300 101300 POLYGON ((-118.26602 34.24036, -118.26657 34.2...
... ... ... ...
2339 06037920108 920108 POLYGON ((-118.55944 34.44441, -118.55957 34.4...
2340 06037920200 920200 POLYGON ((-118.57207 34.47017, -118.57211 34.4...
2341 06037990100 990100 POLYGON ((-118.94518 34.04309, -118.93753 34.0...
2342 06037990200 990200 POLYGON ((-118.42545 33.76085, -118.42816 33.7...
2343 06037990300 990300 POLYGON ((-118.24463 33.71077, -118.24457 33.7...

2344 rows × 3 columns

Adaptive Choropleth Map Only - Los Angeles

In [4]:
param_Stacked = {
    'title': "Adaptive Choropleth Mapper with Stacked Chart",
    'filename_suffix': "LA",
    'inputCSV': input_attributes,   
    'shapefile': shapefile,
    'periods': [1980, 1990, 2000, 2010],
    'shortLabelCSV': "attributes/LTDB_ShortLabel.csv",       
    'variables': [         # Enter variable names of the column you entered above.
            "p_nonhisp_white_persons",
            "p_nonhisp_black_persons",
            "p_hispanic_persons",
            "p_asian_persons",
            "p_employed_manufacturing",
            "p_poverty_rate",
            "p_foreign_born_pop",
            "p_persons_under_18",
            "p_persons_over_60",  
            "p_edu_college_greater",
            "p_unemployment_rate",
            "p_employed_professional",
            "p_vacant_housing_units",
            "p_owner_occupied_units",
            "p_housing_units_multiunit_structures",
            "median_home_value",
            "p_structures_30_old",
            "p_household_recent_move",
    ],
    'NumOfMaps': 4,
    'SortLayers': "temporal", # Enter “compare” or “temporal”.  compare mode is for comparing variables at a specific point of time.
                              # temporal mode is for displaying spatiotemporal patterns of the same variable using multiple maps.            
    'InitialLayers':["1980_% nonhisp white persons", "1990_% nonhisp white persons", "2000_% nonhisp white persons", "2010_% nonhisp white persons"],    
    'Map_width':"350px",
    'Map_height':"350px",    
    'Stacked_Chart': False,  #Comment out if you do not want to visualize this chart       
}  
Adaptive_Choropleth_Mapper_viz(param_Stacked)
Adaptive_Choropleth_Mapper_log(param_Stacked)
output directory :  ACM_LA
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA/data/CONFIG_LA.js

Adaptive Choropleth Mapper with Stacked Chart

In [5]:
param_Stacked = {
    'title': "Adaptive Choropleth Mapper with Stacked Chart",
    'filename_suffix': "LA_Stacked",
    'inputCSV': input_attributes,   
    'shapefile': shapefile,
    'periods': [1980, 1990, 2000, 2010],
    'NumOfMaps': 4,
    'shortLabelCSV': "attributes/LTDB_ShortLabel.csv",       
    'variables': [         # Enter variable names of the column you entered above.
            "p_nonhisp_white_persons",
            "p_nonhisp_black_persons",
            "p_hispanic_persons",
            "p_asian_persons",
            "p_employed_manufacturing",
            "p_poverty_rate",
            "p_foreign_born_pop",
            "p_persons_under_18",
            "p_persons_over_60",  
            "p_edu_college_greater",
            "p_unemployment_rate",
            "p_employed_professional",
            "p_vacant_housing_units",
            "p_owner_occupied_units",
            "p_housing_units_multiunit_structures",
            "median_home_value",
            "p_structures_30_old",
            "p_household_recent_move",
    ],
    'NumOfMaps': 4,
    'SortLayers': "temporal", # Enter “compare” or “temporal”.  compare mode is for comparing variables at a specific point of time.
                              # temporal mode is for displaying spatiotemporal patterns of the same variable using multiple maps.            
    'InitialLayers':["1980_% nonhisp white persons", "1990_% nonhisp white persons", "2000_% nonhisp white persons", "2010_% nonhisp white persons"],    

    'Map_width':"350px",
    'Map_height':"350px",    
    'Stacked_Chart': True,  #Comment out if you do not want to visualize this chart       
}  
Adaptive_Choropleth_Mapper_viz(param_Stacked)
Adaptive_Choropleth_Mapper_log(param_Stacked)
output directory :  ACM_LA_Stacked
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_Stacked/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_Stacked/data/CONFIG_LA_Stacked.js

Adaptive Choropleth Mapper with Top 10 Bar Chart

In [6]:
param_bar = {
    'title': "Adaptive Choropleth Mapper with Top 10 Bar Chart",
    'filename_suffix': "LA_bar",
    'inputCSV': input_attributes,   
    'shapefile': shapefile,
    'periods': [1980, 1990, 2000, 2010],
    'NumOfMaps': 3,
    'shortLabelCSV': "attributes/LTDB_ShortLabel.csv",      
    'variables': [         #enter variable names of the column you entered above.           
        "p_other_language",
        "p_female_headed_families",
        "per_capita_income",     
    ],
    'Top10_Chart': True,  #Comment out if you do not want to visualize this chart      
}  
Adaptive_Choropleth_Mapper_viz(param_bar)
Adaptive_Choropleth_Mapper_log(param_bar)
output directory :  ACM_LA_bar
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_bar/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_bar/data/CONFIG_LA_bar.js

Adaptive Choropleth Mapper with Scatter Plot

In [7]:
param_Scatter = {
    'title': "Adaptive Choropleth Mapper with Scatter Plot",
    'filename_suffix': "LA_Scatter",
    'inputCSV': input_attributes,   
    'shapefile': shapefile,
    'periods': [2010],
    'shortLabelCSV': "attributes/LTDB_ShortLabel.csv",        
    'variables': [         #enter variable names of the column you entered above.
        "p_nonhisp_white_persons",
        "p_nonhisp_black_persons",
        "p_hispanic_persons",
        "p_asian_persons",
        "p_foreign_born_pop",
        "p_edu_college_greater",
        "p_unemployment_rate",
        "p_employed_manufacturing",
        "p_poverty_rate",
        "p_vacant_housing_units",
        "p_owner_occupied_units",
        "p_housing_units_multiunit_structures",
        "median_home_value",
        "p_structures_30_old",
        "p_household_recent_move",
        "p_persons_under_18",
        "p_persons_over_60",     
    ],
    'InitialLayers':["2010_% edu college greater", "2010_% employed manufacturing" ],
    'Map_width':"470px",
    'Map_height':"450px", 
    'Scatter_Plot': True,        
} 
Adaptive_Choropleth_Mapper_viz(param_Scatter)
Adaptive_Choropleth_Mapper_log(param_Scatter) 
output directory :  ACM_LA_Scatter
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_Scatter/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_Scatter/data/CONFIG_LA_Scatter.js

Adaptive Choropleth Mapper with Correlogram

In [8]:
param_Correlogram = {
    'title': "Adaptive Choropleth Mapper with Correlogram",
    'filename_suffix': "LA_Correlogram",
    'inputCSV': input_attributes,   
    'shapefile': shapefile,
    'NumOfMaps':6,
    'periods': [2010],
    'shortLabelCSV': "attributes/LTDB_ShortLabel.csv",       
    'variables': [         #enter variable names of the column you entered above.
        "p_nonhisp_white_persons",
        "p_nonhisp_black_persons",
        "p_hispanic_persons",
        "p_asian_persons",
        "p_foreign_born_pop",
        "p_edu_college_greater",
        "p_unemployment_rate",
        "p_employed_manufacturing",
        "p_poverty_rate",
        "p_vacant_housing_units",
        "p_owner_occupied_units",
        "p_housing_units_multiunit_structures",
        "median_home_value",
        "p_structures_30_old",
        "p_household_recent_move",
        "p_persons_under_18",
        "p_persons_over_60",     
    ],
    'Map_width':"350px",
    'Map_height':"350px",
    'Correlogram': True,        
} 
Adaptive_Choropleth_Mapper_viz(param_Correlogram)
Adaptive_Choropleth_Mapper_log(param_Correlogram)  
output directory :  ACM_LA_Correlogram
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_Correlogram/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_LA_Correlogram/data/CONFIG_LA_Correlogram.js

Adaptive Choropleth Mapper with Parallel Coordinate Plot (PCP) to visulize relationship between variables.

In [9]:
param_PCP = {
    'title': "Adaptive Choropleth Mapper with Paralle Coordinate Plot",
    'filename_suffix': "Census_PCP",                                      # max 30 character     
    'inputCSV': input_attributes,   
    'shapefile': shapefile, 
    'periods': [2010],
    'variables': [         #enter variable names of the column you entered above.
            "p_nonhisp_white_persons",
            "p_nonhisp_black_persons",
            "p_hispanic_persons",
            "p_asian_persons",
            "p_employed_manufacturing",
            "p_poverty_rate",
            "p_foreign_born_pop",
            "p_persons_under_18",
            "p_persons_over_60",  
            "p_edu_college_greater",
            "p_unemployment_rate",
            "p_employed_professional",
            "p_vacant_housing_units",
            "p_owner_occupied_units",
            "p_housing_units_multiunit_structures",
            "median_home_value",
            "p_structures_30_old",
            "p_household_recent_move",
      
        ],
    'shortLabelCSV': "attributes/LTDB_ShortLabel.csv",
    'NumOfMaps':4,
    'Map_width':"350px",
    'Map_height':"350px", 
    'Top10_Chart': True,    
    'Parallel_Coordinates_Plot': True,
    'NumOfPCP':4,
    'InitialVariablePCP': ["2010_% white (non-Hispanic)", "2010_% black (non-Hispanic)", "2010_% Hispanic", "2010_% Asian & PI race", "2010_% professional employees", "2010_% manufacturing employees", "2010_% in poverty", "2010_% foreign born", "2010_% 17 and under (total)", "2010_% 60 and older"]
}
Adaptive_Choropleth_Mapper_viz(param_PCP)
Adaptive_Choropleth_Mapper_log(param_PCP)  
output directory :  ACM_Census_PCP
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Census_PCP/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Census_PCP/data/CONFIG_Census_PCP.js

Visualizations for Spatiotemporal Data

Set input data: COVID-19 data and the number of visits estimated based on Twitter data

In [10]:
Covid_Visits = pd.read_csv("attributes/Covid_Visits.csv", dtype={'geoid':str})
Covid_Visits = Covid_Visits.rename(columns={'geoid': 'geoid'})
Covid_Visits
Out[10]:
geoid period Confirmed Rate Death Rate The Number of Visits from Outside to Inside of the selected MSA
0 1 2020-02-16 0 0 26
1 2 2020-02-16 0 0 52
2 3 2020-02-16 0 0 60
3 4 2020-02-16 0 0 42
4 5 2020-02-16 0 0 25
... ... ... ... ... ...
53723 48260 2020-12-27 -9999 -9999 21
53724 48300 2020-12-27 -9999 -9999 50
53725 48460 2020-12-27 -9999 -9999 4
53726 48540 2020-12-27 -9999 -9999 36
53727 48580 2020-12-27 -9999 -9999 35

53728 rows × 5 columns

In [11]:
shapefile_MSA = gpd.read_file("shp/MSA_country/MSA_US.shp", dtype={'GEOID':str})
shapefile_MSA = shapefile_MSA.rename(columns={'GEOID': 'geoid', 'NAME_1':'name'})
shapefile_MSA
Out[11]:
geoid name region LON LAT ISO3 ISO3_1 Shape_Leng Shape_Area geometry
0 12660 Baraboo, WI WI -89.95 43.43 12660 None 2.322364 0.244303 POLYGON ((-90.31241 43.64100, -90.29665 43.641...
1 38300 Pittsburgh, PA PA -79.83 40.44 38300 None 7.137698 1.468706 POLYGON ((-80.51922 39.96243, -80.51921 39.963...
2 17460 Cleveland-Elyria, OH OH -81.68 41.38 17460 None 4.210584 0.562277 POLYGON ((-82.34808 41.42840, -82.34412 41.429...
3 38920 Port Lavaca, TX TX -96.64 28.50 38920 None 3.901207 0.136378 MULTIPOLYGON (((-96.38985 28.38963, -96.38527 ...
4 48660 Wichita Falls, TX TX -98.49 33.77 48660 None 3.937540 0.674297 POLYGON ((-98.95383 33.49638, -98.95378 33.531...
... ... ... ... ... ... ... ... ... ... ...
924 12980 Battle Creek, MI MI -85.01 42.25 12980 None 1.864599 0.202977 POLYGON ((-85.29888 42.41986, -85.27795 42.419...
925 22020 Fargo, ND-MN ND-MN -96.97 46.92 22020 None 4.492438 0.862697 POLYGON ((-97.70619 46.99107, -97.70602 46.992...
926 11580 Arcadia, FL FL -81.81 27.19 11580 None 1.604625 0.150757 POLYGON ((-82.05752 27.07649, -82.05738 27.119...
927 14700 Branson, MO MO -93.22 36.70 14700 None 2.681764 0.303571 POLYGON ((-93.61287 36.82587, -93.61278 36.834...
928 24100 Gloversville, NY NY -74.42 43.11 24100 None 1.936258 0.152618 POLYGON ((-74.77423 43.08228, -74.77374 43.083...

929 rows × 10 columns

Adaptive Choropleth Mapper with Multiple Line Chart (MLC)

In [12]:
param_MLC_COVID = {
    'title': "Covid-19 Risk Assessment using Twitter, Metropolitan Statistical Areas, USA",
    'Subject': "Temporal Patterns of COVID-19 Risk Factors",
    'filename_suffix': "Mobility_MLC",  # max 30 character      
    'inputCSV': Covid_Visits,   
    'shapefile': shapefile_MSA, 
    'periods': "All",
    'variables': [         #enter variable names of the column you entered above.
            "Confirmed Rate",
            "Death Rate",
            "The Number of Visits from Outside to Inside of the selected MSA"
        ],
    'NumOfMaps':2,
    'InitialLayers':["2020-03-15_Confirmed Rate" , "2020-12-27_Confirmed Rate"],
    'Initial_map_center':[37, -97],
    'Initial_map_zoom_level':4,    
    'Map_width':"650px",
    'Map_height':"400px", 
    'Top10_Chart': True,     
    'Multiple_Line_Chart': True,
    'NumOfMLC':3,
    'titlesOfMLC':["1. COVID-19 Confirmed Cases (/100k pop)", "2. COVID-19 Death Cases (/100k pop)", "3. The Number of Visits from Outside to Inside of the selected MSA"],
    'DefaultRegion_MLC':"35620" 
}
Adaptive_Choropleth_Mapper_viz(param_MLC_COVID)
Adaptive_Choropleth_Mapper_log(param_MLC_COVID)
output directory :  ACM_Mobility_MLC
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Mobility_MLC/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Mobility_MLC/data/CONFIG_Mobility_MLC.js

Adaptive Choropleth Mapper with Comparison Line Chart (CLC)

In [13]:
param_CLC_COVID = {
    'title': "Comparison of COVID-19 Confirmed Rate between Metropolitan Statistical Areas, USA",
    'Subject': "Temporal Patterns of COVID-19 Confirmed Rate",
    'filename_suffix': "Mobility_CLC",                                      # max 30 character      
    'inputCSV': Covid_Visits,   
    'shapefile': shapefile_MSA, 
    'periods': "All",
    'variables': [         #enter variable names of the column you entered above.
            "Confirmed Rate"
        ],
    'NumOfMaps':2,
    'InitialLayers':["2020-04-19_Confirmed Rate" , "2020-11-01_Confirmed Rate"],
    'Initial_map_center':[37, -97],
    'Initial_map_zoom_level':4,    
    'Map_width':"650px",
    'Map_height':"400px",     
    'Top10_Chart': True,     
    'Comparision_Chart': True,
    'NumOfCLC': 46,
    'DefaultRegion_CLC': ["35620", "16980"] 
}
Adaptive_Choropleth_Mapper_viz(param_CLC_COVID)
Adaptive_Choropleth_Mapper_log(param_CLC_COVID)  
output directory :  ACM_Mobility_CLC
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Mobility_CLC/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Mobility_CLC/data/CONFIG_Mobility_CLC.js

More Examples

Set input data: HIV data

In [14]:
input_attributes_hiv = pd.read_csv("attributes/HIV_US_multiple_long.csv", dtype={'geoid':str})
input_attributes_hiv = input_attributes_hiv.rename(columns={'geoid': 'geoid'})
input_attributes_hiv
Out[14]:
geoid period Health Care Center (/100k pop) HIV
0 1001 2012 3.796153 15.50
1 1003 2012 2.507915 7.50
2 1005 2012 6.641990 14.71
3 1007 2012 4.207311 17.70
4 1009 2012 2.630077 6.92
... ... ... ... ...
21954 56037 2018 4.474590 9.15
21955 56039 2018 0.265288 17.17
21956 56041 2018 4.603247 0.00
21957 56043 2018 7.180956 0.00
21958 56045 2018 0.265288 0.00

21959 rows × 4 columns

In [15]:
shapefile_us = gpd.read_file("shp/US/counties.shp")
shapefile_us
Out[15]:
geoid name geometry
0 2013 Aleutians East,AK MULTIPOLYGON (((-162.63769 54.80112, -162.6440...
1 2016 Aleutians West,AK MULTIPOLYGON (((177.44593 52.11133, 177.44302 ...
2 28107 Panola,MS POLYGON ((-90.19854 34.51109, -90.19863 34.554...
3 28101 Newton,MS POLYGON ((-88.91452 32.57695, -88.91559 32.558...
4 28027 Coahoma,MS POLYGON ((-90.65700 33.98759, -90.66036 33.987...
... ... ... ...
3216 27057 Hubbard,MN POLYGON ((-95.16917 47.15252, -95.16909 47.182...
3217 27169 Winona,MN POLYGON ((-92.07949 44.10699, -92.07921 44.117...
3218 2270 None POLYGON ((-160.85114 63.01269, -160.85156 62.9...
3219 51515 None POLYGON ((-79.54339 37.32615, -79.54230 37.334...
3220 46113 None POLYGON ((-102.79211 42.99998, -102.86790 42.9...

3221 rows × 3 columns

Adaptive Choropleth Mapper with Parallel Coordinate Plot (PCP) for Time Series Visualization

In [16]:
param_PCP_hiv = {
    'title': "Adaptive Choropleth Mapper with Paralle Coordinate Plot",
    'filename_suffix': "HIV_PCP",                                      # max 30 character     
    'inputCSV': input_attributes_hiv,   
    'shapefile': shapefile_us, 
    'periods': [2012, 2013, 2014, 2015, 2016, 2017, 2018],
    'variables': [         #enter variable names of the column you entered above.
            "HIV",
            #"Health Care Center (/100k pop)"
        ],
    'NumOfMaps':2,
    'Initial_map_center':[37, -97],
    'Initial_map_zoom_level':4,    
    'Map_width':"650px",
    'Map_height':"410px",     
    'Top10_Chart': True,    
    'Parallel_Coordinates_Plot': True,
    'NumOfPCP':7,
}
Adaptive_Choropleth_Mapper_viz(param_PCP_hiv)
Adaptive_Choropleth_Mapper_log(param_PCP_hiv)  
output directory :  ACM_HIV_PCP
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_HIV_PCP/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_HIV_PCP/data/CONFIG_HIV_PCP.js

Small Multiple Visualization Techniques Using ACM: A Case Study of the Phoenix Urban Core

In [12]:
import pandas as pd
import geopandas as gpd
from Adaptive_Choropleth_Mapper import Adaptive_Choropleth_Mapper_viz, Adaptive_Choropleth_Mapper_log
In [13]:
# Read attributes
input_attr_PHX = pd.read_csv("attributes/Harmonized_Maricopa_Pinal_2023_harminized_in_2018_byCbg_normalized.csv", dtype={'geoid':str})
input_attr_PHX = input_attr_PHX.rename(columns={'GEOID': 'geoid'})

# add or overwrite period column
input_attr_PHX["period"] = 2023

# reorder columns to make period the second one
cols = input_attr_PHX.columns.tolist()
# move 'period' right after the first column
cols.insert(1, cols.pop(cols.index("period")))
input_attr_PHX = input_attr_PHX[cols]

# ensure it's treated as string and zero-padded to 12 digits
input_attr_PHX["geoid"] = input_attr_PHX["geoid"].astype(str).str.zfill(12)

input_attr_PHX
Out[13]:
geoid period Total Population Per Capita Income Median household income % service industry % manufacturing % College or above % Master or above % Bachelor's degree ... % built 1970 to 1979 % built 1960 to 1969 % built 1950 to 1959 % built 1940 to 1949 % built 1939 or earlier % owner occupied % renter occupied Total for Units in Structure Mobile home Boat, RV, van, etc.
0 040132168291 2023 2202.624090 119742.785244 142231.878822 0.000077 12.406228 87.836584 27.685121 40.813093 ... 0.000307 0.000000 0.000000 0.000000 0.000000 94.646618 5.353382 1217.851008 2.134305e+00 0.000000e+00
1 040131104003 2023 1609.982295 32878.977819 59111.750588 0.000245 12.617023 46.147172 5.883160 33.163761 ... 24.911393 14.034849 31.754361 29.298440 0.000326 62.689205 37.310795 570.005338 0.000000e+00 0.000000e+00
2 040131104004 2023 579.007915 54369.437451 91297.348146 3.571513 5.612233 70.471848 24.352458 15.087174 ... 10.289648 25.079766 38.905948 17.364093 0.000434 61.093372 38.906628 310.996509 0.000000e+00 0.000000e+00
3 040130715063 2023 641.871779 35938.299653 48974.812389 0.000000 13.557483 31.313589 7.476889 19.001927 ... 86.301535 0.000554 7.076170 0.000000 0.000000 96.152881 3.847119 437.911307 4.518360e-04 0.000000e+00
4 040130715064 2023 860.378025 64186.549917 63432.980960 0.002545 0.006917 65.571633 7.327520 19.069248 ... 83.351504 2.311013 1.234079 0.000063 0.000000 87.547167 12.452833 649.232676 6.793928e-05 0.000000e+00
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2699 040131059003 2023 1676.898621 36019.965985 42091.260137 10.221665 1.601184 52.280835 4.851631 23.388771 ... 47.810429 7.455721 0.000233 0.000087 0.000005 40.591863 59.408137 844.946330 2.903960e-05 7.100528e-01
2700 040131032106 2023 968.928187 54816.994439 66387.303207 9.481259 3.016406 53.800198 10.682642 30.946785 ... 12.334686 0.004638 6.245983 0.000000 0.000000 22.649039 77.350961 592.043061 0.000000e+00 8.155322e-13
2701 040131126012 2023 2426.670355 17290.729235 40004.774035 22.600305 11.704074 30.316917 3.583573 5.376280 ... 14.305777 14.172011 14.170208 0.925627 1.969523 36.463265 63.536735 761.988674 1.405381e-10 0.000000e+00
2702 040136130001 2023 3515.948699 85947.115664 186885.598980 2.152493 5.701058 86.996039 32.885212 34.941487 ... 0.000737 0.000000 0.000003 0.000000 0.000000 93.213151 6.786849 1267.017424 6.754400e-06 0.000000e+00
2703 040130405023 2023 2235.618219 61362.115513 59755.392842 5.922353 5.363552 55.591033 15.023672 23.139364 ... 10.169370 14.327563 17.695693 10.522250 3.552923 66.759001 33.240999 1297.114105 3.030982e+00 1.153893e+00

2704 rows × 89 columns

In [14]:
# Read shapefile
shapefile_PHX = gpd.read_file("shp/Phoenix/phoenix_boundary_modified.shp")
shapefile_PHX
Out[14]:
geoid name area pop_den geometry
0 040131104003 040131104003 0.248221 6486.093160 POLYGON ((-112.09992 33.48783, -112.09352 33.4...
1 040131104004 040131104004 0.246233 2351.465923 POLYGON ((-112.09990 33.49505, -112.09131 33.4...
2 040131039001 040131039001 0.253125 5633.734457 POLYGON ((-112.10812 33.61097, -112.10549 33.6...
3 040131039003 040131039003 0.175181 10564.209181 POLYGON ((-112.11033 33.60365, -112.10967 33.6...
4 040131040001 040131040001 0.248642 6760.096449 POLYGON ((-112.12527 33.60363, -112.12068 33.6...
... ... ... ... ... ...
964 040131032123 040131032123 0.331451 4956.622262 POLYGON ((-111.97781 33.62610, -111.97714 33.6...
965 040131059003 040131059003 0.377557 4441.439533 POLYGON ((-112.12565 33.54765, -112.12562 33.5...
966 040131032106 040131032106 0.304450 3182.549152 POLYGON ((-111.99584 33.59998, -111.99531 33.5...
967 040131126012 040131126012 0.207580 11690.291632 POLYGON ((-112.15183 33.46375, -112.15131 33.4...
968 040136130001 040136130001 2.008999 1750.100054 POLYGON ((-111.96071 33.78468, -111.95997 33.7...

969 rows × 5 columns

In [29]:
# Create maps with Adative Choropleth Mapper

param_PHX = {
    'title': "Socioeconomic Data Visualization in the Phoenix Urban Core",
    'filename_suffix': "Phoenix_Core",
    'inputCSV': input_attr_PHX,   
    'shapefile': shapefile_PHX,
    'periods': [2023],     
    'variables': [         # Enter variable names of the column you entered above.
           "Median household income",
           "% below poverty",
           "% Unemployed",
           "% College or above",
           "% manufacturing",
           "% service industry",
           "% structures more than 30 years old",
           "% households moved <10 years ago",
           "% multiunit structures",
           "% owner occupied housing",
           "% vacant housing",
           "% > 60 years old",
           "% < 18 years old",
           "% white",
           "% Asian",
           "% Hispanic",
           "% black",
           "% American Indian and Alaska Native alone",
           "% foreign born"
    ],
    'NumOfMaps': 19,
    'Initial_map_center':[33.55, -112.07],
    'Initial_map_zoom_level':10,     
    'SortLayers': "compare", # Enter “compare” or “temporal”.  compare mode is for comparing variables at a specific point of time.
                              # temporal mode is for displaying spatiotemporal patterns of the same variable using multiple maps.            
    #'InitialLayers':["1980_% nonhisp white persons", "1990_% nonhisp white persons", "2000_% nonhisp white persons", "2010_% nonhisp white persons"],    
    'Map_width':"400px",
    'Map_height':"480px",    
    'Stacked_Chart': False,  #Comment out if you do not want to visualize this chart       
}  
Adaptive_Choropleth_Mapper_viz(param_PHX)
output directory :  ACM_Phoenix_Core
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Phoenix_Core/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Phoenix_Core/data/CONFIG_Phoenix_Core.js
In [17]:
input_attr_PHX.columns
Out[17]:
Index(['geoid', 'period', 'Total Population', 'Per Capita Income',
       'Median household income', '% service industry', '% manufacturing',
       '% College or above', '% Master or above', '% Bachelor's degree',
       '% below poverty', '% structures more than 30 years old',
       '% households moved <10 years ago', '% < 18 years old',
       '% > 60 years old', '% vacant housing', '% owner occupied housing',
       '% multiunit structures', '% Hispanic', '% Not Hispanic or Latino',
       '% Not Hispanic - White', '% Not Hispanic - Black',
       '% Not Hispanic - Asian', '% white', '% black', '% Asian', '% Employed',
       '% Unemployed', '% foreign born', '% health insurance',
       '% without health insurance', '% > 16 years old',
       '% High school or less', '% male', '% female',
       '% American Indian and Alaska Native alone',
       '% Native Hawaiian and other Pacific Islander alone',
       '% some other race alone', '% same house 1 year ago',
       '% different house in united states 1 year ago',
       'Total for means of trasnportation', '% car, truck, or van',
       '% public transportation', '% taxicab', '% bicycle', '% walked',
       '% walk or bicycle to work', '% other means',
       '% taxicab, motorcycle, bicycle, walked, or other means',
       '% living in a place', '% not living in a place',
       'Total for Time to work', 'Less than 30 minutes',
       'less than 10 minutes', '10 to 14 minutes', '15 to 19 minutes',
       '20 to 24 minutes', '25 to 29 minutes', '30 to 34 minutes',
       '35 to 44 minutes', '45 to 59 minutes', '60 or more minutes',
       'Total for Vehicle', '% no vehicle available',
       '% No schooling completed', '% Regular high school diploma',
       '% GED or alternative credential', '% Some college, less than 1 year',
       '% Some college, 1 or more years, no degree', '% Associate's degree',
       '% Master's degree', '% Professional school degree',
       '% Doctorate degree', '% Built 2010 or later', '% built 2014 or later',
       '% built 2010 to 2013', '% built 2000 to 2009', '% built 1990 to 1999',
       '% built 1980 to 1989', '% built 1970 to 1979', '% built 1960 to 1969',
       '% built 1950 to 1959', '% built 1940 to 1949',
       '% built 1939 or earlier', '% owner occupied', '% renter occupied',
       'Total for Units in Structure', 'Mobile home', 'Boat, RV, van, etc.'],
      dtype='object')

Small Multiple Visualization Techniques Using ACM: A Case Study of the Chicago

In [30]:
import pandas as pd
import geopandas as gpd
from Adaptive_Choropleth_Mapper import Adaptive_Choropleth_Mapper_viz, Adaptive_Choropleth_Mapper_log
In [31]:
# Read attributes
input_attr_CHI = pd.read_csv("attributes/ACS_2018_5year__zipcode_Cook_byZipcode_normalized.csv", dtype={'geoid':str})
input_attr_CHI = input_attr_CHI.rename(columns={'GEOID': 'geoid', 'year': 'period'})
input_attr_CHI
Out[31]:
geoid period Median monthly housing costs % with 4year college degree % unemployed % manufacturing % below poverty % structures more than 30 years old % households moved <10 years ago % > 60 years old ... % housing units 1-unit, detached % housing units 1-unit, attached % housing units 2 units % housing units 3 or 4 units % housing units 5 to 9 units % housing units 10 to 19 units % housing units 20 or more units % housing units mobile home % housing units boat, rv, van, etc % housing units two or more
0 60004 2018 1531.0 36.776332 2.355577 11.776084 4.782419 63.965129 38.627019 26.247668 ... 59.491306 8.526129 0.440676 3.793649 11.855152 3.151794 12.741294 0.000000 0.000000 20.127413
1 60005 2018 1328.0 32.387085 3.490593 14.569493 7.904073 76.050294 44.809547 27.401063 ... 46.092456 4.457160 1.084174 1.927421 9.140190 5.435928 29.927722 1.769312 0.165638 38.375245
2 60007 2018 1358.0 23.466325 3.615668 13.549801 3.828198 66.471051 33.641789 26.196888 ... 58.856366 9.432477 0.407930 3.485293 8.494955 3.692836 15.501324 0.128820 0.000000 23.087383
3 60008 2018 1372.0 22.906752 3.823682 10.223113 6.285767 76.331768 46.627566 20.189621 ... 48.585176 8.603506 0.607171 4.009623 5.911330 7.114217 25.168977 0.000000 0.000000 36.899989
4 60010 2018 2431.0 35.542280 2.296360 12.766159 4.214367 48.356571 33.793164 27.452427 ... 82.009071 7.413629 1.528641 2.228568 1.383056 0.425556 4.865894 0.145585 0.000000 9.048659
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
184 60714 2018 1166.0 22.419524 4.338918 9.268662 9.818641 81.559742 39.263006 32.730390 ... 53.470808 8.774610 1.612356 5.465037 7.764766 1.009844 21.469790 0.432790 0.000000 29.557026
185 60803 2018 1065.0 13.532678 6.099911 10.749155 10.313018 68.412787 38.123351 19.776686 ... 51.654515 4.778463 0.897364 5.574874 14.357824 12.462142 7.392036 2.882782 0.000000 26.326416
186 60804 2018 983.0 7.004462 4.599960 20.843393 18.172980 95.407209 48.538558 11.636018 ... 36.604019 2.391994 31.462045 17.044992 6.748841 3.059149 2.237409 0.451550 0.000000 53.803596
187 60805 2018 1383.0 21.959485 2.818781 7.529461 7.201974 92.258153 35.186611 19.348114 ... 83.296794 1.383941 2.562346 2.014250 7.111537 1.534667 2.096465 0.000000 0.000000 8.207728
188 60827 2018 920.0 8.800092 15.027403 9.499459 33.702354 88.474498 46.504442 15.638450 ... 47.434523 19.696738 4.303875 4.671466 12.582325 7.344157 3.147496 0.819421 0.000000 19.466993

189 rows × 222 columns

In [32]:
# Read shapefile
shapefile_CHI = gpd.read_file("shp/Chicago/zipcode_Cook_County.shp", dtype={'geoid':str})
# add or overwrite period column
shapefile_CHI["name"] = shapefile_CHI['GEOID10']
shapefile_CHI = shapefile_CHI.rename(columns={'GEOID10': 'geoid'})
# Reorder columns: geoid (1st), name (2nd), geometry (3rd)
# Keep only these three, or include others if you like
shapefile_CHI = shapefile_CHI[["geoid", "name", "geometry"]]
shapefile_CHI
Out[32]:
geoid name geometry
0 60004 60004 POLYGON ((-87.98511 42.14212, -87.98511 42.141...
1 60005 60005 MULTIPOLYGON (((-87.95428 42.02977, -87.95441 ...
2 60007 60007 POLYGON ((-88.01775 41.99247, -88.01816 41.992...
3 60008 60008 MULTIPOLYGON (((-88.06230 42.07726, -88.06229 ...
4 60010 60010 POLYGON ((-88.05268 42.15381, -88.05282 42.153...
... ... ... ...
184 60714 60714 MULTIPOLYGON (((-87.84537 42.05445, -87.84537 ...
185 60803 60803 POLYGON ((-87.74341 41.69079, -87.74323 41.690...
186 60804 60804 POLYGON ((-87.77800 41.82887, -87.77800 41.829...
187 60805 60805 POLYGON ((-87.70254 41.70617, -87.70279 41.706...
188 60827 60827 POLYGON ((-87.65056 41.65577, -87.65071 41.655...

189 rows × 3 columns

In [36]:
param_CHI = {
    'title': "Socioeconomic Data Visualization in Chicago",
    'filename_suffix': "Chicago_Core",
    'inputCSV': input_attr_CHI,   
    'shapefile': shapefile_CHI,
    'periods': [2018],     
    'variables': [         # Enter variable names of the column you entered above.
        "Median monthly housing costs",
        "% below poverty",
        "% unemployed",
        "% with 4year college degree",
        "% manufacturing",
        "% service industry",
        "% structures more than 30 years old",
        "% households moved <10 years ago",
        "% multiunit structures",
        "% owner occupied housing",
        "% vacant housing",
        "% > 60 years old",
        "% < 18 years old",
        "% white",
        "% Asian",
        "% Hispanic",
        "% black",
        "% foreign born"
    ],
    'NumOfMaps': 18,
    'Initial_map_center':[41.82, -87.85],
    'Initial_map_zoom_level':9,       
    'SortLayers': "compare", # Enter “compare” or “temporal”.  compare mode is for comparing variables at a specific point of time.
                              # temporal mode is for displaying spatiotemporal patterns of the same variable using multiple maps.            
    #'InitialLayers':["1980_% nonhisp white persons", "1990_% nonhisp white persons", "2000_% nonhisp white persons", "2010_% nonhisp white persons"],    
    'Map_width':"400px",
    'Map_height':"480px"   
}  
Adaptive_Choropleth_Mapper_viz(param_CHI)
output directory :  ACM_Chicago_Core
To see your visualization, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Chicago_Core/index.html
To access all visualizations that you have created, click the URL below (or locate the files):
https://cybergisx.cigi.illinois.edu/user/suhan2/view/CyberGIS-Vis/Quantitative_Data_Vis/ACM_log.html
Advanced options are available in 
https://cybergisx.cigi.illinois.edu/user/suhan2/edit/CyberGIS-Vis/Quantitative_Data_Vis/ACM_Chicago_Core/data/CONFIG_Chicago_Core.js
In [26]:
input_attr_CHI.columns
Out[26]:
Index(['geoid', 'period', 'Median monthly housing costs',
       '% with 4year college degree', '% unemployed', '% manufacturing',
       '% below poverty', '% structures more than 30 years old',
       '% households moved <10 years ago', '% > 60 years old',
       ...
       '% housing units 1-unit, detached', '% housing units 1-unit, attached',
       '% housing units 2 units', '% housing units 3 or 4 units',
       '% housing units 5 to 9 units', '% housing units 10 to 19 units',
       '% housing units 20 or more units', '% housing units mobile home',
       '% housing units boat, rv, van, etc', '% housing units two or more'],
      dtype='object', length=222)
In [ ]: