Could you please clarify how to colorize point according to category? Am i right that category point values are should be indexes to pointColor array of hex RGB values?
I have two scenarios in mind:
-
There are two clusters of points, with points category values, for instance, 5 and 6. How i should map these categories to ["#b0b5fb", "#fbb0b0"] in colormap?
-
Category values are continuous float intensity numbers between, let's say, [0, 1]. How can i map these to sequential color map, that is calculated like:
import { scaleSequential, rgb, interpolateRainbow } from "d3";
const categories = [0.9142996651785714, 0.6185661394571521, 0.4210590563322369, 0.37805454905440167, 0.6646064142262713,…];
const min = Math.min(...categories);
const max = Math.max(...categories);
const colorScale = scaleSequential(interpolateRainbow).domain([min, max]);
const colors: string[] = [];
for (let i = 0; i < categories.length; i++) {
colors.push(rgb(colorScale(i)).hex());
}
this.scatterplot.set({
colorBy: "category",
pointColor: colors,
});
It would be very useful to provide color values directly in point value array. Something like [x, y, category, value, "#fbb0b0"].
Could you please clarify how to colorize point according to category? Am i right that
categorypoint values are should be indexes topointColorarray of hex RGB values?I have two scenarios in mind:
There are two clusters of points, with points category values, for instance,
5and6. How i should map these categories to ["#b0b5fb", "#fbb0b0"] in colormap?Category values are continuous float intensity numbers between, let's say, [0, 1]. How can i map these to sequential color map, that is calculated like:
It would be very useful to provide color values directly in point value array. Something like [x, y, category, value, "#fbb0b0"].