0

I need to create a nested category box-plot where the x-axis is a combination of 2 factor(category) groups. In ly_boxplot(), the x argument can either be a numeric vector or a factor. Is there a way that it will accept a combined factor, say, of 2 or more factors?

The picture below is taken from this link.

How can I create such a plot using rbokeh library in R?

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

Brian61354270
  • 8,690
  • 4
  • 21
  • 43
M.AbdAllah
  • 25
  • 5

1 Answers1

1

Use the interaction function.

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

enter image description here

Edward
  • 10,360
  • 2
  • 11
  • 26
  • One step forward. Thanks for pointing me to the ```interaction()``` function. However I need to know how can I format the x-axis to have labels appear as the layout posted in my original question. As for functionality. your answer did the job! – M.AbdAllah Mar 11 '20 at 15:26