How Can I move the scattered dots more closer into the center of box ?
1
0
Entering edit mode
12 months ago
ohtang7 ▴ 40

I made box plots with dots but the dots are too scattred around. Is there anyway to move them more into middle of box ?

enter image description here

My code is as this :

p<-ggplot(data, aes(x=Genus, y=Relative_abundance, fill=Group)) + 
geom_boxplot(position = position_dodge(width = 0.8), alpha = 0.8) +
  labs(title = "Relative Abundance Comparison",
       x = "Genus",
       y = "Relative Abundance",
       fill = "Group") +

  theme_minimal() +

  scale_fill_manual(values = c(Stray = "blue", Pet = "red"))

p + geom_jitter(shape=16, height=0.0001)

Please help me !

R Boxplots geom_jitter • 795 views
ADD COMMENT
1
Entering edit mode

Please understand that biostars is not a helpdesk for trivial ggplot questions. Google it and find help on previous StackExchange sites, or ask ChatGPT, it's great for these things. It's not bioinformatics what you ask.

ADD REPLY
0
Entering edit mode

You're right. I would get help from StackExchange sites and GPT

ADD REPLY
0
Entering edit mode

I would just draw them in by hand where you want them.

ADD REPLY
1
Entering edit mode
12 months ago
Trivas ★ 1.8k

You added a position dodge on your boxplot but not on your points.

ADD COMMENT

Login before adding your answer.

Traffic: 2389 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