Reputation: 3
I am building system with four load cells. I would like to plot data to polar coordinate system, presented with single dot (scatter).
Every load cell should be presented in 1/4 part of the circle (90 degrees). On the circles I want to show kilograms. If weight on every load cell will be the same, dot (scatter) should be in the center and showing 0, meaning all the load cells are equally loaded. If not (more load on single cell), dot should move to that part of circle and show the amount of kilograms. I would like to represent scatter dot with two parameters, kilograms and degrees (0-360).
I am able to plot kilograms in the way that I want, but degree parameter is not plotted correctly.
import matplotlib.pyplot as plt
degrees = 0
kilograms = 15
ax = plt.subplot(polar=True)
ax.scatter(degrees, kilograms)
ax.set_theta_zero_location('N')
ax.set_rticks([10, 20]) # less radial ticks
ax.set_rmax(30)
plt.show()
I am aware that polar coordinate system is not the same as cartesian. Anyway, is it possible to enter scatter parameter as degrees, presenting it in that particular part of the circle of polar graph?
ax.scatter(45, 20) # degrees, kilograms
Upvotes: 0
Views: 685
Reputation: 1106
I think your problem comes from the degree
variable, that you use for theta, being in degree rather than radian. Try:
import numpy as np
ax.scatter(np.deg2rad(degree), kilograms)
and it should plot correctly
Upvotes: 1