【发布时间】:2019-03-12 13:51:45
【问题描述】:
这就是我正在运行的代码
#Pass Sonar
import numpy as np
import matplotlib.pyplot as plt
#Entering Data
# angles of all the passes
theta = [45]
heights = [5]
# length of all the passes
# Getting axes handles/objects
ax1 = plt.subplot(111, polar=True)
# Plot
bars = ax1.bar(theta, heights,
color='xkcd:orangered',
#color=plt.cm.jet(heights),
width=0.1,
#width=heights,
bottom=0.0,
edgecolor='k',
alpha=0.5,
label='All Passes>2 mts')
##Main tweaks
# Radius limits
ax1.set_ylim(0, 7.0)
# Radius ticks
ax1.set_yticks(np.linspace(0, 7.0, 8))
# Radius tick position in degrees
ax1.set_rlabel_position(315)
#Angle ticks
ax1.set_xticks(np.linspace(0, 2.0*np.pi, 9)[:-1])
#Additional tweaks
plt.grid(True)
plt.legend()
plt.title("Pass Sonar: Mesut Özil v/s Leicester City - 22.10.2018")
plt.show()
所以,我使用 45 作为度数参数,但条形图打印在 58 度?输入 90 会将标准设置为 115-ish。我也尝试过使用linspace,但问题仍然存在。
度数参数是度数还是其他(弧度)?如果这不是问题,我做错了什么?
【问题讨论】:
标签: python matplotlib polar-coordinates