How can I set the alpha value of lines connecting only certain points in my plotly.js scatter chart?


I have a scatter plot using plotly.js. I’m wondering if there’s a way to set the alpha value of only certain lines connecting the data points. For example, in this graph here:


…I have drawn the lines connecting Aug 10 to Aug 11 and Aug 11 to Aug 12 with an opacity of about 0.3. But this was in MS Paint so that I can illustrate it here. Is there a way to do this in plotly.js?


Not that I have found. What you could do is duplicate the trace and remove the points for the dates you don’t want and give the second (higher on the vertical stack) trace a heavier weight and set it to not fill gaps.

Hi, you could add each line segment as a single trace and change the line color of the corresponding segment.

Pretty much like this (unfortunately Python):