Plotly.js: Add Jitter to Scatterplot-Points

Created on 1 Mar 2016  Â·  5Comments  Â·  Source: plotly/plotly.js

Usecase: Several data points can have the same coordinates – due to chance, measurement resolution or because the data is actually ordinal. Because the points conceal each other, the plot can be misleading as these values are not visualized and thus don't get the visual weight they actually should get.

Solution: Allow jittering the values. (For boxplots, there is already a jittering option, however, its jitter is only along an additional, non-measured dimension)

community feature

Most helpful comment

Also looking for this feature.

Quick fix I used where my x data column was being pulled from a dataframe is below. Adds a random number -0.5 to 0.5 to each x value. Main issue is that it then displays a changed x-coordinate, so if your data is very sensitive at that scale then it would potentially ruin the data.

import np.random

x.apply(lambda n: n+(np.random.random_sample()-0.5)

All 5 comments

Jitter issue in MPL https://github.com/matplotlib/matplotlib/issues/2750/
Jitter geom in ggplot2: http://docs.ggplot2.org/current/geom_jitter.html
Jitter flag in MATLAB: http://undocumentedmatlab.com/blog/undocumented-scatter-plot-jitter

Any companies out there interested in sponsoring a rigorous look at this for plotly.js and its interface libraries?
https://plot.ly/products/consulting-and-oem/

Would love this feature, further than that I'd love a quasi-random implementation that approximates violin plots. https://github.com/sherrillmix/vipor seems like a short and sweet implementation with plenty of flexibility.

@PPPW Looking for a sponsor

Also looking for this feature.

Quick fix I used where my x data column was being pulled from a dataframe is below. Adds a random number -0.5 to 0.5 to each x value. Main issue is that it then displays a changed x-coordinate, so if your data is very sensitive at that scale then it would potentially ruin the data.

import np.random

x.apply(lambda n: n+(np.random.random_sample()-0.5)

Deleting all the +1s.

Was this page helpful?
0 / 5 - 0 ratings