【发布时间】:2016-09-18 01:32:12
【问题描述】:
使用数据集 mpg,我能够绘制城市 mpg、高速公路 mpg 和类模型之间的三向关系。我使用以下代码(使用 ggplot2)输出附件Boxplot.png 中显示的图形。
ggplot(mpg,aes(cty,hwy))+
aes(color=class)+
geom_boxplot()+
facet_grid(.~class, scales='free')+
theme(axis.text.x = element_text(angle = -90, vjust = 1, hjust = 0))+
scale_x_continuous('City mpg')+
scale_y_continuous('Highway mpg')+
theme(legend.position="none")
问题:
我想按中位数递增的顺序显示箱线图。我该怎么做?
我可以在每个箱线图的顶部显示中值吗?
【问题讨论】:
标签: r ggplot2 boxplot median facet