I want to combine two plots into one. I find way how to do it, but now they are in two row. Like this:
I want them in one row. Thanks Here is my code:
library("ggplot2")
library("grid")
library("gtable")
fig1 <- ggplot(data2, aes(x=V2, y=V1)) +
geom_boxplot(outlier.shape=NA) +
geom_jitter(color = "darkblue", position=position_jitter(width=.05, height=0))+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.title.y=element_blank())
fig2 <- ggplot(data2, aes(x=V1)) +
geom_histogram(binwidth = 0.01)+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.title.y=element_blank())
grid.draw(rbind(ggplotGrob(fig1),
ggplotGrob(fig2),
size = "first"))