You must specify some dummy value of x . theme() elements are used to remove the title and ticks of the x axis.
ggplot(mtcars,aes(x=factor(0),mpg))+geom_boxplot()+ theme(axis.title.x=element_blank(), axis.text.x=element_blank(), axis.ticks.x=element_blank())
Or using the qplot() function:
qplot(factor(0),mpg,data=mtcars,geom='boxplot')

Didzis elferts
source share