Entering edit mode
3.0 years ago
official.profile
▴
20
Hello,
I try to merge two barplots. I am ready to employ completely different approach to the one I present below. I believe there has to be some convenient solution to this problem (couldn't find one though)
This is the output of my code:
and this is what I want to obtain:
My code
g1 <- ggplot(data = kegg1@result, aes(x = Description, y = setSize)) +
geom_bar(stat = "identity", fill = '#CD1818') + labs(y = 'Count') +
theme(axis.title.y = element_blank(), axis.ticks.y = element_blank(),
panel.background = element_rect(fill = "white", colour = "white"),
plot.margin = unit(c(1,0,1,1), "mm"),) +
scale_y_reverse() + coord_flip()
g2 <- ggplot(data = kegg1@result, aes(x = Description, y = -log(pvalue, 10))) +
geom_bar(stat = "identity", fill = '#0F2C67') + labs(y = '-log10(p value)') +
scale_y_continuous(breaks = c(0,1,2)) +
theme(axis.title.y = element_blank(), axis.text.y = element_blank(),
axis.ticks.y = element_blank(), plot.margin = unit(c(1,0,1,0), "mm"),
panel.background = element_rect(fill = "white", colour = "white")) +
coord_flip()
grid.arrange(g1, g2, ncol = 2)