Skip to content

Instantly share code, notes, and snippets.

@epijim
Last active December 27, 2015 06:29
Show Gist options
  • Save epijim/7281405 to your computer and use it in GitHub Desktop.
Save epijim/7281405 to your computer and use it in GitHub Desktop.
Bean plot in R
library("beanplot")
#To make it do the split (male/female in my plot), I set a variable up as "MainGrouping" then
# a space followed by BinaryGrouping encoded as a numeric value (i.e. 1 or 2).
beanplot(ContinuousVariable ~ MainGrouping_BinaryGrouping, data = DATA, what=c(1,1,1,0), log="",
ylab = "Continous variable label", side = "both",
border = NA, beanlinewd = 0.5, overallline = "median",
col = list( "brown2", "cadetblue3"))
legend("topright", fill = c("brown2", "cadetblue3"), c("Binary 1", "Binary 2"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment