Plot.plot({
width: width,
height: 400,
padding: 0,
y: {label:"Sub_event_type", domain: ["all" ,"Sexual violence", "Attack","Abduction/forced disappearance","Air/drone strike","Suicide bomb","Shelling/artillery/missile attack","Remote explosive/landmine/IED","Grenade","Armed clash","Government regains territory","Non-state actor overtakes territory"]},
color: {scheme: "BuYlRd", type: "pow", exponent: 1 , domain: [0, 2]},
marks: [
Plot.cell(
violent_20vs21.filter(d=>d.rate<200), {
x: "country",
y: "sub_event_type",
fill: "rate",
inset: 2}
),
Plot.text(
violent_20vs21.filter(d=>d.rate!="500"),
{
x: "country",
y: "sub_event_type",
text: d => {return d.rate==300?".":d3.format(".0%")(d.rate)},
fill: "#000000",
fontWeight: "bold",
}
)
]
})