Plotly.js: Setting multiple marker colors on box plot

Created on 30 Jan 2018  Â·  6Comments  Â·  Source: plotly/plotly.js

According to Plotly’s Javascript documentation, it should be possible to set multiple colors for markers in box plot:

Sets the marker.line color. It accepts either a specific color or an array of numbers that are mapped to the colorscale relative to the max and min values of the array or relative to cmin and cmax if set.

It doesn’t appear to work. Setting marker.color to Array results in default color being used, as this codepen demonstrates: https://codepen.io/palimondo/pen/qxEaKo

documentation feature

Most helpful comment

Any activity on this front? It seems the "selectedpoints" attribute only allows for one subgroup.

All 6 comments

Oh that description is wrong. Thanks for pointing this out.

We don't allow per-point marker settings on box traces at the moment.

@etpinard Is there a way to work around this limitation? I have tried mixing box and scatter traces in a plot and it sort of works, but they are interacting strangely. I can get the scatter to draw over the box plot if my secondary coordinate is not set or set to a constant. But as soon as I use array of values the scatter doesn’t appear to be respecting the secondary coordinate and the values get randomly distributed between the two box plots, but they also partially overlap them. I’m going for box points simulation withpointpos and jitter, so I need to control it somehow. Also the 0th scatter trace never merges with 0th box plot for some reason…
(I’m sorry, as this is probably not the right place to discuss this.)

Is there a way to work around this limitation?

You should be able to get the desired result using a scatter trace. You'll have to generate your own jitter, as we don't allow jitter settings in scatter traces at the moment (see https://github.com/plotly/plotly.js/issues/299). By looking through https://community.plot.ly/, you might examples that might help you out.

@etpinard I had trouble mixing scatter and box plots together. I’ve posted the codepens with problem and eventual solution to the community forum.

A simpler version, where you can highlight several points by the attribute: 'selectedpoints' of box.

https://community.plot.ly/t/color-a-group-of-individual-points-in-boxplot/10432

Any activity on this front? It seems the "selectedpoints" attribute only allows for one subgroup.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WG- picture WG-  Â·  3Comments

maxwell8888 picture maxwell8888  Â·  3Comments

jonmmease picture jonmmease  Â·  3Comments

boleslawmaliszewski picture boleslawmaliszewski  Â·  3Comments

deecay picture deecay  Â·  3Comments