如何在rbokeh中创建嵌套/分组类别的箱形图?

时间:2020-03-11 02:13:31

标签: r rbokeh

我需要创建一个嵌套的类别箱形图,其中的x轴是2个因子(类别)组的组合。 在ly_boxplot()中,x参数可以是数字向量 factor 。有没有办法接受两个或两个以上因素的综合因素?

以下图片摘自this link

如何使用R中的rbokeh库创建这样的图?

Box-plot with a grouped category on the x-axis nested category box-plot

1 个答案:

答案 0 :(得分:1)

使用interaction函数。

library(rbokeh)
figure(ylab = "Length (mm?)", xlab="Dose (mg/day) : Supplement") %>%
  ly_boxplot(len, interaction(dose,supp), data = ToothGrowth)

enter image description here