Last active
September 23, 2020 21:22
-
-
Save janbenetka/600c4507023b2daf663ff5d1835faf23 to your computer and use it in GitHub Desktop.
[Cartoframes plot ploygons with points] #carto #python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cartoframes.viz import Map, Layer, basemaps | |
from cartoframes.viz import Layer, color_continuous_style, color_bins_style, basic_style, color_category_legend | |
_df = average_duration.copy() | |
metric = 'avg_duration_day' | |
origin_county = selected_area_geom.iloc[0]['county_name'] | |
origin_state = selected_area_geom.iloc[0]['state_name'] | |
Map( | |
[Layer(_df[[metric, 'geog']], | |
color_bins_style(metric, method='quantiles', palette='TealRose', stroke_width=2, stroke_color='black', animate=None), | |
title = "Mean duration (days) in destination county", | |
encode_data=False, | |
geom_col='geog') , | |
Layer(selected_area_geom, | |
geom_col='geog', | |
style=basic_style(color='white', opacity=1.0), | |
legends=color_category_legend(title = f'{origin_county} ({origin_state})', | |
description = 'Origin area', | |
prop = 'color', | |
dynamic = True)) | |
], | |
is_static = False, | |
basemap=basemaps.darkmatter | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment