File Exchange

image thumbnail


version 1.0 (2.26 KB) by

Adds ellipses to the current plot

48 Ratings



View License

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

Adds ellipses to the current plot

Comments and Ratings (57)

Hi David Long, is there any possibility to get a point on the ellipse that we get from your program

light liu

very useful,thanks


Jenny (view profile)

Hi David, Thank you - I assumed as much but thought I ought to check! Thanks.

David Long

David Long (view profile)

There is a typo in the comments section. ra is the semimajor axis, rb is the semimionr axis (ra>=rb), and ang is the angle of the semimajor axis.


Jenny (view profile)

Could anyone clarify for me the difference between ra and rb please? The function states that "% ELLIPSE(ra,rb,ang,x0,y0) adds an ellipse with semimajor axis of ra,
% a semimajor axis of radius rb, a semimajor axis of ang, centered at
% the point x0,y0."
I assume that one or the other should be semiminor axis?

Pragya Sharma

David Long

David Long (view profile)

Using the pointer output ellipse as suggested in the previous comment, you can change the C argument to the standard patch command to use a vector (RGB) color. patch has some other interesting options you can use, too.


If instead of filling the ellipse with a specific color, would it be possible to fill it according to a vector?
How could that be done?

ramin bba

thanks. With a minor change it worked. the outputs (x, y) are cells so using patch gave me an error. I put your code in a for loop to get around the problem:

for i=1:length(x)
hold on;
hold off;

David Long

David Long (view profile)

To efficiently produce a "filled" ellipse using this code, use the returned handle:
hold on;
hold off;

ramin bba

awesome code, helped me out a lot.

Do you have an efficient way in mind for "filling in" the ellipses? using patch maybe?


Chris (view profile)


Frank (view profile)

quite useful

David Long

David Long (view profile)

R2014B graphics ready


Abhik (view profile)

Jay Patel



Kuider (view profile)

excellent! helped me a lot thank you

Yuri K

Yuri K (view profile)

Congratulations for getting PoW! Great tool!

Nick Sinclair


Nitin (view profile)


Zhang (view profile)

very good, very appreciate

Works Great,
Thanks for sharing...

Ben Bauer

piao lin


excellent work, useful and well documented¡¡¡

Chen Xing

Many thanks!! Quick and simple

Bharat Pathak

Thank you very much.

Tory C

Great! Thank you! Is there a quick way to make the line thickness bigger?? Cant find the obvious fix in the code.



so cool!

thanks a lot

julio gomez

Fabiano Giuliani

A perfect function to draw an ellipse. Thank you!

Natt T


MARGOT Gerritsen

Works like a treat

Y Liu

Andrzej Z

Reza Zahiri

nice and clean piece of code, thanks for sharing

kim jeongdae


peppo franco

jung sung yun

Yassir Al-Jahdir

Thank you very much!!

Kazimieras Bagdonas

thanx, yours function saved my day=)

Sanith Wijesinghe


Stephen Westland

Saved my bacon today. Perfect.

Omar Muhanna

thank you very much for this file. because I was looking for such a function in MatLab that can draw for me an ellipse.but if you can send me the simpleat function for drawing such a simple ellipse I will be very greatful.

thank you...

Richard Weaver

Excellent- just what I needed - allows full user specification of the ellipse parameters.

peter YOU


P Sirisalee

Many Thanks.

Paul Larsen

Works great! Thanks a million.

Yuval Tassa

Watch out for the missing semicolon in line 131. Otherwise, a great little util.

Gregory B

Thanks a lot!

Tom Thorvaldsen

Made my life much easier.

Mark Wilde

i like a lot. makes me happier than the other 2 guys could ever be!

ke wang

It helps me a lot! Thank you very much

L. O'Neill

This function is easy to use, logical, and does exactly what it says it will. I am very happy with it.

MATLAB Release
MATLAB 5.2 (R10)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video