lattice 包的用法
来源:互联网 发布:linux shell脚本编程 编辑:程序博客网 时间:2024/05/21 07:00
1.library("lattice")#加载包。
d<-data.frame(x=seq(0,14),y=seq(1,15),z=rep(c("a","b","c"),times=5))
xyplot(y~x,data=d)#xy的散点图
xyplot(y~x|z,data=d,pch=c(1,3,4))#如果z 有明确的类别的名字,则显示类别名字,如果没有确的那么显示组别都是z。
xyplot(y~x,groups=z,data=d,pch=c(1,3,4))
注意上面两张图分组的异同之处。加上“|”的才是按照面板进行分组。
来一个稍微复杂点的图形。
p<-equal.count(mtcars$disp,number=3,overlap=0)#这个函数是把disp进行分组,分成三类,并且每类都不重叠overlap=0
myp<-function(x,y){
panel.xyplot(x,y,pch=19)
panel.rug(x,y)
panel.grid(h=-1,v=-1)
panel.lmline(x,y,col="red",lwd=1,lty=2)
}#如果红颜色的不写就不会出现xy点的形状。
xyplot(mpg~wt|p,data=mtcars,
main="miles per gallon vs weight by engine",
xlab="weight",ylab="miles per gallon",
layout=c(3,1),panel=myp)
#xyplot函数前面写了以wt 为x轴,以mpg 为y轴,以p为分组对象。
但如果后面的panel=myp的表达式中
myp表示的函数里没有panel.xyplot(x,y,pch=19会是怎么样子呢?即:
myp<-function(x,y){
panel.rug(x,y)
panel.grid(h=-1,v=-1)
panel.lmline(x,y,col="red",lwd=1,lty=2)
}
由此可见,自定义函数中的xyplot必不可少。不能因为前面写了xyplot 后面的panel=myp()中的xyplot 函数就不写。
- lattice 包的用法
- R绘图lattice包
- lattice 包高级绘图函数
- lattice 包中的直方图绘制
- R语言lattice包介绍
- lattice 的 ddr_ip使用
- LATTICE 调试的问题。
- 调试LATTICE 的DDR
- R lattice包中的panel函数参数传输的一个问题
- lattice函数包作图函详解
- 关于LATTICE的FIFO_DC核
- 如何在lattice包绘图时在strip中使用表达式,例如$x^2$之类的文字
- DBMS_Job包的用法
- DBMS_Job包的用法
- DBMS_Job包的用法
- 包的用法
- DBMS_Job包的用法
- DBMS_Job包的用法
- jQuery CSS 操作函数
- h5导航条滑动
- MFC 判断联网
- 集合中的Collection方法
- Maven项目出现Perhaps you are running on a JRE rather than a JDK?
- lattice 包的用法
- myeclise10 svn: E210004: Number is larger than maximum 解决方案
- 像素万能适配转换的工具类
- Python中的__init__()和__call()__函数
- 【cordova】cordova热更新插件的问题(cordova-hot-code-push)
- RabbitMQ
- jQuery Ajax 操作函数
- 压缩图片
- php中连接MySQL数据库