微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为雷达数据的 x 轴添加时间刻度

如何解决为雷达数据的 x 轴添加时间刻度

我有两个 NumPy 数组 (2700,1000),用于将 5 秒的 RADAR 数据绘制为通道 1 和通道 2。2700 (m) 是范围,每 200 个 x 数表示一秒。

enter image description here

但我想每 2 秒向 x 轴添加刻度。 power_ch1 和 power_ch2 是我上面提到的两个不同的数组。

csfont = {'fontname':'Times New Roman'}                       # font applied as 'Times New Roman'

fig,ax = plt.subplots()

plt.subplot(211)                                              # Channel 1 located
plt.imshow(power_ch1,cmap='viridis',# Channel 1 is plotted with [plt.imshow()],colormap is 'viridis'
           interpolation='nearest',aspect='auto')                                     # 475 number is time(s) and 405 number is range(km)
plt.title(r'Reveiver Channel A',**csfont)                     # plot title is written and font has been set as 'Times New Roman'
plt.ylabel('RANGE (km)',**csfont)                             # Text('RANGE') has been printed on the y-axis
plt.xlabel('LOCAL TIME (hh:mm:ss)',**csfont)                  # Text('LOCAL TIME (hh:mm:ss)') has been printed on the x-axis
plt.xticks(x,array_clock)                                   # ticks set on x-axis and 'array_clock' printed here
plt.yticks(y)                                                # ticks set on y-axis
cbar = plt.colorbar()                                         # colorbar located
cbar.set_label('POWER (dB)',**csfont)                         # 'POWER (dB)' text printed next to colorbar

plt.subplot(212)                                              # Channel 2 located

plt.imshow(power_ch2,# Channel 2 is plotted with [plt.imshow()],colormap is 'viridis' 
           interpolation='nearest',aspect='auto')                                     # 475 number is time(s) and 405 number is range(km)
plt.title(r'Reveiver Channel B',**csfont)                         # 'POWER (dB)' text printed next to colorbar

fig.tight_layout()                                            # tight_layout automatically adjusts subplot params so that the
                                                              # subplot(s) fits in to the figure area.

plt.show()                                                    # display all open figures.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。