Skip to content

Commit bcb4ed2

Browse files
authored
Merge pull request #309 from plotly/maps-updates
Maps docs updates for Plotly.js
2 parents 0d1d3e0 + 143f48a commit bcb4ed2

File tree

37 files changed

+302
-183
lines changed

37 files changed

+302
-183
lines changed

_posts/plotly_js/fundamentals/config-options/2019-10-24-double-click-delay.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
arrangement: horizontal
88
markdown_content: |
99
Sets the maximum delay between two consecutive clicks to be interpreted as a double-click in ms. This is the time interval between first mousedown, and' second mouseup. The default timing is 300 ms (less than half a second).
10-
This setting propagates to all on-subplot double clicks, (except for geo and mapbox).
10+
This setting propagates to all on-subplot double clicks, (except for geo, map, and mapbox).
1111
---
1212
var data = [{
1313
type: "bar",

_posts/plotly_js/maps/bubble-maps/2015-07-11-bubble_maps_plotlyjs_index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
language: plotly_js
66
layout: base
77
name: Bubble Maps
8-
order: 5
8+
order: 6
99
page_type: example_index
1010
permalink: javascript/bubble-maps/
1111
redirect_from: javascript-graphing-library/bubble-maps/
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
---
2-
name: Dark tile, Needs Token
2+
name: Dark tile
33
language: plotly_js
4-
suite: mapbox-county-choropleth
4+
suite: tile-county-choropleth
55
order: 3
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |
9-
This example uses [zmin and zmax](https://plotly.com/javascript/reference/choroplethmapbox/#choroplethmapbox-zmin) to define the lower bound and upper bound of the color domain. If these attributes are not set, Plotly [determines the color domain](https://plotly.com/javascript/reference/heatmap/#heatmap-zauto) based on the input data.
9+
This example uses [zmin and zmax](https://plotly.com/javascript/reference/choroplethmap/#choroplethmap-zmin) to define the lower bound and upper bound of the color domain. If these attributes are not set, Plotly [determines the color domain](https://plotly.com/javascript/reference/heatmap/#heatmap-zauto) based on the input data.
1010
---
1111

1212
var data = [{
13-
type: "choroplethmapbox", name: "US states", geojson: "https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json", locations: [ "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" ],
13+
type: "choroplethmap", name: "US states", geojson: "https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json", locations: [ "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" ],
1414
z: [ 141, 140, 155, 147, 132, 146, 151, 137, 146, 136, 145, 141, 149, 151, 138, 158, 164, 141, 146, 145, 142, 150, 155, 160, 156, 161, 147, 164, 150, 152, 155, 167, 145, 146, 151, 154, 161, 145, 155, 150, 151, 162, 172, 169, 170, 151, 152, 173, 160, 176 ],
1515
zmin: 25, zmax: 280, colorbar: {y: 0, yanchor: "bottom", title: {text: "US states", side: "right"}}}
1616
];
1717

18-
var layout = {mapbox: {style: "dark", center: {lon: -110, lat: 50}, zoom: 0.8}, width: 600, height: 400, margin: {t: 0, b: 0}};
18+
var layout = {map: {style: "dark", center: {lon: -110, lat: 50}, zoom: 0.8}, width: 600, height: 400, margin: {t: 0, b: 0}};
1919

20-
var config = {mapboxAccessToken: "your access token"};
21-
22-
Plotly.newPlot('myDiv', data, layout, config);
20+
Plotly.newPlot('myDiv', data, layout);
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
---
2-
name: Basic Tile, Needs Token
2+
name: Basic Tile
33
language: plotly_js
4-
suite: mapbox-county-choropleth
4+
suite: tile-county-choropleth
55
order: 1
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |
99

10-
This tutorial uses [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/api/) to make a map of US states using [vector tiles](https://plotly.com/javascript/mapbox-layers/).
10+
This tutorial uses [Maplibre GL JS](https://maplibre.org/maplibre-gl-js/docs/) to make a map of US states using [vector tiles](https://plotly.com/javascript/map-layers/).
1111
---
1212

1313
var data = [{
14-
type: "choroplethmapbox", locations: ["NY", "MA", "VT"], z: [-50, -10, -20],
14+
type: "choroplethmap", locations: ["NY", "MA", "VT"], z: [-50, -10, -20],
1515
geojson: "https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json"
1616
}];
1717

18-
var layout = {mapbox: {center: {lon: -74, lat: 43}, zoom: 3.5},
18+
var layout = {map: {center: {lon: -74, lat: 43}, zoom: 3.5},
1919
width: 600, height:400};
2020

21-
var config = {mapboxAccessToken: "your access token"};
22-
23-
Plotly.newPlot('myDiv', data, layout, config);
21+
Plotly.newPlot('myDiv', data, layout);
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
---
2-
name: Streets Tile, Needs Token
2+
name: Streets Tile
33
language: plotly_js
4-
suite: mapbox-county-choropleth
4+
suite: tile-county-choropleth
55
order: 2
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |
99

10-
The following example sets `geojson object` of type `feature` and geometries of type 'Polygon'. For more information see [geojson attribute](https://plotly.com/javascript/reference/choroplethmapbox/#choroplethmapbox-geojson) in the reference page.
11-
As you see, scattermapbox trace is above Choropleth mapbox. To set the Choropleth mapbox above all the other traces you should set [below attribute](https://plotly.com/javascript/reference/choroplethmapbox/#choroplethmapbox-below).
10+
The following example sets `geojson object` of type `feature` and geometries of type 'Polygon'. For more information see [geojson attribute](https://plotly.com/javascript/reference/choroplethmap/#choroplethmap-geojson) in the reference page.
11+
As you see, the scattermap trace is above the Choropleth map trace. To set the Choropleth map trace above all the other traces you should set [below attribute](https://plotly.com/javascript/reference/choroplethmap/#choroplethmap-below).
1212
---
1313
var data = [
14-
{type: "scattermapbox", lon: [-86], lat: [34], marker: {size: 20, color: 'purple'}},
14+
{type: "scattermap", lon: [-86], lat: [34], marker: {size: 20, color: 'purple'}},
1515
{
16-
type: "choroplethmapbox",locations: ["AL"], z: [10], coloraxis: "coloraxis", geojson: {type: "Feature", id: "AL", geometry: {type: "Polygon", coordinates: [[
16+
type: "choroplethmap",locations: ["AL"], z: [10], coloraxis: "coloraxis", geojson: {type: "Feature", id: "AL", geometry: {type: "Polygon", coordinates: [[
1717
[-86, 35], [-85, 34], [-85, 32], [-85, 32], [-85, 32], [-85, 32], [-85, 31],
1818
[-86, 31], [-87, 31], [-87, 31], [-88, 30], [-88, 30], [-88, 30], [-88, 30],
1919
[-88, 34], [-88, 35]]]
2020
}}}];
2121

22-
var layout = {width: 600, height: 400, mapbox: {style: 'streets',
22+
var layout = {width: 600, height: 400, map: {style: 'streets',
2323
center: {lon: -86, lat: 33}, zoom: 5}, marker: {line: {color: "blue"}},
2424
coloraxis: {showscale: false, colorscale: "Viridis"}};
2525

26-
Plotly.setPlotConfig({mapboxAccessToken: "your access token"});
27-
2826
Plotly.newPlot('myDiv', data, layout);
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
description: How to make a D3.js-based choropleth mapbox in JavaScript. A Choropleth
3-
mapbox shades geographic regions by value.
2+
description: How to make a tile-based choropleth map in JavaScript. A Choropleth map shades geographic regions by value.
43
display_as: maps
54
language: plotly_js
65
layout: base
7-
name: Choropleth Mapbox
8-
order: 3
6+
name: Choropleth Tile Map
7+
order: 4
98
page_type: example_index
10-
permalink: javascript/mapbox-county-choropleth/
9+
permalink: javascript/tile-county-choropleth/
10+
redirect_from: javascript/mapbox-county-choropleth/
1111
thumbnail: thumbnail/mapbox-choropleth.png
1212
---
1313

14-
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","mapbox-county-choropleth" | sort: "order" %}
14+
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","tile-county-choropleth" | sort: "order" %}
1515
{% include posts/auto_examples.html examples=examples %}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Basic Tile using Mapbox
3+
language: plotly_js
4+
suite: tile-county-choropleth
5+
order: 4
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
10+
<strong>> Mapbox traces are deprecated and may be removed in a future version of Plotly.js.</strong>
11+
12+
Earlier examples use traces that render with [Maplibre GL JS](https://maplibre.org/maplibre-gl-js/docs/).
13+
These traces were introduced in Plotly.js 2.35.0 and replace Mapbox-based tile maps,
14+
which are now deprecated. Here's one of the earlier examples using the Mapbox-based `choroplethmapbox` trace
15+
---
16+
17+
var data = [{
18+
type: "choroplethmapbox", locations: ["NY", "MA", "VT"], z: [-50, -10, -20],
19+
geojson: "https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json"
20+
}];
21+
22+
var layout = {mapbox: {center: {lon: -74, lat: 43}, zoom: 3.5},
23+
width: 600, height:400};
24+
25+
var config = {mapboxAccessToken: "your access token"};
26+
27+
Plotly.newPlot('myDiv', data, layout, config);

_posts/plotly_js/maps/choropleth-maps/2015-07-11-choropleth_plotly_js_index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
language: plotly_js
66
layout: base
77
name: Choropleth Maps
8-
order: 8
8+
order: 9
99
permalink: javascript/choropleth-maps/
1010
redirect_from: javascript-graphing-library/choropleth-maps/
1111
thumbnail: thumbnail/choropleth.jpg

_posts/plotly_js/maps/choropleth-maps/2016-08-04-florida-counties.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
d3.json('https://raw.githubusercontent.com/plotly/datasets/master/florida-blue-data.json', function(bluejson) {
1313

1414
Plotly.newPlot('myDiv', [{
15-
type: 'scattermapbox',
15+
type: 'scattermap',
1616
lat: [46],
1717
lon: [-74]
1818
}], {
1919
title: "Florida Counties",
2020
height: 600,
2121
width: 600,
22-
mapbox: {
22+
map: {
2323
center: {
2424
lat: 28,
2525
lon: -84
@@ -41,8 +41,6 @@
4141
},
4242
]
4343
}
44-
}, {
45-
mapboxAccessToken: 'your access token'
4644
});
4745

4846

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
name: Stamen Terrain Tile that Needs no Token
2+
name: Stamen Terrain Tile
33
language: plotly_js
4-
suite: mapbox-density-heatmaps
5-
order: 1
4+
suite: tile-density-heatmaps
5+
order: 5
66
sitemap: false
77
layout: base
88
arrangement: horizontal
99
markdown_content: |
1010

11-
To plot on Mapbox maps with Plotly you may need a Mapbox account and a public [Mapbox Access Token](https://studio.mapbox.com). See our [Mapbox Map Layers](https://plotly.com/javascript/mapbox-layers/) documentation for more information.
11+
1212
---
1313
var data = [{type: 'densitymapbox', lon: [10, 20, 30], lat: [15, 25, 35], z: [1, 3, 2]}];
1414

15-
var layout = {width: 600, height: 400, mapbox: {style: 'stamen-terrain'}};
15+
var layout = {width: 600, height: 400, mapbox: {style: 'https://tiles.stadiamaps.com/styles/stamen_watercolor.json?api_key=YOUR-API-KEY'}};
1616

1717
Plotly.newPlot('myDiv', data, layout);

0 commit comments

Comments
 (0)