Beeswarm plot (aka. strip chart / dot plot)
It would be great to have a simple dot plot in HighCharts. Categorical data with a single value, displayed with sideways jitter to prevent dots overlapping. The advantage of this plot is that it is great at showing distributions. It's also simple to interpret and good with large numbers of data points.
There are several R packages that do this (beeswarm being the main one). See http://www.cbs.dtu.dk/~eklund/beeswarm/
Bonus points for dealing with overlapping plots intelligently (see beewarm package 'corral' options). Perhaps automatic point sizing?
-
Phil Ewels commented
ps. If you're curious, you can see the full 308 lines of code that generates the plot in that linked report here: https://github.com/ewels/MultiQC/blob/master/multiqc/templates/default/assets/js/multiqc_plotting.js#L767-L1075
-
Phil Ewels commented
Hi both,
Apologies - I didn't seem to get any e-mails about your replies. Exactly as Jamie says - the plot is to show distribution of a dataset. The advantage over histograms / boxplots etc is that individual data points can be seen.
Jon - I (separately) had a go at doing exactly what you suggest. It sort of works, but it's difficult to do well when there are large numbers of samples. You can see my development jsfiddle with example data here: http://jsfiddle.net/5kc0wtfg/8/
My code breaks down a little when there are hundreds of points though, you can see this in a report generated by my tool MultiQC (where I want this code for) here: http://imlspenticton.uzh.ch/robinson_lab/conquer/report-multiqc/GSE63818-GPL16791_multiqc_report.html
Clearly my approach to avoid overlapping isn't working very well. I can work on it further, but it's getting very complex now. This is my reason for wanting the plot type as a core plot - I suspect that you guys can do a better job than me, and I think it would be a very useful plot type to have as part of HighCharts (for scientists especially).
Example of a d3.js plot doing similar stuff with fancy animated collisions to do the clustering: http://bl.ocks.org/njvack/1316832
Phil
-
Jamie commented
Jon - the value of a beeswarm plot is being able automatically arrange the points in a large data set, to see the distribution of the data. Any data set that you might want to view a distribution of (histogram, boxplot, violin plot, etc) would be fair game for viewing as a beeswarm plot.
Arranging the x values by hand in that manner is not an viable option in such a case.
Here is an example dataset pulled from the same package as the link in the request above:
http://jsfiddle.net/jlbriggs/e7k3ar4o/This fiddle is a demo of a technique that generates a histogram for a given data set, that has also been set to return the individual points, stacked within the bins that they fall into (the idea being to show the histogram, but also show how the data actually fits within each bin, which can sometimes give additional insight about the distribution of the data).
I built this demo a while ago, and it hints at the idea of a beeswarm, but a beeswarm would require much more complexity and flexibility in the layout of the points, with at least some of the configuration options that are listed in the R library linked to in the request, and consideration given to marker radius property, or auto-scaling of marker radius.
-
Hi Phil,
Highcharts has support for Scatter charts which can be used to create Dot Plot visualizations.
A simple example of how it can be achieved here: http://jsfiddle.net/jon_a_nygaard/bk0j4dws/3/I had a look at the Beeswarm library too get more insight on your request, and it got me wondering how would your typical input data look like? Could you perhaps share a simple example of a dataset to work with?