热线电话:13121318867

登录
2019-01-17 阅读量: 1001
核密度估计用代码实现

library(lattice)

mtcars$transmission <- factor(mtcars$am, levels=c(0, 1),

labels=c("Automatic", "Manual"))

colors <- c("red", "blue")

lines <- c(1,2)points <- c(16,17)

key.trans <- list(title="Transmission",

space="bottom", columns=2,

text=list(levels(mtcars$transmission)),

points=list(pch=points, col=colors),lines=list(col=colors, lty=lines),

cex.title=1, cex=.9)

densityplot(~mpg, data=mtcars,

group=transmission,

main="MPG Distribution by Transmission Type",

xlab="Miles per Gallon",

pch=points, lty=lines, col=colors,

lwd=2, jitter=.005,

key=key.trans)

0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子