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

Parallel Plots color scale issue

What I want is to have the lines in my parallel plot be colored either red or green based on a certain criteria. So I have my plot data defined like below, and for colorValues, the values are always either 0 or 1. Most of the time this works correctly (i’m seeing both red and green), but in some instances the I’m seeing the color being plotted a 3rd brownish color that I haven’t defined and I’m not clear where this is coming from.

How does the colorscale work exactly?

let data = [
{
type: ‘parcoords’,
pad: [80,80,80,80],
line: {
color: colorValues,
colorscale: [[0, ‘red’], [1, ‘green’]]
},
dimensions: [
{
label: ‘Targets’,
values: targetValues,
tickvals: targetIndices,
ticktext: targetNames
}, {
label: ‘Pathways’,
values: pathwayValues,
tickvals: pathwayIndices,
ticktext: pathwayNames
},
{
label: ‘Diseases’,
values: diseaseValues,
tickvals: diseaseIndices,
ticktext: diseaseNames
}
]
}
]

Thanks for the report, but this will be very difficult for us to debug without the data you’re using.

Would you mind making your code snippet “fully” reproducible by including your data arrays?

Sure, here’s a JSFiddle i created
https://jsfiddle.net/vjywawu5/