Skip to content

Instantly share code, notes, and snippets.

@flother
Last active March 11, 2016 00:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save flother/569b14de04a3c6a878a0 to your computer and use it in GitHub Desktop.
The Counted in southern California
license: cc-by-sa-4.0
border: no
height: 600

People killed by police and other law enforcement agencies in Los Angeles and southern California throughout 2015, broken down by race. The data comes from [The Counted] 1, a project by the Guardian. The map was created using [Vega] 2.

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>The Counted</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/vega/2.5.1/vega.min.js"></script>
</head>
<body>
<div id="vis"></div>
<script type="text/javascript">
function parse(spec) {
vg.parse.spec(spec,
function (error, chart) {
chart({el:"#vis"}).update();
});
}
parse("spec.json");
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"width": 780,
"height": 600,
"padding": {"top": 0, "right": 120, "bottom": 0, "left": 0},
"data": [
{
"name": "us",
"url": "us.json",
"format": {"type": "topojson", "feature": "us"},
"transform": [{
"type": "geopath",
"scale": 24000,
"center": [-118.3, 34.25]
}]
},
{
"name": "urban_area",
"url": "urban_area.json",
"format": {"type": "topojson", "feature": "urban_area"},
"transform": [{
"type": "geopath",
"scale": 24000,
"center": [-118.3, 34.25]
}]
},
{
"name": "counties",
"url": "counties.json",
"format": {"type": "topojson", "feature": "counties"},
"transform": [{
"type": "geopath",
"scale": 24000,
"center": [-118.3, 34.25]
}]
},
{
"name": "los_angeles",
"url": "los_angeles.json",
"format": {"type": "topojson", "feature": "los_angeles"},
"transform": [{
"type": "geopath",
"scale": 24000,
"center": [-118.3, 34.25]
}]
},
{
"name": "cities",
"values": [
{"name": "Los Angeles city limits", "lon": -118.2, "lat": 34.31, "opacity": 0.8},
{"name": "Downtown", "lon": -118.238, "lat": 34.057, "opacity": 0.2},
{"name": "Long Beach", "lon": -118.12, "lat": 33.73, "opacity": 0.2},
{"name": "Anaheim", "lon": -117.889, "lat": 33.87, "opacity": 0.2},
{"name": "Santa Ana", "lon": -117.83, "lat": 33.775, "opacity": 0.2},
{"name": "Irvine", "lon": -117.823, "lat": 33.669, "opacity": 0.2},
{"name": "Glendale", "lon": -118.20, "lat": 34.173, "opacity": 0.2},
{"name": "Pomona", "lon": -117.756, "lat": 34.09, "opacity": 0.2},
{"name": "Torrance", "lon": -118.42, "lat": 33.834722, "opacity": 0.2},
{"name": "Downey", "lon": -118.121, "lat": 33.938, "opacity": 0.2},
{"name": "Arcadia", "lon": -118.036, "lat": 34.133, "opacity": 0.2},
{"name": "Fontana", "lon": -117.51, "lat": 34.1, "opacity": 0.2},
{"name": "Oxnard", "lon": -119.183, "lat": 34.191, "opacity": 0.2},
{"name": "Lancaster", "lon": -118.15, "lat": 34.683333, "opacity": 0.2}
],
"transform": [
{
"type": "geo",
"lon": "lon", "lat": "lat",
"scale": 24000,
"center": [-118.3, 34.25]
}
]
},
{
"name": "thecounted",
"url": "thecounted.csv",
"format": {"type": "csv"},
"transform": [
{
"type": "geo",
"lon": "longitude", "lat": "latitude",
"scale": 24000,
"center": [-118.3, 34.25]
}
]
}
],
"scales": [
{
"name": "race",
"type": "ordinal",
"domain": {"data": "thecounted", "field": "race"},
"range": ["#F48500", "#5080EA", "#e85be8", "#1DA827"]
}
],
"legends": [
{"fill": "race", "title": "Race"}
],
"marks": [
{
"type": "path",
"from": {"data": "us"},
"properties": {
"enter": {
"fill": {"value": "#f0f0f0"},
"path": {"field": "layout_path"}
}
}
},
{
"type": "path",
"from": {"data": "urban_area"},
"properties": {
"enter": {
"fill": {"value": "#d7d8d6"},
"path": {"field": "layout_path"}
}
}
},
{
"type": "path",
"from": {"data": "counties"},
"properties": {
"enter": {
"stroke": {"value": "#fff"},
"path": {"field": "layout_path"}
}
}
},
{
"type": "path",
"from": {"data": "los_angeles"},
"properties": {
"enter": {
"stroke": {"value": "#5e5e5e"},
"path": {"field": "layout_path"}
}
}
},
{
"type": "symbol",
"from": {"data": "thecounted"},
"properties": {
"enter": {
"x": {"field": "layout_x"},
"y": {"field": "layout_y"},
"size": {"value": 25},
"shape": {"value": "cross"},
"fill": {"field": "race", "scale": "race"},
"fillOpacity": {"value": 0.6},
"strokeWidth": {"value": 0}
}
}
},
{
"type": "text",
"from": {"data": "cities"},
"properties": {
"enter": {
"text": {"template": "{{datum.name|upper}}"},
"x": {"field": "layout_x"},
"y": {"field": "layout_y"},
"align": {"value": "center"},
"baseline": {"value": "middle"},
"fontSize": {"value": 10},
"fontWeight": {"value": "bold"},
"fillOpacity": {"value": 0},
"stroke": {"value": "#fff"},
"strokeWidth": {"value": 2},
"strokeOpacity": {"value": 0.2}
}
}
},
{
"type": "text",
"from": {"data": "cities"},
"properties": {
"enter": {
"text": {"template": "{{datum.name|upper}}"},
"x": {"field": "layout_x"},
"y": {"field": "layout_y"},
"align": {"value": "center"},
"baseline": {"value": "middle"},
"fontSize": {"value": 10},
"fontWeight": {"value": "bold"},
"fill": {"value": "#000"},
"fillOpacity": {"field": "opacity"}
}
}
},
{
"type": "text",
"from": {"data": "thecounted"},
"properties": {
"update": {
"text": {"template": "{{tooltip.name|upper}}, {{tooltip.age}}"},
"x": {"signal": "tooltip.layout_x"},
"y": {"signal": "tooltip.layout_y"},
"align": {"value": "center"},
"baseline": {"value": "bottom"},
"dy": {"value": -5},
"fontSize": {"value": 14},
"fillOpacity": {"value": 0},
"stroke": {"value": "#fff"},
"strokeWidth": {"value": 3},
"strokeOpacity": [
{ "test": "datum._id != tooltip._id",
"value": 0
},
{"value": 0.4}
]
}
}
},
{
"type": "text",
"from": {"data": "thecounted"},
"properties": {
"update": {
"text": {"template": "{{tooltip.name|upper}}, {{tooltip.age}}"},
"x": {"signal": "tooltip.layout_x"},
"y": {"signal": "tooltip.layout_y"},
"fillOpacity": [
{ "test": "datum._id != tooltip._id",
"value": 0
},
{"value": 1}
],
"align": {"value": "center"},
"baseline": {"value": "bottom"},
"dy": {"value": -5},
"fontSize": {"value": 14},
"fill": {"value": "#5e5e5e"}
}
}
}
],
"signals": [
{
"name": "tooltip",
"init": {},
"streams": [
{"type": "symbol:mouseover", "expr": "datum"},
{"type": "symbol:mouseout", "expr": "{}"}
]
}
]
}
uid name age race longitude latitude
12 Brian Pickett 26 Black -118.2455 33.9206
27 Brian Barbosa 23 Hispanic/Latino -118.1889 33.9525
52 Pablo Meza 24 Hispanic/Latino -118.2324 34.0362
101 Paul Johnson 59 White -117.6503 33.9534
114 Dean Bucheit 64 White -118.4318 33.9774
124 Jonathan Harden 23 White -117.3321 34.1647
166 Ernesto Javier Canepa Diaz 27 Hispanic/Latino -117.8776 33.7471
174 Charly 'Africa' Keunang 43 Black -118.2453 34.0424
184 Sergio Navas 34 Hispanic/Latino -118.3435 34.151
194 Monique Deckard 43 Black -117.9401 33.819
202 Edixon Franco 37 Hispanic/Latino -117.6547 34.0501
209 Benito Osorio 39 Hispanic/Latino -117.8677 33.7434
205 Aaron Valdez 25 Hispanic/Latino -118.2178 33.9392
211 Antonio Perez 32 Hispanic/Latino -118.2735 34.0279
214 Salome Rodriguez Jr 23 Hispanic/Latino -117.7509 34.0568
215 Andrew Driver 36 White -117.4297 34.0776
263 Victor Terrazas 28 Hispanic/Latino -118.2915 33.9437
264 Adrian Solis 35 Hispanic/Latino -118.2713 33.7934
267 Meagan Hockaday 26 Black -119.1829 34.2278
285 Robert Washington 37 Black -118.3373 33.9019
296 Paul Anderson 31 Black -117.8517 33.8355
305 Roberto Rodriguez 39 Hispanic/Latino -118.2106 34.0401
326 Ernesto Flores 52 Hispanic/Latino -117.7207 34.0511
340 Luis Molina Martinez 35 Hispanic/Latino -118.205 34.0718
350 Hector Morejon 19 Hispanic/Latino -118.1736 33.7808
351 Andrew Valadez 26 White -118.4532 34.3103
361 Dean Genova 45 White -117.9544 33.7619
382 Thong Kien Ma 32 Other -118.0447 34.0536
384 Brendon Glenn 29 Black -118.4726 33.9872
388 Nephi Arriguin 21 Black -118.0504 33.8744
402 Alec Ouzounian 40 White -117.6131 33.6547
454 Feras Morad 20 Other -118.1393 33.7854
491 Rene Garcia 30 Hispanic/Latino -117.9228 33.8472
529 Adrian Simental 24 Hispanic/Latino -117.9002 34.1283
563 Christian Siqueiros 25 Hispanic/Latino -117.7071 34.0668
561 Arturo Lopez 46 Hispanic/Latino -118.1852 34.6712
562 Cesar Juarez 27 Hispanic/Latino -117.8928 34.0233
571 Johnny Ray Anderson 43 Hispanic/Latino -118.072 33.8335
577 John Berry 31 White -118.124 33.8561
576 Jason Hendley 29 Black -118.4125 34.3232
595 Neil White 38 White -118.3433 34.0603
617 Jason Davis 41 White -118.4702 34.0002
653 Seth Raines 44 White -118.3981 34.1438
667 Oscar Romero 47 Hispanic/Latino -118.0552 33.9725
686 Daniel Avila 55 Hispanic/Latino -117.4636 33.3001
701 Derrick Hunt 28 Black -118.1557 33.8749
718 Redel Jones 30 Black -118.3426 34.0088
730 Oscar Ruiz 44 Hispanic/Latino -117.9957 34.0782
743 Raul Herrera III 17 Hispanic/Latino -117.5932 34.024
769 Manuel Soriano 29 Hispanic/Latino -118.4488 34.2051
798 Luis Wenceslao 32 Hispanic/Latino -117.6468 34.0341
799 Manuel Ornelas 47 Hispanic/Latino -118.1036 33.8154
842 William Chau 59 Other -118.029 34.0788
818 Eddie Tapia 41 Hispanic/Latino -118.1139 33.9551
817 Santino Burce 34 Hispanic/Latino -117.44 34.0707
839 Anthony Camacho 19 Hispanic/Latino -117.3835 34.1106
833 Florencio Chaidez 32 Hispanic/Latino -118.4535 34.2284
840 Carlos Wilhelm 39 Hispanic/Latino -118.2667 34.1326
844 Nicholas Johnson 32 White -117.3719 34.1992
874 Norma Guzman 37 Hispanic/Latino -118.2585 34.0253
887 Christian Pena 26 Hispanic/Latino -117.4031 34.0968
889 James Byrd 45 White -118.4663 34.1866
910 William Combs 38 White -117.6034 34.4013
935 Jonathan Peña 27 Hispanic/Latino -118.384 34.0851
925 Johnny Rangel 25 Hispanic/Latino -117.9161 34.0314
937 Dion Ramirez 54 Black -118.2812 33.935
950 Juan Ulloa 34 Hispanic/Latino -117.34 34.0186
1000 Miguel Cano 34 Hispanic/Latino -118.5117 34.213
1016 Ernesto Gamino 25 Hispanic/Latino -117.5105 34.0286
1017 Ramon Salazar 31 Hispanic/Latino -117.3999 34.0062
1040 Martin Rivera 56 Hispanic/Latino -117.421 34.117
1042 James Hall 46 White -117.4364 34.0627
1066 John Gonzalez 18 Hispanic/Latino -118.0817 33.9174
1094 Nicholas Robertson 28 Black -118.2097 33.9173
1098 Roy Carreon 49 Hispanic/Latino -117.3242 34.1084
1111 Mharloun Saycon 39 Other -118.1889 33.8031
1113 Bryant Duncan 23 White -119.0507 34.2195
1120 Ruben Herrera 26 Hispanic/Latino -118.2914 33.8305
1124 Leroy Browning 30 Black -118.0449 34.5713
1156 Tien Hua 33 Other -118.0562 34.0731
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{"type":"Topology","objects":{"us":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","arcs":[[[0]],[[1]],[[2]],[[3]],[[4]],[[5]],[[6]]]}]}},"arcs":[[[4152,2385,0],[20,0],[57,-20],[185,1],[61,-29],[136,-89],[2,-8],[63,-8],[36,10],[141,-94],[99,-8],[185,-83],[52,-3],[9,-11],[15,-90],[180,-191],[38,-28],[26,-34],[31,-75],[-8,-48],[-52,-44],[-38,-10],[-80,29],[-76,49],[-64,23],[-126,4],[-165,-11],[-72,15],[-41,21],[-73,87],[-31,60],[27,64],[19,79],[-29,124],[-17,38],[-68,21],[-53,-9],[-1,13],[-31,27],[-63,19],[-95,-6],[-21,5],[-34,24],[-22,43],[-80,91],[-32,13],[-13,32],[3,7]],[[4142,231,0],[51,24],[84,-10],[28,-23],[20,-20],[0,-31],[24,-59],[77,-112],[-163,0],[-38,121],[-41,34],[-46,-3],[4,79]],[[2119,2451,0],[132,28],[42,-76],[-21,-96],[-121,-28],[-59,57],[27,115]],[[468,5041,0],[122,-71],[174,56],[75,-33],[-69,-90],[-127,-28],[-143,14],[-143,85],[111,67]],[[0,1448,0],[13,6],[22,1],[103,-59],[99,-42],[76,-23],[32,-22],[129,-128],[-66,-43],[-91,-18],[-50,0],[-110,24],[-49,12],[-26,18],[-82,21],[0,253]],[[0,5109,0],[28,-10],[40,-33],[-5,-10],[-47,-35],[-16,-3],[0,91]],[[9999,219,0],[-15,29],[-73,193],[-25,91],[-58,137],[-152,224],[-129,166],[-46,52],[-195,264],[-108,135],[-159,181],[-187,152],[-107,65],[-108,37],[-1,2],[-52,92],[-106,117],[-62,49],[-174,102],[-21,-8],[-12,-17],[3,-13],[-107,32],[-49,110],[-26,26],[-130,133],[-104,121],[-73,23],[-58,29],[-116,102],[-163,91],[-102,35],[-121,28],[-61,70],[-267,166],[-129,106],[-157,167],[-107,90],[-54,21],[-70,46],[-71,46],[-108,34],[-82,16],[-24,-2],[-31,-67],[18,-63],[2,-63],[-129,-9],[-91,-37],[-116,-47],[-82,16],[-89,6],[-89,21],[-72,41],[-95,53],[-26,22],[-109,22],[-52,-26],[-65,29],[-76,158],[22,35],[82,88],[48,19],[12,54],[-3,123],[-91,207],[-133,272],[-81,139],[-105,137],[-83,86],[-74,58],[-105,53],[-116,15],[-153,-12],[-27,-13],[-261,12],[-32,-7],[-18,-20],[-119,-19],[-117,16],[-55,-3],[-172,-51],[-16,-9],[-80,-89],[-74,62],[-83,65],[-64,32],[-185,24],[-142,32],[-44,-12],[-31,10],[-43,14],[-103,56],[-85,29],[-35,2],[-146,81],[-144,35],[-83,38],[-43,5],[-52,-23],[-90,27],[-261,187],[-64,27],[-36,2],[-23,5],[-51,76],[-42,68],[-88,180],[-40,103],[-19,88],[-15,28],[-22,40],[-55,38],[-50,-10],[-49,14],[-108,72],[-52,66],[-95,73],[-24,8],[-55,-18],[-10,4],[-166,168],[-15,11],[-21,2],[-112,88],[-52,8],[-25,7],[-144,44],[-113,43],[0,3194],[9999,0],[0,-9780]]],"transform":{"scale":[0.00022462432059115934,0.00020751322039056907],"translate":[-119.535969171429,32.9831007906488]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment