2017-10-24 11 views
1

グラフィックスをGraphicsグラフィックスで作成しました。 latticeパッケージを使用して変更することをお助けください。ラティスパッケージを使用してグラフィックを変更します

par(mai = c(1, 1, 1, 1), omi = c(0, 0, 0, 0)) 
set.seed(591) 
xx1 <- rnorm(20, mean = 3, sd = 3.6) 
xx2 <- rpois(40, lambda = 3.5) 
xx3 <- rchisq(31, df = 5, ncp = 0) 
box1 <- boxplot(xx1, xx2, xx3, names = c("Group-1", "Group-2", 
"Group-3"), cex = 0.7) 

私は試していましたが、動作しません。

library(lattice) 
set.seed(591) 
type <- sample(c("Group-1", "Group-2", "Group-3"), n, replace = TRUE) 
xx1 <- rnorm(20, mean = 3, sd = 3.6) 
xx2 <- rpois(40, lambda = 3.5) 
xx3 <- rchisq(31, df = 5, ncp = 0) 
df <- data.frame(xx1, xx2, xx3) 
bwplot(xx1,xx2,xx3,data=df) 

enter image description here 事前にありがとうございます。

答えて

2
set.seed(591) 
xx1 <- rnorm(20, mean = 3, sd = 3.6) 
xx2 <- rpois(40, lambda = 3.5) 
xx3 <- rchisq(31, df = 5, ncp = 0) 
df <- data.frame(xx = c(xx1,xx2,xx3), 
       type=c(rep(1,length(xx1)),rep(2,length(xx2)),rep(3,length(xx3)))) 
df$type <- factor(df$type, labels=c("Group-1", "Group-2", "Group-3")) 

library(lattice) 
bwplot(xx~type, data=df) 

enter image description here

関連する問題