Code covered by the BSD License

Highlights from ellipse.m

4.71111
4.7 | 45 ratings Rate this file 125 Downloads (last 30 days) File Size: 2.26 KB File ID: #289 Version: 1.0

ellipse.m

David Long (view profile)

Adds ellipses to the current plot

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

File Information
Description

Adds ellipses to the current plot

Acknowledgements
MATLAB release MATLAB 5.2 (R10)
09 Nov 2015 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.

Comment only
09 Nov 2015 jaribeiro

jaribeiro (view profile)

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?

Comment only
05 Apr 2015 ramin bba

ramin bba (view profile)

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:

h=ellipse(ra,rb,ang,x0,y0,C,Nb);
x=get(h,'Xdata');
y=get(h,'Ydata');
for i=1:length(x)
hold on;
patch(x{i},y{i},'y');
hold off;
end

Comment only
01 Apr 2015 David Long

David Long (view profile)

To efficiently produce a "filled" ellipse using this code, use the returned handle:
h=ellipse(ra,rb,ang,x0,y0,C,Nb);
x=get(h,'Xdata');
y=get(h,'Ydata');
hold on;
patch(x,y,'y');
hold off;

Comment only
01 Apr 2015 ramin bba

ramin bba (view profile)

awesome code, helped me out a lot.

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

15 Jan 2015 Chris

Chris (view profile)

26 Sep 2014 Frank

Frank (view profile)

quite useful

01 Sep 2014 David Long

David Long (view profile)

Comment only
12 Aug 2014 Abhik

Abhik (view profile)

16 Aug 2013 Jay Patel

Jay Patel (view profile)

25 Jun 2013 Frederik

Frederik (view profile)

17 Aug 2012 Kuider

Kuider (view profile)

excellent! helped me a lot thank you

02 Nov 2011 Yuri K

Yuri K (view profile)

Congratulations for getting PoW! Great tool!

15 Aug 2011 Laurent Ballaz

Laurent Ballaz (view profile)

28 Jun 2011 Nick Sinclair

Nick Sinclair (view profile)

16 May 2011 Nitin

Nitin (view profile)

23 Apr 2011 Zhang

Zhang (view profile)

very good, very appreciate

13 Feb 2011 Mohammed El-Said

Mohammed El-Said (view profile)

Works Great,
Thanks for sharing...

09 Jan 2011 Ben Bauer

Ben Bauer (view profile)

20 Nov 2010 piao lin

piao lin (view profile)

22 Feb 2010 Antonio

Antonio (view profile)

excellent work, useful and well documented¡¡¡

05 Feb 2010 Chen Xing

Chen Xing (view profile)

Many thanks!! Quick and simple

22 Sep 2008 Bharat Pathak

Thank you very much.

30 May 2008 Tory C

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

16 Feb 2008 H J
16 Feb 2008 A K

so cool!

thanks a lot

05 Feb 2008 julio gomez
03 Feb 2008 Fabiano Giuliani

A perfect function to draw an ellipse. Thank you!

03 Jan 2008 Natt T

Thanks

18 Oct 2007 MARGOT Gerritsen

Works like a treat

17 Oct 2007 Y Liu
21 Sep 2007 Andrzej Z
08 Nov 2006 Reza Zahiri

nice and clean piece of code, thanks for sharing

28 Sep 2006 kim jeongdae

thanks

01 Apr 2006 peppo franco
19 Mar 2006 jung sung yun
01 Feb 2006 Yassir Al-Jahdir

Thank you very much!!

16 May 2005 Kazimieras Bagdonas

thanx, yours function saved my day=)

12 May 2005 Sanith Wijesinghe

Great

06 Apr 2005 Stephen Westland

Saved my bacon today. Perfect.

23 Sep 2004 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...

19 May 2004 Richard Weaver

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

27 Mar 2004 peter YOU

Excelent

18 Mar 2004 P Sirisalee

Many Thanks.

16 Feb 2004 Paul Larsen

Works great! Thanks a million.

03 Jan 2004 Yuval Tassa

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

10 Nov 2003 Gregory B

Thanks a lot!

02 Oct 2003 Tom Thorvaldsen

30 Sep 2003 Mark Wilde

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

07 Sep 2003 ke wang

It helps me a lot! Thank you very much

Comment only
22 Aug 2002 L. O'Neill

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