I am struggling to display two barcharts side by side with the same scale
My code looks like this
library(ggplot2)
library(gridExtra)
#dataframe definition
rm(list=ls(all=TRUE))
mydata <- data.frame(a=1:10,b=c('yes','no'),c=seq(2,20,2))
plot1<- ggplot(mydata, aes(x=factor(mydata$b), y=100*a), order=f, fill=grey) +
stat_summary(fun.y="mean", geo m="bar", colour="black")+xlab("Factor b") +
ylab("Value of a")
plot2<- ggplot(mydata, aes(x=factor(mydata$b), y=c), order=f) +
stat_summary(fun.y="mean", geom="bar", colour="black")+xlab("Factor b") +
ylab("Value of b")
grid.arrange(plot1, plot2, ncol=2)
That produces the following image.

I want to position them in a way the vertical axis has the same scale for both of the barcharts.
I couldn’t find any documentation on the gridExtra manual.
What about something like this?