您没有正确使用csv读取器。相反,使用numpy的
genfromtxt
作用我自己制作了数据。csv文件,73个数字增加2。
import numpy as np
import matplotlib.pyplot as plt
r = np.genfromtxt('data.csv',delimiter=',')
#data is a list of 73 data points taken at each 5 degree increment
theta = np.linspace(0, 2 * np.pi, 73)
ax = plt.subplot(111, projection='polar')
ax.plot(theta, r)
ax.set_rmax(2)
ax.set_rticks([0.5, 1, 1.5, 2]) # less radial ticks
ax.set_rlabel_position(-22.5) # get radial labels away from plotted line
ax.grid(True)
ax.set_title("Polar", va='bottom')
plt.show()