4

I am using the following code to create a polar plot of the sinus.

import numpy as np
import matplotlib.pyplot as plt


theta = np.arange(0, 2*np.pi, .01)[1:]
plt.polar(theta, sin(theta))
plt.show()

which produces:

enter image description here

but I want to plot it symmetrically, like this:

enter image description here

How can I get the result I want?

1
  • Why do you define f()? Commented Jan 4, 2017 at 6:16

2 Answers 2

4

The matplotlib polar allows for negative radius. So, if you want the symmetric plot you need to plot the absolute value of sin:

polar(theta, abs(sin(theta)))

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

2

Anon, you need to plot the opposite of sin(theta):

plt.polar(theta, sin(theta))
plt.polar(theta, -sin(theta))

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.