删除点图中的网格线,而无需修改基础网格参数 [英] Remove grid lines in dotplot without modifying underlying trellis parameters

查看:62
本文介绍了删除点图中的网格线,而无需修改基础网格参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从莱迪思点图中删除浅灰色的网格线.搜索R帮助页面,Sarkar的书和网络之后,我找到的一个答案是

I want to remove the light gray grid lines from a Lattice dotplot. After searching R help pages, Sarkar's book, and the web, the one answer I've found is this post, which explains that you can set the grid line width to zero for all dotplots using this magic:

## turn off grid lines
d1 <- trellis.par.get("dot.line")
d1$lwd <- 0  ## hack -- set line width to 0
trellis.par.set("dot.line",d1)

Example: Try dotplot(VADeaths[,"Rural Female"]) before and after doing the preceding.

This solution works, but I would have thought that there would be a way to control the grid lines from inside the dotplot function, perhaps using a panel function. Is there a way to do that? (An authoritative "No" could count as a correct answer.)

解决方案

Setting col.line = "transparent" inside panel.dotplot should solve this issue. See also ?panel.dotplot.

dotplot(VADeaths[, "Rural Female"], panel = function(...) {
  panel.dotplot(..., col.line = "transparent")
})

这篇关于删除点图中的网格线,而无需修改基础网格参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆