Public
Edited
May 21, 2023
Insert cell
Insert cell
import {map as GTOverview} with {data1 as data} from "@d3/world-airports"
Insert cell
GTOverview
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
AttackData2= FileAttachment("terroristdata_1990-2020V2.csv").csv()
Insert cell
AttackData2
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Wrangler(AttackData2)
Insert cell
data1 = // To use copied code replace "data" with your own variable
aq.from(AttackData2)
.select('eventid','iyear','country_txt','region_txt','provstate','city','latitude','longitude','attacktype1_txt','targtype1_txt','corp1','target1','natlty1_txt','gname','claimed','weaptype1_txt','nkill','nwound')
.rename({iyear: "year"})
.rename({nkill: "kills"})
.rename({country_txt: "country"})
.rename({provstate: "province/state"})
.rename({nwound: "wounded"})
.rename({region_txt: "region"})
.rename({attacktype1_txt: "attacktype"})
.rename({weaptype1_txt: "weapontype"})
.rename({targtype1_txt: "targettype"})
.rename({natlty1_txt: "nationality"})
.rename({gname: "organisation"})
.filter(d => d["organisation"] !== "Unknown")
.objects() // Uncomment to return an array of objects
Insert cell
data1
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
data2
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
width: 1000,
marginLeft: 300,
marginBottom:50,
x: {
label: "Number of Attacks"
},
y: {
label: "Terrorist Organization",
},
marks: [
Plot.barX(data2, {x: "Number of Attacks", y: "Terrorist Organization", sort:{y: "x", reverse: true}})
]
})
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Plot.auto(data, {
x: "year",
y: { value: "kills", reduce: "count" },
color: "region",
mark: "area"
}).plot({ color: { legend: true } })
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
import {toc} from "@nebrius/indented-toc"
Insert cell
import {Wrangler, op} from "@observablehq/data-wrangler"
Insert cell
import {rangeSlider} from '@mootari/range-slider'
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more