[R] Issue labelling datapoints in xyplot with two Y-axis

mb3058 at columbia.edu mb3058 at columbia.edu
Fri Sep 19 21:15:02 CEST 2014


Hello R friends,

I am trying to add label to each of my datapoints in an xyplot which  
has two Y-axis. When I run my code with only 1 xyplot it labels the  
datapoints just fine. However when I have two xyplots plotted  
together,I am unable to label the data points. Any suggestion will be  
greatly appreciated.

Below is my code:

panel=function(x, y,labels) {
                panel.xyplot(x, y,);
                ltext(x=x, y=y, labels=data$z,pos=1, offset=1, cex=0.8)}

			p1<- xyplot(x1~x2|x3, data=data, type="o",
			col="blue", cex=0.2, pch=16,axes=F,xaxt="n",par.strip.text =  
list(cex = 0.4),
			scales=list(x=list(cex=0.5, rot=90), y=list(cex=0.5)),panel=panel)

			p2<- xyplot(x4~x2|x3, data=data,
			axes=F,yaxt="n", xlab="", col="magenta",
			main="", type='o', cex=0.3,grid= TRUE,
			par.strip.text = list(cex = 0.4),
			scales=list(x=list(cex=0.5, rot=90),y=list(cex=0.5))
			)

			p12<-doubleYScale(p1,p2,add.ylab2=TRUE)

		print(p12)



More information about the R-help mailing list