我在 R 中使用来自Hmisc
( panel.bpplot
) 和bwplot
from的 box-percentile 面板函数绘制了 box-percentile 图lattice
。
我有一个数字向量 ( Length
),并想显示它在因子变量 ( Month
) 的各个级别上的分布。
这是一个假数据的例子:
例如,
set.seed(13)
Length<-sample(1:10, 1000, replace=TRUE)
Month<-sample(c("Apr","May","Jul","Aug","Sep","Nov"), 1000, replace=TRUE)
df<-cbind(Month, Length)
df<-as.data.frame(df)
df$Month<-factor(df$Month, levels=c("Apr","May","Jul","Aug","Sep","Nov"))
df$Length<-as.numeric(df$Length)
#plot horizontal box-percentile plot;
bwplot(Month~Length, data=df, panel=panel.bpplot)
这工作正常。但我希望图是垂直的,Month
在 x 轴和Length
y 轴上。的文档panel.bpplot
说水平图使类别级别更加明显,但是,出于我的目的,我特别需要一个垂直图。有没有办法修改panel.bpplot
来做到这一点?