-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy path2015-08-15-north-america-percipitation-map.html
83 lines (79 loc) · 2.18 KB
/
2015-08-15-north-america-percipitation-map.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
name: North America Precipitation Map
language: plotly_js
suite: scatter-plots-on-maps
order: 3
sitemap: false
arrangement: horizontal
---
d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/2015_06_30_precipitation.csv', function(err, rows){
function unpack(rows, key) {
return rows.map(function(row) { return row[key]; });
}
scl = [[0, 'rgb(150,0,90)'],[0.125, 'rgb(0, 0, 200)'],[0.25,'rgb(0, 25, 255)'],[0.375,'rgb(0, 152, 255)'],[0.5,'rgb(44, 255, 150)'],[0.625,'rgb(151, 255, 0)'],[0.75,'rgb(255, 234, 0)'],[0.875,'rgb(255, 111, 0)'],[1,'rgb(255, 0, 0)']];
var data = [{
type: 'scattergeo',
mode: 'markers',
text: unpack(rows, 'Globvalue'),
lon: unpack(rows, 'Lon'),
lat: unpack(rows, 'Lat'),
marker: {
color: unpack(rows, 'Globvalue'),
colorscale: scl,
cmin: 0,
cmax: 1.4,
reversescale: true,
opacity: 0.2,
size: 2,
colorbar:{
thickness: 10,
title: {side:
'right'
},
outlinecolor: 'rgba(68,68,68,0)',
ticks: 'outside',
ticklen: 3,
shoticksuffix: 'last',
ticksuffix: 'inches',
dtick: 0.1
}
},
name: 'NA Precipitation'
}];
var layout = {
geo:{
scope: 'north america',
showland: true,
landcolor: 'rgb(212,212,212)',
subunitcolor: 'rgb(255,255,255)',
countrycolor: 'rgb(255,255,255)',
showlakes: true,
lakecolor: 'rgb(255,255,255)',
showsubunits: true,
showcountries: true,
resolution: 50,
projection: {
type: 'conic conformal',
rotation: {
long: -100
}
},
},
longaxis: {
showgrid: true,
gridwidth: 0.5,
range: [ -140.0, -55.0 ],
dtick: 5
},
lataxis: {
showgrid: true,
gridwidth: 0.5,
range: [ 20.0, 60.0 ],
dtick: 5
},
title: 'North America Precipitation',
width: 600,
height: 600
};
Plotly.newPlot('myDiv', data, layout);
});