increasing pattern density with grid.pattern

2019-08-31 07:43发布

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.

标签: r graphics
1条回答
太酷不给撩
2楼-- · 2019-08-31 07:49

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)
查看更多
登录 后发表回答