Public
Edited
May 18, 2023
Insert cell
Insert cell
data_sexo = [
{sexo: "M", "percentage": 0.8844045258},
{sexo: "H", "percentage": 0.04934095416},
{sexo: "Sin inf.", "percentage": 0.06543800303},
{sexo: "Inter", "percentage": 0.0004665811268},
{sexo: "NS/NR", "percentage": 0.0003499358451}
]
Insert cell
chart = BarChart(data_sexo, {
x: d => d.sexo,
y: d => d.percentage,
xDomain: d3.groupSort(data_sexo, ([d]) => -d.percentage, d => d.sexo), // sort by descending frequency
yFormat: "%",
yLabel: "↑ %",
width,
height: 500,
color: "#B790D3"
})
Insert cell
import {BarChart} from "@d3/bar-chart"
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