Большое спасибо!
Это то, что я хочу, чтобы сюжет выглядел так:
мой код:
time_ticks = np.arange(0,31,1)
ax_time.bar(x, msg_1_time, width=width, label='Msg1 time', color='r')
ax_time.bar(x, msg_3_time, bottom= msg_1_time, width=width, label='Msg3 time', color='g')
ax_time.bar(x, UL_Time, bottom=msg_3_time+msg_1_time, width=width, label='UL packet time', color='deepskyblue')
ax_time.bar(x, Idle_Time, bottom=UL_Time+msg_3_time+msg_1_time, width=width, label='Inactivity time', color='burlywood')
ax_time.set_xlabel('ECL',font)
ax_time.set_yticks(time_ticks)
ax_time.set_ylabel('Time (s)',font)
energy_ticks = np.arange(0,9,1)
ax_energy.bar(x, msg_1_energy, width=width, label='Msg1 energy', color='thistle')
ax_energy.bar(x, msg_3_energy, width=width, bottom= msg_1_energy, label='Msg3 energy', color='deepskyblue')
ax_energy.bar(x, UL_Energy, width=width, bottom=msg_3_energy+msg_1_energy, label='UL packet energy', color='lemonchiffon')
ax_energy.bar(x, Idle_Energy,width=width, bottom=UL_Energy+msg_3_energy+msg_1_energy, label='Inactivity energy',color='navajowhite')
ax_energy.set_xlabel('ECL',font)
ax_energy.set_yticks(energy_ticks)
ax_energy.set_ylabel('Energy (J)',font)