如何仅反转动物园对象的 xyplot 中的一个 y 轴
我在创建动物园对象的 xyplot 时遇到一些麻烦。
我创建了一个简化的示例:
z <- zoo(cbind(a=1:4,b=11:14,c=10:13,d=5:8,e=10:7,f=1:4), 1991:1994)
我使用以下代码创建多面板 xyplot:
numLbl <- 4
xx <- seq(from = min(time(z)), to = max(time(z)), length.out = numLbl)
xyplot(z[,c(1,2,4,6)],scales = list(x = list(at = time (z), rot = 90)), layout = c(1,4), aspect = "fill", xlab = "",
panel = function (x,y, ...) {
panel.abline (v = xx, col = "grey", lty = 3)
panel.xyplot(x, y, type = "b", col = 1)
})
我想要做的是仅在其中一个面板上反转 y 轴。我找到了一个相关的示例:
但是我不能让预面板与我的示例一起使用。我对格子很陌生,面板功能可能有一些我不明白的地方。
此外,如果有一种简单的方法可以将其中一个面板作为直方图,将其他面板作为线条,我将非常感谢您的提示。
非常感谢任何帮助!
I am having some trouble in creating a xyplot of a zoo object.
I have created a simplified example:
z <- zoo(cbind(a=1:4,b=11:14,c=10:13,d=5:8,e=10:7,f=1:4), 1991:1994)
I am using the following code to create a multipanel xyplot:
numLbl <- 4
xx <- seq(from = min(time(z)), to = max(time(z)), length.out = numLbl)
xyplot(z[,c(1,2,4,6)],scales = list(x = list(at = time (z), rot = 90)), layout = c(1,4), aspect = "fill", xlab = "",
panel = function (x,y, ...) {
panel.abline (v = xx, col = "grey", lty = 3)
panel.xyplot(x, y, type = "b", col = 1)
})
What I would like to do is the reverse the y-axis on only one of this panels. I have found a related example:
However I cannot get the prepanel to work with my example. I am quite new to lattice, and there is probably something with the panel function I do not understand.
In addition if there is an easy way to get one of the panels as histograms and the others as lines I would be very grateful for tips.
Any help is very much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是执行第一项工作的预面板的示例:
Here's an example of a prepanel which does the first job: