Open
Description
Hi!
Plotting my benchmark results, I would like to change the order of the boxplots from alphabetical order (default in autoplot function?) to another order.
So far, I was able to change the respective task's boxplots the following way (see code).
However, since recently, changing the levels of the task_id-factor variable, only changes the order of the title, but not the respective boxplots themselves.
How can I change the order of the boxplots?
Any help highly appreciated! Thanks a lot
library(mlr3)
library(mlr3viz)
tasks = tsks(c("pima", "sonar"))
learner = lrns(c("classif.featureless", "classif.rpart"),
predict_type = "prob")
resampling = rsmps("cv")
bmr = benchmark(benchmark_grid(tasks, learner, resampling))
# AUC
bmr_boxplots_auc <- autoplot(bmr, measure = msr("classif.auc")) +
ggplot2::theme(axis.text.x = ggplot2::element_text(hjust = .5)) +
ggplot2::scale_x_discrete(labels =c("FL", "RF", "LR"))+
ggplot2::ylab("AUC")+
ggplot2::xlab("Learner")+
ggplot2::theme_bw()+
ggplot2::theme(panel.grid = element_blank(),
strip.background = element_blank()
)
bmr_boxplots_auc
bmr_boxplots_auc$data$task_id <- as.factor(bmr_boxplots_auc$data$task_id)
levels(bmr_boxplots_auc$data$task_id) = c("sonar", "pima")
bmr_boxplots_auc