Any suggestions on how to solve problem? Unlike other similar questions here on the channel that presented the solution for a variable as a factor, my case is different. I would like to see the labels of the outliers for multiple variables.
I have the following chart as below. for example:
It was created with this command:
z_mtcars <-data.frame(scale(mtcars[-12]))
z_mtcars$type<-rownames(mtcars)
z_mtcars %>% melt(id.vars = "type") %>%
ggplot() +
aes( x = variable, y = value, fill = as.numeric(variable)) +
geom_boxplot() +
scale_fill_distiller(palette = "Blues") +
scale_alpha(range = c(1,1)) +
ggtitle("Boxplot: Standardized Score (Z-Scale) ") +
xlab("Variables") +
ylab("Value") +
labs(fill = "Order of \nVariables") +
theme_classic() +
theme(axis.text.x = element_text(angle = 90,hjust = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "red") +
geom_hline(yintercept = 1, linetype = "dotted", color = "blue") +
theme(legend.position = "left")