[R] xYplot legend keys labels

Yasir Kaheil kaheil at gmail.com
Fri May 2 20:47:25 CEST 2008


I came across this little problem in the xYplot function recently and I found
it very poorly documented. The legend (keys) in the xYplot is very
confusing, especially if you want to change the data labels you have in the
data frame column names... say for example you want something with a
subscript. 
Here is a quick solution to it, by keeping (keys='lines')
you need to change the parameter "labels" which belongs to an underlying
function of xYplot.

Here is an example

xYplot( Cbind(average,upperErr,lowerErr)~rate,panel=function(x,y,...)

{panel.grid(lty=3,col="black",lwd=0.1);panel.xYplot(x,y,...)},group=type,data=dfr,
type="b" ,pch=c(0,1), 
	lty=c("dashed","solid"),xlab="Resquest Rate (Request/sec)", ylab="Response
Time (millisec)",main="Network Profile A, Class 1, Creation Time",
	labels=c("h",expression(T[i]),"dd","yy"),keys='lines');

There are many other ways to add another legend(s) but I found this to be
the easiest as you always need to overwrite the dataframe column names
anyway.



-- 
View this message in context: http://www.nabble.com/xYplot-legend-keys-labels-tp17025622p17025622.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list