I have 5 different lists y_0,y_1,y_2,y_3 and y_4 : Each of which contain 450120 probability values. The corresponding values of each of the lists add up to 1, i.e, y_0[n] + y_1[n] + y_2[n] + y_3[n] + y_4[n] = 1 for any 'n'.
The X axis contains the indices or the time steps, which are numbers sequentially ranging from 0 to 450119. I want to plot the Y values such that the corresponding probability values or entries of the 5 lists at a given index are plotted on top of one another in different colors. For example: If y_0[0] = 0.2 , y_1[0] = 0.3, y_2[0] = 0.1, y_3[0] = 0.3, y_4[0] = 0.1. So at x=0, I want the following: y_0[0] to be plotted in red from 0 to 0.2 , y_1[0] to be plotted in green from 0.2 to 0.5, y_2[0] to be plotted in yellow from 0.5 to 0.6, y_3[0] to be plotted in blue from 0.6 to 0.9, y_4[0] to be plotted in pink from 0.9 to 1.
And this must repeat for all x values from 0 to 450119.
Currently, I am getting many blank spaces in the plot, as well as many overlaps. Class C5 is not visible at all.
def plotAllClassesInOne(y_indices,y_0,y_1,y_2,y_3,y_4,filename):
plt.xlabel('Time in seconds')
plt.ylabel('P(Y|X)')
plt.plot(y_indices, plott(y_0), 'y',label='C1')
plt.plot(y_indices, plott([sum(x) for x in zip(y_0,y_1)]), 'r',label='C2')
plt.plot(y_indices, plott([sum(x) for x in zip(y_0,y_1,y_2)]), 'g',label='C3')
plt.plot(y_indices, plott([sum(x) for x in zip(y_0,y_1,y_2,y_3)]), 'b',label='C4')
plt.plot(y_indices, plott([sum(x) for x in zip(y_0,y_1,y_2,y_3,y_4)]), 'k',label='C5')
plt.legend()
fig1 = plt.gcf()
fig1.savefig(filename)
plt.close()