Skip to content
Prev 309780 / 398506 Next

Violin plot of categorical/binned data

On 11/04/2012 06:27 AM, Nathan Miller wrote:
Hi Nate,
I'm not exactly sure what you are doing in the data transformation, but 
you can display this type of information as a single polygon for each 
instance (kiteChart) or separate rectangles (battleship.plot).

library(plotrix)
vessels<-matrix(c(zero=sample(1:10,5),one2ten=sample(5:20,5),
  ten2hundred=sample(15:36,5),hundred2thousand=sample(10:16,5)),
  ncol=4)
battleship.plot(vessels,xlab="Number of passengers",
  yaxlab=c("Barnacle","Maelstrom","Poopdeck","Seasick","Wallower"),
  xaxlab=c("0","1-10","10-100","100-1000"))
kiteChart(vessels,xlab="Number of passengers",ylab="Vessel",
  varlabels=c("Barnacle","Maelstrom","Poopdeck","Seasick","Wallower"),
  timelabels=c("0","1-10","10-100","100-1000"))

Jim