This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to change colors in boxplot in R?

How to change colors in boxplot in R?

I want to change the colors of the cage parameters for example make cage1 in color, cage2 in different color etc.

plot_richness(physeq.alpha,x ='cage' ,col = 'cage', measures=c("Chao1","Shannon",'simpson','invsimpson','ACE')) + geom_boxplot(fill = c('red','blue','orange','purple','yellow'),color = 'darkgreen') +
  scale_fill_manual(values=palette)

enter image description here

ggplot2 box-plot

1 answer

The cage parameter was plotted with geom_point. I think you need to change the colors inside geom_point.

Something like

geom_point(aes(x=cage,y=alpha_diversity, color=cage) +
scale_color_manual(values=c("color1,color2,colour3))

If you post a reproducible example, I can post more info. If this does not help I can try create one and post it later

Log in to answer this question.