How can i draw a vector/line starting from polar coordinates (magnitude and angle) instead of rectangular coordinates (x, y) in python with matplotlib? I started learning python just a couple days ago.
Asked
Active
Viewed 2,401 times
1 Answers
1
Translate polar co-ordinates to cartesian co-ordinates by doing the following:
x = magnitude*cos(angle)
y = magnitude*sin(angle)
Note: Double check if you are using degrees or radians. Usually cos and sin expect radians. To translate from angle to radians, multiply by (2*pi)/360
. To translate from radians to angle, multiply by 360/(2*pi)
.

Patashu
- 21,443
- 3
- 45
- 53
-
1Better yet, use numpy.rad2deg and numpy.deg2rad. – pelson Apr 21 '13 at 19:30