I try to plot a list a of values with respect to time and I have two examples: one where Im plotting angular velocities and the other where Im plotting linear accelerations. For both graphs the code for plotting is the same but in the linear accelerations graph there are multiple identical entries in the legend which I did not intend. Can you help me find the mistake?
kampai, ax = plt.subplots()
kampai.subplots_adjust(hspace=1, wspace=1)
ax.plot(time, xkampai, '-r', label='$\omega$$_x$, s$^{-1}$')
ax.set_xlim(1, 80)
ax.set_ylim(0, 0.5)
ax2 = ax.twinx()
ax3 = ax.twinx()
ax3.spines['right'].set_position(('axes', 1.2))
ax2.plot(time, ykampai, '-g', label='$\omega$$_y$, s$^{-1}$')
ax2.set_ylim(0, 0.5)
ax3.plot(time, zkampai, '-b', label='$\omega$$_z$, s$^{-1}$')
ax3.set_ylim(0, 0.5)
ax.set_xlabel('t, s')
ax.set_xlim(xmin=5, xmax=80)
ax.legend(loc='upper left', bbox_to_anchor=(0, 1))
ax2.legend(loc='upper left', bbox_to_anchor=(0, 0.9))
ax3.legend(loc='upper left', bbox_to_anchor=(0, 0.8))
pagreiciukai, bx = plt.subplots()
pagreiciukai.subplots_adjust(hspace=1, wspace=1)
bx.plot(time, pagreitisx, '-r', label='a$_x$, m $\cdot$ s$^{-2}$')
bx2 = bx.twinx()
bx3 = bx.twinx()
bx3.spines['right'].set_position(('axes', 1.2))
#bx2.plot(time, pagreitisy, '-g', label='a$_y$, m $\cdot$ s$^{-2}$')
#bx3.plot(time, pagreitisz, '-b', label='a$_z$, m $\cdot$ s$^{-2}$')
bx.set_xlabel('t, s')
bx.set_xlim(xmin=5, xmax=80)
bx.legend(loc='upper left', bbox_to_anchor=(0, 1))
#bx2.legend(loc='upper left', bbox_to_anchor=(0, 0.9))
#bx3.legend(loc='upper left', bbox_to_anchor=(0, 0.8))
plt.show()