Plotly.newPlot(
DOM.element("div", { style: "height: 500px;" }),
[
{
type: "scatter3d",
mode: "markers",
x: positions.map(p => p[0]),
y: positions.map(p => p[1]),
z: positions.map(p => p[2]),
marker: {
size: 100,
sizemode: "diameter",
sizeref: 1,
color: concentration.map(row => row[t_index]),
cmin: -1,
cmax: 1,
colorscale: [
[0, "blue"],
[0.5, "purple"],
[1, "red"]
],
colorbar: { title: "Concentration" },
opacity: 0.9
}
}
],
{
title: `Concentration at t = ${time[t_index].toFixed(2)}`,
scene: {
xaxis: { title: "X" },
yaxis: { title: "Y" },
zaxis: { title: "Z" }
},
margin: { t: 50 }
}
);