Histogram in ggplot2
1
0
Entering edit mode
12 months ago

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 • 628 views
ADD COMMENT
1
Entering edit mode
12 months ago
Ram 44k

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

ADD COMMENT
0
Entering edit mode

Thank you very much!

ADD REPLY
0
Entering edit mode

Why did you delete the post?

ADD REPLY

Login before adding your answer.

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