def plot_heater(ax, data):
"""
plots deiced heater status i.e. ON/OFF
"""
if not 'PRTAFT_deiced_temp_flag' in data:
return
ax.text(0.05, 0.98,'Heater', axes_title_style, transform=ax.transAxes)
ax.grid(False)
ax.set_ylim(0,1)
ax.yaxis.set_major_locator(plt.NullLocator())
plt.setp(ax.get_xticklabels(), visible=False)
heater_status=np.array(data['PRTAFT_deiced_temp_flag'], dtype=np.int8)
toggle=np.diff(heater_status.ravel())
time_periods=zip(list(np.where(toggle == 1)[0]),
list(np.where(toggle == -1)[0]))
for t in time_periods:
#plt.barh(0, data['mpl_timestamp'][0,1], left=data['mpl_timestamp'][0,0])
width=data['mpl_timestamp'][t[1],0]-data['mpl_timestamp'][t[0],0]
ax.add_patch(patches.Rectangle((data['mpl_timestamp'][t[0],0], 0), width, 1, alpha=0.8, color='#ffaf4d'))
return ax
评论列表
文章目录