时间: 2018-07-31
教程: 慕课网 《R语言之数据可视化》 讲师:Angelayuan
学习内容: 课程第三章5-6节
数据可视化
2. Lattice绘图系统
Lattice绘图系统包含在lattic包中。
该系统包含许多函数:xyplot / bwplot / histogram / stripplot / dotplot / splom / leveplot / contourplot等
xyplot函数格式:xyplot(y ~ x | f*g, data),其中 f*g为因子类型,该参数可省略。
Base绘图系统直接在图形设备上绘图,而Lattice绘图系统返回trellis类对象,然后由打印函数在设备上进行绘图,但在执行Lattice命令时,打印自动进行。
install.packages(“lattice”):下载lattice包
library(lattice):加载lattice包
使用lattice包之前应先加载。
如:
使用xyplot函数绘制温度~氧气含量的散点图:
library(lattice)