Plot.plot({
width: 700,
height: 400,
x: {label: "Año", type: "linear"},
y: {label: "Cantidad de obras influenciadas"},
marks: [
Plot.line(
d3.rollups(influenciados1, v => v.length, d => +d.year)
.map(d => ({year: d[0], count: d[1]}))
.sort((a, b) => a.year - b.year),
{x: "year", y: "count", stroke: "#5e60ce"}
),
Plot.dot(
d3.rollups(influenciados1, v => v.length, d => +d.year)
.map(d => ({year: d[0], count: d[1]}))
.sort((a, b) => a.year - b.year),
{x: "year", y: "count", fill: "#5e60ce"}
),
Plot.text(
d3.rollups(influenciados1, v => v.length, d => +d.year)
.map(d => ({year: d[0], count: d[1]}))
.sort((a, b) => a.year - b.year),
{
x: "year",
y: d => d.count,
text: d => d.count,
dy: -8,
fontSize: 10
}
)
]
});