Package 'circles'

Title: A Small Package for Drawing Various Combinations of Circles
Description: This package currently contains the adaptation of bubblebath from 'MATLAB' and the tools to transform a dataframe of radii and points to plot-able paths.
Authors: Ryan ODea [aut, cre]
Maintainer: Ryan ODea <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-06-10 06:33:03 UTC
Source: https://github.com/ryan-odea/circles

Help Index


Generate Bubble Bath (Chart) Dataframe

Description

Creates a dataset of circles ("bubbles") with random centers and specified radii. When overlap is FALSE, circles are placed so they do not overlap.

Usage

bubblebath(
  frameSize = c(50, 50),
  circSize = seq(0.2, 5, length.out = 25),
  maxCircsPerRad = 10000,
  max_iter = 10000,
  density = 0.7,
  overlap = FALSE,
  suppressWarning = FALSE
)

Arguments

frameSize

A numeric vector of length 2 defining the frame's width and height (centered at 0).

circSize

A numeric vector specifying the radii of circles to place. If length is 2, it's interpreted as min and max for a sequence. If length > 2, the exact values are used as radii.

maxCircsPerRad

Maximum number of circles per radius.

max_iter

Maximum attempts to place each circle.

density

Density of circles, between 0 and 1.

overlap

Logical; if FALSE, circles won't overlap.

suppressWarning

Logical; if TRUE internal warnings are suppressed.

Value

A data frame with columns x, y, and r (circle centers and radii).

Examples

# Create bubble bath points
circles <- bubblebath(circSize = c(0.5, 1, 2, 3), overlap = FALSE)

Generate Points for Drawing Circles

Description

Creates points along the perimeter of a circle for plotting as a path.

Usage

draw_circles(data, x_col = "x", y_col = "y", r_col = "r", n_points = 500)

Arguments

data

A data frame containing circle data (centers and radii).

x_col

Name of the column containing x-coordinates of circle centers.

y_col

Name of the column containing y-coordinates of circle centers.

r_col

Name of the column containing circle radii.

n_points

Number of points to generate around each circle perimeter.

Value

A dataframe with x, y coordinates for plotting and group identifier per circle plotted.