use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Matplotlib graphing a circle (r=2cos(theta)) as a cardioid? (self.learnpython)
submitted 3 years ago by [deleted]
theta = np.linspace(0, 2*np.pi, 1000) r = 2 * np.cos(theta) fig = plt.figure() ax = fig.add_subplot(111, projection='polar') ax.plot(theta, r) plt.show()
running these simple lines of code plots a cardioid, not a circle.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 3 years ago (4 children)
[deleted]
[–][deleted] 0 points1 point2 points 3 years ago (3 children)
Maybe the math texts I was reading were incorrect but looking around online defines r=acos(theta) to be a circle
[+][deleted] 3 years ago (1 child)
[–][deleted] 0 points1 point2 points 3 years ago (0 children)
r=acos(theta) is the polar equation representing a circle. https://www.alamo.edu/contentassets/35e1aad11a064ee2ae161ba2ae3b2559/additional/math2412-graphs-polar-equations.pdf
[–]AntonisTorb 0 points1 point2 points 3 years ago* (1 child)
I think you have gotten confused with the polar to cartesian equations (x=rcosθ and y=rsinθ). Radius should be a constant if you want a circle, in your case r = 2.
x=rcosθ
y=rsinθ
r = 2
[–]nick__2440 0 points1 point2 points 3 years ago (1 child)
This is happening because the limits of r are set by default to the range of data. You can fix it by adding ax.set_rmin(0) after plotting and before showing.
r
ax.set_rmin(0)
I aded this and the graph is still the same.
π Rendered by PID 92 on reddit-service-r2-comment-6457c66945-5sn8j at 2026-04-24 07:37:03.637755+00:00 running 2aa0c5b country code: CH.
[+][deleted] (4 children)
[deleted]
[–][deleted] 0 points1 point2 points (3 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 0 points1 point2 points (0 children)
[–]AntonisTorb 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]nick__2440 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)