Black Lives Matter. Please consider donating to Black Girls Code today.

How can I save the default color that plotly is generating

Hi ,

How can I save the default color that plotly is generating.
I have a filter and each time I add filter its changing the color as per the color bar.
I am getting the color default from the plotly. But when I add a filter on the data points the color are changing.
but I need to get the initial color which are assigned by plotly.
I am saving the data for the color. But it is still resetting the colors.

Example.
var trace1 = {
y: [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],
mode: ‘markers’,
marker: {
size: 40,
color: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]
}
};

var data = [trace1];

var layout = {
title: ‘Scatter Plot with a Color Dimension’
};

Plotly.newPlot(‘myDiv’, data, layout);

Thank You
Venkat

I don’t understand your question. How are you filtering your data?

Hi Etienne,
I have a slider added . I have added a 3rd party slider. And I am manipulating the dom with it .

I am still playing around . I am not quite sure what’s happening.