Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 格点图的同一面板中的两条或多条不同文本消息_R_Lattice - Fatal编程技术网

R 格点图的同一面板中的两条或多条不同文本消息

R 格点图的同一面板中的两条或多条不同文本消息,r,lattice,R,Lattice,给出以下带有人工数据集的晶格图示例: library(lattice) set.seed(120) X<-rnorm(100) Y<-rnorm(100) Z<-c(rep("A",50),rep("B",50)) df1<-data.frame(X,Y,Z) myx <- c(1,-1) myy <- c(0,0) MyText<-c("Panel 1 Text", "Panel 2 Text") xyplot(X~Y|Z, data=df1, p

给出以下带有人工数据集的晶格图示例:

library(lattice)
set.seed(120)
X<-rnorm(100)
Y<-rnorm(100)
Z<-c(rep("A",50),rep("B",50))
df1<-data.frame(X,Y,Z)

myx <- c(1,-1)
myy <- c(0,0)
MyText<-c("Panel 1 Text", "Panel 2 Text")

xyplot(X~Y|Z, data=df1,
panel=function(x, y,...){
panel.xyplot(x,y,...)
panel.text(myx[panel.number()],myy[panel.number()]
,labels=MyText[panel.number()])})
库(晶格)
种子集(120)

Xuse
panel.number()
选择面板
panel.number()==1
是,但这样我必须为单个面板中有两个文本的每个面板编号定义不同的向量
myx
myy
Mytext
。因此周围有很多向量,难道没有一种方法可以索引向量,就像我们可以索引
panel.number()
使用
panel.number()
来选择面板一样
panel.number()==1
是,但这样我必须为单个面板中有两个文本的每个面板编号定义不同的向量
myx
myy
Mytext
。因此,周围有很多向量,难道没有一种方法可以像索引
panel.number()