在xyplot中的特定值上绘制网格线 [英] Draw grid lines on specific values in xyplot
本文介绍了在xyplot中的特定值上绘制网格线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个xyplot
,我想在0值上绘制网格线.
I have a xyplot
and I want to draw grid lines on the 0 values.
这怎么办?
推荐答案
如果您使用的是包lattice
(用xyplot
隐含),则可以使用panel.abline
在标记的刻度上画线. /p>
If you're using package lattice
(which is implied with xyplot
), you can use panel.abline
to draw lines over labeled ticks.
my.df <- data.frame(a = runif(10, min = -1, max = 1), b = runif(10, min = -1, max = 1))
my.plot <- xyplot(b ~ a, data = my.df)
update(my.plot, panel = function(...) {
panel.abline(h = 0, v = 0, lty = "dotted", col = "light grey")
panel.xyplot(...)
})
这篇关于在xyplot中的特定值上绘制网格线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文