下面的代码生成一个bwplot,但是y轴上的值是1,2,3,4,5,而不是10,11,12,13,14。
library(lattice)
test <- data.frame(c(rep(10,100),rep(11,100),rep(12,100),rep(13,100),rep(14,100))
,c(rep(rnorm(n=500,mean=2,sd=1:3))))
names(test) <- c("a","b")
bwplot(a ~ b, test)发布于 2013-11-27 13:09:44
bwplot (格)期望因子在左侧~。在绘图前显式转换
test$a = as.factor(test$a)或(外露或)使用
bwplot(as.factor(a) ~ b, test)发布于 2013-11-27 13:10:41
它看起来很像,您需要将列a转换为字符因子。
test$a=as.factor(as.character(test$a))
bwplot(a~b, data=test)https://stackoverflow.com/questions/20242845
复制相似问题