Draw randomly centered circles of various sizes

Set the range of radii, density, and other parameters to create a plot that draws randomly centered polygons with or without overlap.

Download
Download

You are now following this Submission

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Cite As

Adam Danz (2020). Bubblebath.m (https://www.mathworks.com/matlabcentral/fileexchange/70348), MATLAB Central File Exchange. Retrieved April 7, 2020.

General Information

MATLAB Release Compatibility

  • Compatible with R2016a and later releases

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
2.3.0

Added option to wrap edges (edgeType=3); rearrangements and improvements in efficiency will affect reproducibility of plots between versions using the same rng seed.

Download
2.2.0

S.circPoints added to control shape of polygon. Unrecognized input fields will throw warning instead of error. EdgeType=1 now fits more bubbles. Removed backtrace from max iteration warning. maxCircsPerRadius replaced with maxCircsPerRad.

Download
2.1.0

S.nSizes was misrepresented in the outputs when its input value was NaN. Updated waitbar message to include number of circles being processed.

Download
2.0.0

Converted to proper function with optional inputs; added several new options to supress internal warnings, control overlap, avoid memory problems, and more. Updated documentation and input validation.

Download
1.2.0

Updated to work with matlab releases prior to r2016b in response to Guang Lu's comment. Also added a waitbar to show progress.

Download
1.0.0

Download