increasing pattern density with grid.pattern

三世轮回 提交于 2019-12-25 09:23:57

问题


The grid.pattern function supplied by gridExtra will fill a polygon with diagonal lines. I want to increase the density of lines, i.e., the number of diagonal lines that appears in any given space. Is there an argument that I can pass to grid.pattern that controls the density of lines?

Here's a minimal example:

library(gridExtra)
grid.pattern(pattern = 1)

That code draws a rectangle covered by diagonal lines. How can I change the code so that the rectangle includes (say) twice as many lines? I've read the function documentation and tried changing some arguments to grid.pattern, but nothing has worked.


回答1:


You can use the granularity argument to set the distance between the diagonal lines:

library(gridExtra)
grid.pattern(pattern = 1, granularity = unit(2.5, "mm")) ## (Default is 5 mm)


来源:https://stackoverflow.com/questions/10987974/increasing-pattern-density-with-grid-pattern

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!