You have to provide some dummy value to x
. theme()
elements are used to remove x axis title and ticks.
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 qplot()
function:
qplot(factor(0),mpg,data=mtcars,geom='boxplot')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…