Statsbook

Swarm Plot

Rather than using the ggplot21, it is much easier to make swarm plots using the swarmplot package2. The plot is similar to a strip plot with jitter, but the graphical presentation is more elegant.

For this example, download and open the strip.rda dataset and open it in R. The data set contains the maximum flexion in 20 patients before and after a manipulation under anaesthesia. The data can be shown by:

strip
   Flexion  MUA
1       94  Pre
2       95  Pre
.....
.....
39     113 Post
40      86 Post

To create a swarm plot:

library(beeswarm)
beeswarm(Flexion ~ MUA, data = strip, col = 3:2, pch = 16 )

For further option, please refer to the package manual3 manual.