Public
Edited
Mar 14, 2024
1 star
Insert cell
Insert cell
langevitour = import("https://cdn.skypack.dev/langevitour");
Insert cell
{
// Generate a sample dataset
let X = [ ];
let group = [ ];
let pointSize = [ ];
let r = ()=>(Math.random()-0.5)*0.2;
let n = 1000;
for(let i=0;i<n;i++) {
let a=i/n * Math.PI * 2;
X.push([
10+Math.sin(a)/3+r(),
20+Math.sin(a*2)/3+r(),
30+Math.sin(a*3)/3+r(),
40+Math.sin(a*4)/3+r(),
50+Math.sin(a*5)/3+r()
]);
group.push( Math.floor(i*4/n) );
pointSize.push((i%10+10)/10);
}
let val = {
X:X,
group:group,
center: [10,20,30,40,50],
scale: [2,1,1,1,1],
levels:['a','b','c','d'],
colnames:['V1','V2','V3','V4','V5'],
//pointSize: 3,
pointSize: pointSize,
};
let container = document.createElement("div");
let tour = new langevitour.Langevitour(container, 800, 600);
tour.renderValue(val);

// Ensure widget doesn't continue to run after being replaced.
invalidation.then(() => {
console.log("Invalidation happened, deactivate widget.");
tour.renderValue(null);
})
return container;
}
Insert cell
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