且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

向xyplot面板添加不同数据的缩写

更新时间:2023-12-04 09:48:10

这是我要确保值匹配的方式

Here's how i'd do it to make sure the values match up

lineData <- data.frame(
  v3 = c("one","two","three","four","five"),
  height = c(30,30,20,20,40)
)

xyplot(
  v1 ~ v2 | v3,
  data = MyData,
  layout = c(5, 1),
  scales = list(
    x = list(relation="free"),
    y = list(relation="same")
  ),
  panel = function(x, ...) {
      level <- dimnames(trellis.last.object())[["v3"]][packet.number()]
      panel.xyplot(x, ...);
      panel.abline(h = lineData$height[lineData$v3==level])
  }
)

这产生