Skip to content
Prev 60507 / 398498 Next

Lattice graph with segments

On Saturday 04 December 2004 14:40, Tim Churches wrote:
Right. Also, to make the resulting object self-contained (i.e. not 
dependent on having a particular data frame in the scope), I would do 
something similar to (either one of):


with(prepayment,
     xyplot(coupon.period ~ median, 
            lcl = lcl, ucl = ucl, 
            panel=function(x, y, subscripts, lcl, ucl, ...) {
                panel.xyplot(x, y, ...)
                panel.segments(lcl[subscripts], as.numeric(y),
                               ucl[subscripts], as.numeric(y), ...)
            }))



xyplot(coupon.period ~ median, data = prepayment,
       lcl = prepayment$lcl, ucl = prepayment$ucl, 
       panel=function(x, y, subscripts, lcl, ucl, ...) {
           panel.xyplot(x, y, ...)
           panel.segments(lcl[subscripts], as.numeric(y),
                          ucl[subscripts], as.numeric(y), ...)
       })


Deepayan