问题
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