4.6 | 7 ratings Rate this file 63 Downloads (last 30 days) File Size: 2.04 KB File ID: #27703 Version: 1.0
image thumbnail

Draw a filled circle


Sadik (view profile)


Plots a filled circle with given radius, center and color.

| Watch this File

File Information

FILLEDCIRCLE Filled circle drawing

filledCircle(CENTER,R,N,COLOR) draws a circle filled with COLOR that has CENTER as its center and R as its radius, by using N points on the periphery.

Usage Examples,


If you would like to generate the screenshot image above, you could do this:

hold on
axis off



Draw A Circle. inspired this file.

This file inspired Circle Plotter and Circlem.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
05 Apr 2015 Muhammad Huzaifa  
06 Dec 2013 Mohammad

Thanks a lot for sharing your cleverness ...

14 Nov 2013 Alex R.

Alex R. (view profile)

I know this is old but I wanted to note that it can be done easier and faster as follows:

t = 2*pi/N*(1:N);
fill(c(1)+r*cos(t), c(2)+r*sin(t), color);

Also note that you don't need both 0 and 2pi (they are the same polar point). Your code actually generates N+1 points.

[ depending on N, the above can be substantially faster than using linspace() + ones() + pol2cart() ]


03 Apr 2013 David-Leon

This addon has a bug (I guess). It changes the aspect ratio of my plot.

06 Dec 2012 Sadik

Sadik (view profile)

Hi Irvin,

I am not sure I understand your question thoroughly but here is what you can do for transparency:

% Filled object becomes more and more transparent as the following variable [transp] goes to zero. [Max value is 1]
transp = 0.5;


Comment only
05 Dec 2012 irvin rynning

In the code using a white fill
results in the same circle with white center.
how to make it transparent ?

11 Mar 2012 Aziz

Aziz (view profile)

29 Jan 2011 Sadik

Sadik (view profile)

Hi Catalin,

You may want to check if you are playing with the axes, especially whether or not the code is making a zooming effect.

If you can't figure that out, using the clf command of matlab, or closing and reopening the figure window at each iteration should solve the problem.


Comment only
24 Jan 2011 AwedBy Matlab

Hi Sadik, I am having some problems using filledCircle - the first time I use the function to draw a couple of circles, they are displayed at a certain size, but then the second time (e.g. second iteration of a for loop) they are displayed slightly bigger, even though the function was called with the same RADIUS parameter. Do you know why that might be? Thanks very much!

Comment only
15 Jan 2011 AwedBy Matlab

Very useful, thank you!

25 Sep 2010 Tima Tima

Thank you for more simple and more useable code

Comment only

Contact us