Public
Edited
Apr 19, 2023
Insert cell
Insert cell
Insert cell
{
const colors = ({dark: '#505459', light: '#fff'})
const plot = Plot.plot({
marginRight: 130,
marginLeft: 65,
marginBottom: 0,
marginTop: 25,
width: 900,
height: 300,
style: {
color: colors.dark
},
y: {
label: NaN,
tickSize: 0,
axis: 'right'
},
x: {
label: NaN,
tickSize: 0,
axis: 'top'
},
color: {
type: "linear",
scheme: "rdgy",
},
marks:[
Plot.cell(instituciones_polarizacion, {
x: '1',
y: '2',
fill: 'valor',
// title: d => `${d.valor}% de ${labels[d.demografia]}\ncree que ${d['importantes para el futuro']}\nson importantes para el futuro del país`,
insetLeft: -6,
insetBottom: 2,
// fillOpacity: .8,
fillOpacity: d => Math.abs(d.valor) == 1 ? 0 : d.valor > 0 ? .5 : 1.,
sort: {
y: 'fill',
x: 'fill',
reduce: 'first',
reverse: true
}
}),
Plot.text(instituciones_polarizacion, {
x: '1',
y: '2',
text: 'valor',
fill: colors.light,
// fill: d => d.valor < median ? colors.dark : colors.light
})
]
})
return plot
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
instituciones_polarizacion = {
const data = aq.fromCSV(await FileAttachment("instituciones_confianza_pairwisecorr.csv").text())
return data.fold(aq.range(1,6)).rename(aq.names('1','2', 'valor'))
}
Insert cell
instituciones_polarizacion.view()
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