Hi, all
I have a piece of data that I want to categorize by cell or lib (depending on the user’s choice). What should I do?
Thank you for your advance help.
//colored represents the user's choice(cell or lib)
//colorArr represents the length of the color to be drawn
var data=[{"x": -0.44972, "y": 0.1771, "cell": "I1", "lib": "S5"}, {"x": 0.19, "y": 0.752, "cell": "I1", "lib": "S6"}, {"x": -0.21137, "y": -0.2388, "cell": "I1", "lib": "S3"}, {"x": -0.0348, "y": 0.01171, "cell": "I1", "lib": "S6"}, {"x": -0.357, "y": 0.822, "cell": "I1", "lib": "S6"}, {"x": -0.2543, "y": -0.3184, "cell": "I1", "lib": "S6"}, {"x": -0.1235, "y": 0.2822, "cell": "I3", "lib": "S6"}, {"x": -0.43765, "y": -0.34685, "cell": "I1", "lib": "S6"}]
var color = d3
.scaleLinear()
.domain([0, 1]) // Points per square pixel.
.range( [
"#e31a1c",
"#1f78b4",
"#ff7f00",
"#b2df8a",
"#87843b",
"#fb9a99",
"#8dd3c7"]);
svg
.append("g")
.selectAll()
.data(data)
.join("circle")
.attr("cx", (d) => x(d.umap_x))
.attr("cy", (d) => y(d.umap_y))
.attr("r", 2);