Creating a circle grob with {grid}

gp <- gpar(
  fill = 'red', 
  col  = 'green', 
  lwd  = 12
)

cg <- circleGrob(
  x  = unit(0.4, 'npc'),  
  y  = unit(0.3, 'npc'), 
  r  = unit(5, 'mm'), 
  gp = gp
)

cg
#> circle[GRID.circle.1]
grid.newpage()
grid.draw(cg)

Creating a circle grob with {ingrid}

grob creation in ingrid offers:

  • unit shortcuts e.g. .npc() is equivalent to unit(x, 'npc')
  • graphical parameters may be specified inline with the arguments for the grob itself, rather than being a separate gpar() call
cg <- ingrid::ig_circle(
  x    = .npc(0.4), 
  y    = .npc(0.3), 
  r    = .mm(5), 
  fill = 'red', 
  col  = 'blue', 
  lwd  = 12
)

ingrid::register_verbose_printing()
cg
#> circle [GRID.circle.2]
#>   x=c(0.4npc), y=c(0.3npc), r=c(5mm)
#>   gp: 
#>     col: blue
#>     fill: red
#>     lwd: 12
#>   vp: [GRID.VP.1] default
grid.newpage()
grid.draw(cg)