I have discovered, from the mailing list, the easy way to draw a circle 
in linear space:

cx = 700
cy = 700
r = 1000

xmin = cx - r
xmax = cx + r
ymin = cy - r
ymax = cy + r

cir = Circle( (cx,cx), radius=r,facecolor='w',edgecolor='b')
a = gca()
a.add_patch(cir)

axis([xmin,xmax,ymin,ymax])
axis('equal')

However, when trying to overplot a circle on an existing log/log plot, I 
get a circle section:
e = 
[70,1,1,12,7,185,6,3,0,1015,6,222,500,0,661,105,0,8706,0,23,131,0,0,0,6,22,1,4,0]
o = 
[180,2,0,15,13,3,0,0,0,20,6,2000,9748,0,38,100,0,20023,0,2,0,0,0,0,1,0,0,0,1]
f1 = figure()
loglog(o,e,'b.')
hold('on')
cx = 700
cy = 700
r = 1000

xmin = cx - r
xmax = cx + r
ymin = cy - r
ymax = cy + r

cir = Circle( (cx,cx), radius=r,facecolor='w',edgecolor='b')
a = gca()
a.add_patch(cir)

axis([xmin,xmax,ymin,ymax])
axis('equal')

How can I plot a circle in log space?

As an additional aside, I've discovered that even if I define the points 
that make up a circle (in linear space), I cannot plot a smooth line 
through them using the plot() function:
def pol2cart(th,r):
    x = r*cos(th)
    y = r*sin(th)
    return (x,y)
   
def drawCircle(cx,cy,radius,np,style):
    theta = linspace(0,2*pi,np)
    rho = ones((1,np))*radius
    x,y = pol2cart(theta,rho)
    x = x + cx
    y = y + cy
    plot(x,y,style)

cx = 700
cy = 700
r = 1000
drawCircle(cx,cy,r,1000,'b')

When I look at the resulting plot, I see empty axes.  If I change the 
plot style to 'b.', then I see the circle.  Is this a bug or an 
undocumented feature?

Thanks,

Mike Hearne

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to