为雷达数据的 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 (将#修改为@)