What is the default color scale and schema in Plot.dot?

I am trying to replicate the look of a scatter plot (using defaults) in a custom ScatterMatrix that I copied from somewhere.

How can I identify the d3 schema and color scales being used in the single scatter plot? It looks like Sequential with Turbo or something like that but I haven’t yet got it to work in the scatter matrix like this:

Have poked around in chrome devtools but yet to figure out how to see the d3 spec underlying the plots. I can troll the code but I imagine there is some trick/better way to do this.

Yup, turbo is the default in Plot for quantitative scales. And in general, you can access the scales in a Plot from elsewhere by naming the plot, say, myPlot, and then calling e.g. myPlot.scale("color"). Example (with some links to the Plot source code).

So you’re trying to use that Scatterplot Matrix notebook with a turbo color scale instead? Currently, it uses a categorical color scale to distinguish different discrete species of penguin. Turbo is a quantitative scale, so it doesn’t work if you just drop it in. Are you trying to color by a quantitative variable, or trying to discretize turbo?

1 Like

I imagine there is some trick/better way to do this.

One thing you might be looking for is some kind of automatic translation between Plot scales and D3 scales…? That doesn’t quite exist right now; Plot will give you back an object that may represent a D3 scale, but has some different properties. There’s some discussion of this in a recent Plot issue on GitHub. But you can usually construct a Plot scale from a D3 scale or vice versa. Plot seems to be moving fast in this area lately, exposing scales for legends and what not, so there may be room to expose some helper functions or something.

1 Like

Yes, I’m coloring by quantitative variable I think it’s using d3.scaleSequential … it is just Plot.dot(…, stroke=“date”) so whatever stroke default maps to.