【发布时间】:2021-03-29 03:30:31
【问题描述】:
我正在尝试使用 matplotlib 在雷达图上绘制 180 度激光雷达数据。代码就像
import sys
import os
import struct
import matplotlib.pyplot as plt
import time
import math
ax = plt.subplot(111, polar=True)
plt.ylim(0,255)
def animate():
ax.clear()
ax.plot(xar, lidarData, linewidth=1, linestyle='solid')
plt.pause(0.0001)
plt.ion()
plt.show(block=False)
其中 xar 是角度 -90 到 90(绘图需要 rad)。由于我只使用图表的上半部分,如何让它只显示圆的一半?以便我可以清楚地看到数据。
【问题讨论】:
-
请提供预期的MRE - Minimal, Reproducible Example。您发布的代码在未定义的符号上失败。您忽略了必需的
import语句。 -
感谢您指出这一点。刚刚更新了问题。
标签: python matplotlib plot graph