Several Opacity level for one dataset

By looking to the documentation, I found that there is an opacity property for the data but it seems that it only works for the whole dataset.
In the following page : https://plot.ly/javascript/ , the fully interactive part shows one dataset with multiple color or/and opacity level. How can I reproduce it ?

I have tried to set an array for the opacity property (one value by data points) but it does not work.

Here is my jsfiddle:
https://jsfiddle.net/oro77/7a3x963r/2/

1 Like

You can try setting marker.color.opacity which can either be a number ranging for 0 to 1 or an array of such numbers corresponding to each x / y data points.

Note that, per-marker-pt opacity won’t affect the line segment. Opacity of line segments can only be set trace-wide via opacity as in your fiddle. I hope this helps.

I was not able to make it work using marker.color.opacity . By using marker.opacity, I could set an array for each points. I have noticed that if I set the opacity for the line segment at the same time, the markers opacity won’t be considered (or overwritten by the line segment one).

Could you check my jsfiddle and tell me if I did something wrong ?

https://jsfiddle.net/oro77/7a3x963r/4/

Oops. marker.opacity is what I mean. My mistake.

That shouldn’t happen. Too bad your fiddle link leads me to a 404.

Sorry, I post the new jsfiddle link :
https://jsfiddle.net/oro77/f0bvc1o2/1/

I have set the opacity to 0.5 for the line and an array with different values of opacity for the markers. By checking the plot, it seems that everything(marker and line) got an opacity level of 0.5.

1 Like

That’s correct, the trace opacity (set to 0.5) sets the opacity of the whole trace (lines and markers). marker.opacity is an additional level of opacity that can be set par-marker-point.

When both trace opacity and marker.opacity, the resulting opacity for the marker points is the combined value.

Ok I see, thank you for your reply.