ggplot split jitter within grouped boxes by different variables
1
0
Entering edit mode
3.1 years ago
mbartl13 • 0

Hi all-

I am trying to make a boxplot with the jitter split into 3 categories within the 2 categories for box plots. My current code makes it three boxes and three shapes- I want three shapes (Status1) and two boxes (Status2).

AI_ELISA_sev <- ggboxplot(ELISAtot, x = "AntiIso", y = "Titer",color="black", fill="Status2", palette="jco", add = "jitter", shape = "Status1")+ theme(legend.position="right")

AI_ELISA_sevp <-AI_ELISA_sev + stat_compare_means(aes(group=Status2), hide.ns=TRUE, label="p.signif", size=10, method="t.test", label.y = 5.3) + ggtitle("Isotype Status Differences") + yscale("log10", .format=TRUE)+ labs(x ="", y = "Antibody titer \n(Reciprocal Dilution)")+ stat_compare_means(method = "t.test", label.y = 0, color="transparent")+stat_compare_means(method = "t.test", label.y = 5.5, color="transparent")+ theme(axis.text.x = element_text(angle = 90))

enter image description here

enter image description here Thanks!

jitter Rstudio R ggplot • 1.2k views
ADD COMMENT
0
Entering edit mode
3.1 years ago
Jianyu ▴ 580

I didn't rebuild your dataset, could you try the code below? I think it should work

ggplot(ELISAtot) + geom_boxplot(aes(x = "AntiIso", y = "Titer", fill="Status2")) + geom_jitter(aes(x = "AntiIso", y = "Titer", shape = "Status1"))
ADD COMMENT

Login before adding your answer.

Traffic: 2508 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6