Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Problem with scatter plot if the color vector contains only zeros

Hello,

The problem occurs for the scatter plot.
If all values are 0s in the color vector, then the color of dots is orange instead of expected light grey.
As a remark, for the 3D scatter plot it works well.
Thanks!

Fabrice

Can you share a reproducible example?

var trace1 = {
y: [5, 5, 5, 5, 5],
mode: ‘markers’,
marker: {
size: 40,
color: [0, 0, 0, 0, 0]
}
};

var data = [trace1];

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

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

Ha. Thanks for bringing this up.

I file a bug report here https://github.com/plotly/plotly.js/issues/1109. I’d recommend subscribe to the issue for the latest development info.

Thanks for you quick reply!

Is there a way to force the color of points to a given color?

Setting marker.color: ['red', 'green', 'blue'] should do the trick.

Thank you for you answer, but I do not understand how this works.
Could you please give me an example related to the use case with the bug above to force setting the 5 points to a grey color?
Thanks!