Hi everyone,

I have a little issue concerning my Ridgeline Plot.

I wanted to make a Ridgeline Plot, which changes, when using a dropdown menu to change the data.

So I started making a simple ridgeline plot first, with static data.

But here comes the issue:

The first rows are fine, but one of them is kinda off.

The line is not closing on the same y-coord. like at the beginning of the line-path.

I changed the last point of the line in the browser, and it was really the problem.

The code snippet:

```
const kde = kernelDensityEstimator(kernelEpanechnikov(7), xR.ticks(150))
const allDensity = []
for (i = 0; i < monthN; i++) {
key = monthsAvg[i]
density = kde( yearData.map(function(d){ return d[key]; }) )
allDensity.push({key: key, density: density})
}
svgR.selectAll("areas")
.data(allDensity)
.join("path")
.attr("transform", function(d){return(`translate(0, ${(yNameR(d.key)-heightR)})`)})
.datum(function(d){return(d.density)})
.attr("fill", "#69b3a2")
.attr("stroke", "#000")
.attr("stroke-width", 0.5)
.attr("d", d3.line()
.curve(d3.curveBasis)
.x(function(d) { return xR(d[0]); })
.y(function(d) { return yR(d[1]); })
);
function kernelDensityEstimator(kernel, X) {
return function(V) {
return X.map(function(x) {
return [x, d3.mean(V, function(v) { return kernel(x - v); })];
});
};
}
function kernelEpanechnikov(k) {
return function(v) {
return Math.abs(v /= k) <= 1 ? 0.75 * (1 - v * v) / k : 0;
};}
```

I donâ€™t know how to fix this problem, since those plots are based on my data.

Maybe someone here does know how to approach this.

Thank you in advance!

Greetings