使用matplotlib绘制对数R标度极坐标图

idfiyjo8  于 2023-03-19  发布在  其他
关注(0)|答案(1)|浏览(166)

我需要绘制天线辐射图。为此我需要一个对数极坐标图。问题是,matplotlib不支持对数极坐标图。
辐射方向图的数据由两个numpy数组给出。一个为theta(方位角),另一个为r(增益)。r值对应于天线发射的衰减(以db为单位)。这意味着图的最外圆对应于值0,数字向中心增加。
使用此代码,我可以生成适当的图,但具有线性r尺度:

fig = plt.figure(figsize=(10,5))
ax = plt.subplot(121, projection = 'polar')
ax.set_rlim(30,0)
ax.plot(azimuth_h, (gain_h))
ax.plot(azimuth_v, (gain_v))
ax.grid(True)

Plot with linear scale
当我尝试将ax.set_rscale('log ')与ax.set_rlim(30,0)结合使用时,我得到了如下的结果。

fig = plt.figure(figsize=(10,5))
ax = plt.subplot(121, projection = 'polar')
ax.set_rscale('log')
ax.set_rlim(30,0)
ax.plot(azimuth_h, (gain_h))
ax.plot(azimuth_v, (gain_v))
ax.grid(True)

Plot with log scale
有没有其他方法可以使用matplotlib来完成这个任务?或者是一种完全不同的方法?
我希望尽量简单
谢谢

nbysray5

nbysray51#

您是否尝试将r下限设置为某个小值(例如0.1)而不是零?
使用matplotlib极坐标对数图进行零点处理时会出现一些问题:How to use log scale on polar axis in matplotlib

相关问题