nr_circle: Draw circles on a native raster image

View source: R/nr-draw.R

nr_circleR Documentation

Draw circles on a native raster image

Description

Draw circles on a native raster image

Usage

nr_circle(nr, x, y, r, fill = "black", color = NA, use_alpha = TRUE)

Arguments

nr

native raster image

x, y

coordinates of centre of circle. [vector]

r

radius [vector]

fill

interior fill color [vector]

color

outline color. Default: NA. [vector]

use_alpha

Use alpha channel when drawing? Logical. Default: TRUE

Value

Invisibly return the supplied native raster image which was been modified in-place

See Also

Other drawing functions: nr_polygon(), nr_polyline(), nr_rect(), nr_tri_mesh()

Examples

set.seed(1)
w <- 200
h <- 150
nr <- nr_new(w, h, 'black')

N <- 10
coords <- expand.grid(x = seq(2, w, length.out = N), 
                      y = seq(2, h, length.out = N))

cols <- sample(grDevices::terrain.colors(nrow(coords)))

nr_circle(
  nr,
  x = coords$x,
  y = coords$y,
  r = w/N/1.3,
  fill = cols
)
plot(nr)

nara documentation built on May 28, 2026, 5:07 p.m.