Learn R Programming

ggpattern (version 0.1.3)

create_circles_grob: Create a cicleGrob object for a set of points

Description

Use 'sf' to help with the point in polygon intersections.

Usage

create_circles_grob(
  boundary_df,
  params,
  angle = 0,
  spacing = 0.1,
  density = 0.3,
  xoffset = 0,
  yoffset = 0,
  aspect_ratio
)

Arguments

boundary_df

polygon_df data.frame

params

params from the geom

angle

angle of orientation (degrees)

spacing

spacing in grid 'npc' coordinates. Usually in range [0, 1]

density

fill fraction. Number in range [0, 1]

xoffset, yoffset

offset the pattern creation origin.

aspect_ratio

aspect_ratio

Value

A grid::circleGrob

Details

  • make grid to cover entire space

  • rotate points into position

  • create expanded boundary by r

  • create contracted boundary by r

  • remove all points outside the expanded boundary

  • remove all points within contracted boundary -> internal circles

  • any remaining points become part of the intersection grob

  • total circles = treeGrob( internal_circls, intersection_circles)