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

Parallel plot colors

I’m still having an issue understanding how the color scale works for the parallel coordinates plot. In my case, the color values are either 0 or 1 which i want to display as red or green. This works fine in some situations, but if I have all 0’s or all 1’s then the color seems to be displayed as a brown

Here’s a fiddle that shows this behavior:
https://jsfiddle.net/vjywawu5/2/

Are there any other ways to color the lines on my plot (to have just discrete colors). Or if I have to use color scale, how can i get around this issue?

You need to specify the color domain with cmin and cmax as in https://jsfiddle.net/vjywawu5/3/

By default, even though all your color values are 0, we add a bit of padding when computing cmin/cmax. In your case, cmin: -0.5 and cmax: 0.5, see https://jsfiddle.net/r0cLsxat/2/