Violin Plot (geom_violin) with aggregated values

后端 未结 2 1286
自闭症患者
自闭症患者 2021-01-13 10:59

I would like to create violin plots with aggregated data. My data has a category, a value coloumn and a count coloumn:

data <- data.frame(category = rep(LE         


        
2条回答
  •  猫巷女王i
    2021-01-13 11:06

    Using stat="identity" and specifying a violinwidth aesthetic appears to work,although I had to put in a fudge factor:

    ggplot(data, aes(x = category, y = value)) + 
       geom_violin(stat="identity",aes(violinwidth=0.2*count))
    

提交回复
热议问题