Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

polar plot in python

I am trying to make a polar plot of 1/t. What I have so far is below (which may be wrong). How can I finish this or make it work?

from pylab import *
import matplotlib.pyplot as plt

theta = arange(0, 6 * pi, 0.01)


def f(theta):
    return 1 / theta

Polar Plot in Mathematica

like image 292
dustin Avatar asked Jun 10 '26 17:06

dustin


1 Answers

I think the problem is that your first value of f(theta) is 1/0 = inf

theta = np.arange(0, 6*np.pi, .01)[1:] 

def f(x):
    return 1/x

plt.polar(theta, f(theta))

one_over_theta

and it looks even nicer if you zoom in:

zoom

like image 56
askewchan Avatar answered Jun 13 '26 07:06

askewchan