Skip to content Skip to sidebar Skip to footer

Python Polar Plot: Plot Values Corresponding To The Angle

I'm trying to plot sensor data, which was recorded with different angles. import pandas as pd import matplotlib.pyplot as plt #create dataframe, each row contains an angle and

Solution 1:

theta in plt.polar(theta, r) needs to be in radians. You can make a new column converting the angle to radians using the following:

import math
df['rad'] = df.apply(lambda row: row.angle*math.pi/180, axis=1)
plt.polar(df['rad'], df['value'])

This results in this plot:.

This plot

Post a Comment for "Python Polar Plot: Plot Values Corresponding To The Angle"