Below is the code I currently have which creates the below graph. I'm instead trying to make a graph where the blue boxplots (pun) are next to each other under the title of 'pun' in the x axis, next to the yellow boxplots 'mv'.
ggboxplot(
d, x = "Condition.Name", y = c("pun", "mv"),
merge = TRUE, palette = "jco",
title = NULL,
xlab = '',
ylab = ''
)
Using mtcars
because you didn't provide data. You need to combine
not merge
with ggpubr::ggboxplot
library(ggpubr)
#> Loading required package: ggplot2
ggboxplot(
mtcars,
x = "am",
y = c("disp", "hp"),
combine = TRUE,
color = c("#0073C2FF", "#EFC000FF", "#0073C2FF", "#EFC000FF"),
title = NULL,
ylab = ''
)
Thanks for your input. This is close to what I am trying to do, but 'disp' and 'hp' as in your example are contained within the same column in my dataset.
Please share a sense of your data then with something like
str(my_data)
$ Condition.Name : Factor w/ 2 levels "Breakfast","No Breakfast": 2 2 2 2 2 2 2 2 $ pun : int 122 88 108 64 90 78 135 94 69 121 ... $ mv : int 90 61 75 47 101 68 135 64 98 99 ...
I'm confused
pun
andmv
are separate integer columns in your data set which is why I chose thehp
anddisp
You are right, my mistake. It works perfectly. Thanks for your help.