This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How Can I move the scattered dots more closer into the center of box ?

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

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.

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

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

1 answer

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

Log in to answer this question.