[R] order panels in xyplot by increasing slope
Jim Lemon
jim at bitwrit.com.au
Fri May 24 00:09:20 CEST 2013
On 05/24/2013 06:21 AM, Belair, Ethan D wrote:
> example.plot = xyplot(ht ~ time|tree, data=data,
> type = c("r", "g", "p"),
> par.settings=simpleTheme(col="blue"),
> main="abc",
> )
> example.plot
> ...
Hi Ethan,
This may be what you want:
panel.slope<-function(panel) {
return(diff(range(panel$y,na.rm=TRUE))/
diff(range(panel$x,na.rm=TRUE)))
}
panel.order<-
order(unlist(lapply(example.plot$panel.args,panel.slope)))
Jim
More information about the R-help
mailing list