circles, a MATLAB code which can be used, when creating graphics, to draw one or more circles, while controlling the center locations, radii, colors, edge colors, and transparency, by Chad Greene.

circles(x,y,r) plots circle of radius r centered at points (x,y). Inputs x, y, and r may be any combination of scalar, vector, or 2D matrix, but dimensions of all nonscalar inputs must agree.

circles(...,'vertices',numberOfPoints) allows specification of how many points to use for the outline of each circle. Default value is 1000, but this may be increased to increase plotting resolution. Or you may specify a small number (e.g. 4 to plot a square, 5 to plot a pentagon.

circles(...,'rotation',degreesRotation) rotates the shape by a given degreesRotation, which can be a scalar or a matrix. This is useless for circles, but may be desired for polygons with a discernible number of corner points.

circles(...,'ColorProperty',ColorValue) allows declaration of 'facecolor' or 'facealpha' as (name,value) pairs. Try declaring any fill or patch property.

circles(...,'LineProperty',LineValue) allows declaration of 'edgecolor', 'linewidth', and similar properties.

h = circles(...) returns the handle h of the plotted object.


The computer code and data files made available on this web page are distributed under this license.


circles is available in a MATLAB version.

Related Data and Programs:


gridlines, a MATLAB code which gives the user more control over drawing gridlines on a graph than the builtin grid command.

matlab_graphics, MATLAB codes which demonstrate a few issues that arise when producing graphic images with MATLAB.

triangle_svg, a MATLAB code which uses Scalable Vector Graphics (SVG) to plot a triangle and any number of points, to illustrate quadrature rules and sampling techniques.

Source Code:

Last modified on 13 December 2018.