Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.8k
Updates for maplibre maps#4706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
a4a785ea91346376f6756608d1149dc82024a70af62e0f1843b581e6b90f6ea8e2538d671c80d4b382e3b849b3858b3e61bce8097fdae821022b9957983874614e37e31fde09ef804088fcb2bffa931e41ffb77610c5104155f43472bacb5ba9c413e994f13b7aff21b0c45b3e243e6d7e2eefc8872f0b792a5e9af83303376c6dbfd121572bd7dc64fc6d8124730c338afbf0a1c7f88f34d59965d97a0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,10 +5,10 @@ jupyter: | ||
| text_representation: | ||
| extension: .md | ||
| format_name: markdown | ||
| format_version: '1.2' | ||
| jupytext_version: 1.3.1 | ||
| format_version: '1.3' | ||
| jupytext_version: 1.16.3 | ||
| kernelspec: | ||
| display_name: Python 3 | ||
| display_name: Python 3 (ipykernel) | ||
| language: python | ||
| name: python3 | ||
| language_info: | ||
| @@ -20,15 +20,15 @@ jupyter: | ||
| name: python | ||
| nbconvert_exporter: python | ||
| pygments_lexer: ipython3 | ||
| version: 3.6.8 | ||
| version: 3.10.0 | ||
| plotly: | ||
| description: How to create colormaped representations of USA counties by FIPS | ||
| values in Python. | ||
| display_as: maps | ||
| language: python | ||
| layout: base | ||
| name: USA County Choropleth Maps | ||
| order: 10 | ||
| order: 11 | ||
| page_type: u-guide | ||
| permalink: python/county-choropleth/ | ||
| thumbnail: thumbnail/county-choropleth-usa-greybkgd.jpg | ||
| @@ -37,7 +37,7 @@ jupyter: | ||
| ### Deprecation warning | ||
| This page describes a [legacy "figure factory" method](/python/figure-factories/) for creating map-like figures using [self-filled scatter traces](/python/shapes). **This is no longer the recommended way to make county-level choropleth maps**, instead we recommend using a [GeoJSON-based approach to making outline choropleth maps](/python/choropleth-maps/) or the alternative [Mapbox tile-based choropleth maps](/python/mapbox-county-choropleth). | ||
| This page describes a [legacy "figure factory" method](/python/figure-factories/) for creating map-like figures using [self-filled scatter traces](/python/shapes). **This is no longer the recommended way to make county-level choropleth maps**, instead we recommend using a [GeoJSON-based approach to making outline choropleth maps](/python/choropleth-maps/) or the alternative [tile-based choropleth maps](/python/tile-county-choropleth). | ||
gvwilson marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| #### Required Packages | ||
| @@ -274,7 +274,7 @@ fig.layout.template = None | ||
| fig.show() | ||
| ``` | ||
| Also see Mapbox county choropleths made in Python: [https://plotly.com/python/mapbox-county-choropleth/](https://plotly.com/python/mapbox-county-choropleth/) | ||
| Also see tile county choropleths made in Python: [https://plotly.com/python/tile-county-choropleth/](https://plotly.com/python/tile-county-choropleth/) | ||
gvwilson marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ### Reference | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,10 +5,10 @@ jupyter: | ||
| text_representation: | ||
| extension: .md | ||
| format_name: markdown | ||
| format_version: '1.2' | ||
| jupytext_version: 1.3.0 | ||
| format_version: '1.3' | ||
| jupytext_version: 1.16.3 | ||
| kernelspec: | ||
| display_name: Python 3 | ||
| display_name: Python 3 (ipykernel) | ||
| language: python | ||
| name: python3 | ||
| language_info: | ||
| @@ -20,7 +20,7 @@ jupyter: | ||
| name: python | ||
| nbconvert_exporter: python | ||
| pygments_lexer: ipython3 | ||
| version: 3.7.3 | ||
| version: 3.10.0 | ||
| plotly: | ||
| description: How to use datashader to rasterize large datasets, and visualize | ||
| the generated raster data with plotly. | ||
| @@ -36,10 +36,10 @@ jupyter: | ||
| [datashader](https://datashader.org/) creates rasterized representations of large datasets for easier visualization, with a pipeline approach consisting of several steps: projecting the data on a regular grid, creating a color representation of the grid, etc. | ||
| ### Passing datashader rasters as a mapbox image layer | ||
| ### Passing datashader rasters as a tile map image layer | ||
| We visualize here the spatial distribution of taxi rides in New York City. A higher density | ||
| is observed on major avenues. For more details about mapbox charts, see [the mapbox layers tutorial](/python/mapbox-layers). No mapbox token is needed here. | ||
| is observed on major avenues. For more details about tile-based maps, see [the tile map layers tutorial](/python/tile-map-layers). | ||
| ```python | ||
| import pandas as pd | ||
| @@ -51,7 +51,7 @@ cvs = ds.Canvas(plot_width=1000, plot_height=1000) | ||
| agg = cvs.points(dff, x='Lon', y='Lat') | ||
| # agg is an xarray object, see http://xarray.pydata.org/en/stable/ for more details | ||
| coords_lat, coords_lon = agg.coords['Lat'].values, agg.coords['Lon'].values | ||
| # Corners of the image, which need to be passed to mapbox | ||
| # Corners of the image | ||
| coordinates = [[coords_lon[0], coords_lat[0]], | ||
| [coords_lon[-1], coords_lat[0]], | ||
| [coords_lon[-1], coords_lat[-1]], | ||
| @@ -62,16 +62,12 @@ import datashader.transfer_functions as tf | ||
| img = tf.shade(agg, cmap=fire)[::-1].to_pil() | ||
| import plotly.express as px | ||
| # Trick to create rapidly a figure with mapbox axes | ||
| fig = px.scatter_mapbox(dff[:1], lat='Lat', lon='Lon', zoom=12) | ||
| # Add the datashader image as a mapbox layer image | ||
| fig.update_layout(mapbox_style="carto-darkmatter", | ||
| mapbox_layers = [ | ||
| { | ||
| "sourcetype": "image", | ||
| "source": img, | ||
| "coordinates": coordinates | ||
| }] | ||
| # Trick to create rapidly a figure with map axes | ||
archmoj marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| fig = px.scatter_map(dff[:1], lat='Lat', lon='Lon', zoom=12) | ||
| # Add the datashader image as a tile map layer image | ||
| fig.update_layout( | ||
| map_style="carto-darkmatter", | ||
| map_layers=[{"sourcetype": "image", "source": img, "coordinates": coordinates}], | ||
| ) | ||
| fig.show() | ||
| ``` | ||
| @@ -113,7 +109,3 @@ fig.update_traces(hoverongaps=False) | ||
| fig.update_layout(coloraxis_colorbar=dict(title='Count', tickprefix='1.e')) | ||
| fig.show() | ||
| ``` | ||
| ```python | ||
| ``` | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.