Type: | Package |
Title: | A Small Package for Drawing Various Combinations of Circles |
Version: | 0.1.0 |
Description: | Contains the adaptation of bubblebath from 'MATLAB', developed by Adam Danz and available through the 'MATLAB' Central File Exchange, and the tools to transform a dataframe of radii and points to plot-able paths. |
Maintainer: | Ryan ODea <ryanodea@hsph.harvard.edu> |
URL: | https://github.com/ryan-odea/circles |
BugReports: | https://github.com/ryan-odea/circles/issues |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Imports: | data.table |
NeedsCompilation: | no |
Packaged: | 2025-04-29 15:09:36 UTC; odear |
Author: | Ryan ODea [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-05-02 09:20:11 UTC |
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.