Skip to content

Commit d94e58b

Browse files
mahdis-znicolaskruchten
mahdis-z
authored andcommitted
changes based on py tutorial
1 parent 25cd250 commit d94e58b

File tree

6 files changed

+75
-95
lines changed

6 files changed

+75
-95
lines changed

_posts/plotly_js/maps/fill-area-and-symbols-on-mapbox/2019-09-02-fill-area-basic.html

Lines changed: 0 additions & 35 deletions
This file was deleted.

_posts/plotly_js/maps/fill-area-and-symbols-on-mapbox/2019-09-02-line-mapbox.html

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Mapbox Access Token
3+
plot_url: https://codepen.io/plotly/embed/WNepqgo/?height=510&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: filled-area-on-mapbox
6+
order: 1
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
To plot on Mapbox maps with Plotly you `may` need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/javascript/mapbox-layers/) documentation for more information.
11+
There are three different ways to show a filled area in a Mapbox map.
12+
<ol>
13+
<li> Use a [scattermapbox](https://plot.ly/javascript/reference/#scattermapbox) trace and set `fill` attribute to 'toself' </li>
14+
<li> Use a Mapbox layout (i.e. by minimally using an empty Scattermapbox trace) and add a GeoJSON layer </li>
15+
<li> Use the [Choroplethmapbox](https://plot.ly/javascript/mapbox-county-choropleth/) trace type </li>
16+
</ol>
17+
<h6> Filled `Scattermapbox` Trace </h6>
18+
The following example uses `Scattermapbox` and sets `fill = 'toself'`.
19+
---
20+
var data = [
21+
{
22+
type: "scattermapbox",
23+
fill: "toself",
24+
lon: [-74, -70, -70, -74],
25+
lat: [47, 47, 45, 45],
26+
marker: { size: 10, color: "orange" }
27+
}
28+
];
29+
30+
var layout = {
31+
mapbox: {
32+
style: "stamen-terrain",
33+
center: { lon: -73, lat: 46 },
34+
zoom: 5
35+
},
36+
showlegend: false,
37+
height: 450,
38+
width: 600
39+
};
40+
41+
Plotly.newPlot("gd", data, layout);
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: JavaScript Graphing Library D3.js-based Fill Area Mapbox | Examples | Plotly
3-
name: Show an Area, line, or a Symbol on Map
4-
permalink: javascript/lines-on-mapbox/
5-
description: How to define a region or a symbol in map using a D3.js-based scattermapbox.
3+
name: Filled Area on Maps
4+
permalink: javascript/filled-area-on-mapbox/
5+
description: How to make an area on Map using a D3.js-based scattermapbox.
66
layout: user-guide
7-
thumbnail: thumbnail/fill-area.jpg
7+
thumbnail: thumbnail/area.jpg
88
language: plotly_js
99
has_thumbnail: true
1010
display_as: maps
1111
order: 8
1212
---
13-
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","lines-on-mapbox" | sort: "order" %}
13+
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","filled-area-on-mapbox" | sort: "order" %}
1414
{% include auto_examples.html examples=examples %}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
name: Dark tile, Free Token is required
2+
name: GeoJSON Layers
33
plot_url: https://codepen.io/plotly/embed/zYOZVWW/?height=510&theme-id=15263&default-tab=result
44
language: plotly_js
5-
suite: lines-on-mapbox
6-
order: 2
5+
suite: filled-area-on-mapbox
6+
order: 3
77
sitemap: false
88
arrangement: horizontal
99
markdown_content: |
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Multiple Filled Areas with a Scattermapbox trace
3+
plot_url: https://codepen.io/plotly/embed/ZEzeVBM/?height=510&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: filled-area-on-mapbox
6+
order: 2
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
11+
The following example shows how to use `null` in your data to draw multiple filled areas. Such gaps in trace data are unconnected by default, but this can be controlled via the [connectgaps](https://plot.ly/javascript/reference/#scattermapbox-connectgaps) attribute.
12+
---
13+
var data = [{
14+
type: "scattermapbox",
15+
mode: "lines",
16+
fill: "toself",
17+
lon: [-10, -10, 8, 8, -10, null, 30, 30, 50, 50, 30, null, 100, 100, 80, 80, 100],
18+
lat: [30, 6, 6, 30, 30, null, 20, 30, 30, 20, 20, null, 40, 50, 50, 40, 40]
19+
}]
20+
21+
var layout = {
22+
mapbox: {style: "stamen-terrain", center: {lon: 40, lat: 20}, 'zoom': 1.5},
23+
showlegend: false,
24+
width:700, height: 700}
25+
26+
Plotly.newPlot("gd", data, layout)

0 commit comments

Comments
 (0)