-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy path2015-08-11-categorical-dot-plot.html
91 lines (84 loc) · 1.82 KB
/
2015-08-11-categorical-dot-plot.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
84
85
86
87
88
89
90
91
---
name: Categorical Dot Plot
language: plotly_js
suite: dot
order: 1
sitemap: false
arrangement: horizontal
---
var country = ['Switzerland (2011)', 'Chile (2013)', 'Japan (2014)', 'United States (2012)', 'Slovenia (2014)', 'Canada (2011)', 'Poland (2010)', 'Estonia (2015)', 'Luxembourg (2013)', 'Portugal (2011)'];
var votingPop = [40, 45.7, 52, 53.6, 54.1, 54.2, 54.5, 54.7, 55.1, 56.6];
var regVoters = [49.1, 42, 52.7, 84.3, 51.7, 61.1, 55.3, 64.2, 91.1, 58.9];
var trace1 = {
type: 'scatter',
x: votingPop,
y: country,
mode: 'markers',
name: 'Percent of estimated voting age population',
marker: {
color: 'rgba(156, 165, 196, 0.95)',
line: {
color: 'rgba(156, 165, 196, 1.0)',
width: 1,
},
symbol: 'circle',
size: 16
}
};
var trace2 = {
x: regVoters,
y: country,
mode: 'markers',
name: 'Percent of estimated registered voters',
marker: {
color: 'rgba(204, 204, 204, 0.95)',
line: {
color: 'rgba(217, 217, 217, 1.0)',
width: 1,
},
symbol: 'circle',
size: 16
}
};
var data = [trace1, trace2];
var layout = {
title: {
text: 'Votes cast for ten lowest voting age population in OECD countries',
font: {
color: 'rgb(204, 204, 204)'
}
},
xaxis: {
showgrid: false,
showline: true,
linecolor: 'rgb(102, 102, 102)',
tickfont: {
font: {
color: 'rgb(102, 102, 102)'
}
},
autotick: false,
dtick: 10,
ticks: 'outside',
tickcolor: 'rgb(102, 102, 102)'
},
margin: {
l: 140,
r: 40,
b: 50,
t: 80
},
legend: {
font: {
size: 10,
},
yanchor: 'middle',
xanchor: 'right'
},
width: 600,
height: 600,
paper_bgcolor: 'rgb(254, 247, 234)',
plot_bgcolor: 'rgb(254, 247, 234)',
hovermode: 'closest'
};
Plotly.newPlot('myDiv', data, layout);