-
Notifications
You must be signed in to change notification settings - Fork 0
/
usamap2.html
40 lines (37 loc) · 1.05 KB
/
usamap2.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
<html>
<head>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script>
// data from worldpopulationreview.com/state-rankings/smoking-rates-by-state
// accessed 2020-11-19
let data = [{
"locations": ["AL", "AK", "AZ", "AR", "CA", "CO", "CT"],
"z": [20.9, 21, 15.6, 22.3, 11.3, 14.6, 12.7],
"locationmode": "USA-states",
"type": "choropleth",
"colorscale": "Viridis"
}];
let layout = {
"title": "Smoking rates by state (%)",
"geo": {
"scope": "usa"
}
};
$(() => {
// everything here happens only after the page is loaded
Plotly.newPlot("myGraph", data, layout);
});
</script>
<style>
#myGraph {
width: 600px;
height: 400px
}
</style>
</head>
<body>
<div>Here is our graph:</div>
<div id="myGraph"></div>
</body>
</html>