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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more