This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Histogram in ggplot2

I'm willing to do a histogram with boxplot bar in ggplot2. I already have a well functioning code for a jitter graph, which give me colors for each variable.

ggplot(Raiz, aes(x = G, y = T, 
                 color = c('WT', 'at5g01950')[2 - (as.numeric(G) %% 2)])) +
  geom_jitter(position = position_jitter(width = 0.2), alpha = 1, size =2) +
  geom_boxplot(width = 0.5, color = "black", alpha = 0.2, 
               position = position_dodge(0.9)) + 
  theme_minimal() + 
  theme(plot.background = element_rect(fill = "white") ,
        panel.grid.minor = element_blank()) +
  labs(color = '')

enter image description here

And this is the kind of result that I want, but done in R and with the designated colors

enter image description here

r ggplot2

1 answer

This is a basic R question and has little to do with bioinformatics. Also, your plot is a grouped barplot, not a histogram. Googling using the right terms will get you to your solution.

Search: https://www.google.com/search?q=r+ggplot2+grouped+barplot

First link (at least for me): https://r-graph-gallery.com/48-grouped-barplot-with-ggplot2

Why did you delete the post?

Log in to answer this question.