# ellipse function in ncl?

From: Erik Noble <nobleeu_at_nyahnyahspammersnyahnyah>
Date: Tue, 19 Sep 2006 20:38:18 -0600

Hi NCL world.

Does NCL have a function to create a graphical ellipse for data?
I've looked.
Before, I build one, would anyone happen to have already created such a script?

I am in the middle of trying to create one based of the Matlab code below.

Erik

**********************************************
function C=drawellipse(a,b,th,xc,yc,lt)
%function C=drawellipse(a,b,th,xc,yc,lt)
%
% Input: a=semimajor axis length, b=semiminor axis length
% th=angle between semimajor axis and positive x axis.
% (xc,yc) are optional inputs specifying the ellipse center
% lt is an optional input specifying the line type
% Output: rotation matrix
% Author: E. Noble, University of Colorado 2/2005

E=0:pi/100:2*pi;
x=a*cos(E);
y=b*sin(E);

C=[cos(th) -sin(th); sin(th) cos(th)];

z=C*[x;y];

if (nargin == 4)
ltt=xc;
elseif (nargin == 6)
ltt=lt;
else
ltt='g';
end

if (nargin > 4)
z=[z(1,:)+xc; z(2,:)+yc];
end

plot(z(1,:),z(2,:),ltt)
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 19 2006 - 20:38:18 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 25 2006 - 11:45:06 MDT