I am trying to use fill
function in ggboxplot
of ggpubr
package. But it throws an error:
code used.
library(ggpubr)
data("ToothGrowth")
df <- ToothGrowth
ggboxplot(df, x = "dose", y = "len", fill= c("red", "navy", "green"))
Throws an error:
Error in `purrr::pmap()`:
ℹ In index: 1.
ℹ With name: len.
Caused by error in `if (fill %in% names(data) & is.null(add.params$fill)) ...`:
! the condition has length > 1
Traceback:
1. ggboxplot(df, x = "dose", y = "len", fill = c("red", "navy",
. "green"))
2. do.call(.plotter, .opts)
3. (function (fun, data, x, y, combine = FALSE, merge = FALSE, color = "black",
. fill = "white", title = NULL, xlab = NULL, ylab = NULL, legend = NULL,
. legend.title = NULL, facet.by = NULL, select = NULL, remove = NULL,
. order = NULL, add = "none", add.params = list(), label = NULL,
. font.label = list(size = 11, color = "black"), label.select = NULL,
. repel = FALSE, label.rectangle = FALSE, font.family = "",
. parse = FALSE, ggtheme = theme_pubr(), fun_name = "", group = 1,
. show.legend.text = NA, ...)
If I remove fill
option from the command it run smoothly.