Skip to content

Instantly share code, notes, and snippets.

@flother
Last active March 11, 2016 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flother/569b14de04a3c6a878a0 to your computer and use it in GitHub Desktop.
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment