2

I need to plot a data set with the same structure as in the Iris flower data set with Plotly.js. It should look like Mike Bostock's scatterplot matrix. While getting the effect shown in the link is pretty simple, I am having a problem with the legend - I want to be able to switch on/off whole series (such as specific species in the Iris flower example) simultaneously on all subplots by clicking the corresponding legend item. Currently, I am adding traces for each subplot separately, but this results in separate items for each subplot in the legend (16 x 3 instead of just 3, one for every species), so clicking on an item works only for one subplot at a time. Does Plotly.js give any way of solving this problem?

1 Answer 1

7

You can do so with the legendgroup trace attribute.

Here's an example: http://codepen.io/etpinard/pen/MKbqPB

Sign up to request clarification or add additional context in comments.

1 Comment

This works superbly for Python. Make sure to have separate legendgroups for each distinct legend item!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.