使用 lattice 包更改图形

Change the graphic using the lattice package

我有一个使用图形包构建的图形。请帮助使用包 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)

提前谢谢你。

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)