Draw Circles in MATLAB Plots

CIRCLES is a MATLAB library 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 library which gives the user more control over drawing gridlines on a graph than the builtin grid command.

MATLAB_GRAPHICS, MATLAB programs which demonstrate a few issues that arise when producing graphic images with MATLAB.

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

Source Code:

Examples and Tests:

You can go up one level to the MATLAB source codes.

Last modified on 31 March 2016.