Home > Back-end >  the plot showing one color for all the graphs
the plot showing one color for all the graphs

Time:03-04

i tried to get many graphs in one plot in different colors but only one color shown in all the graphs, and all the graphs return to 0 at the last value except the last graph, and I also tried to make the color attribute for example plt.plot(x,y,color='r') but same output this is my code

import matplotlib.pyplot as plt
import math as m


data_t = []
data=[]
data_v = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]
l=[(0,0.016699),(1,0.023958),(2,0.02724),(3,0.033468),(4,0.42456),(5,0.059325),(6,0.063399),(7,0.079788),(8,0.095916),(9,0.125),(10,0.14622),(11,0.20257),(12,0.21643),(13,0.28974),(14,0.4424),(15,0.55856),(16,0.59991),(17,0.72561),(18,0.9964),(19,1.6748),(20,1.69)]

for x in range(len(l)):
    a=l[x][0]
    c=l[x][1]
    for i in range (3600):
        t=i
        v=m.sqrt((2*(150-(40*9.8*m.sin(m.radians(a)))))/(1.2*c*0.875))*m.tanh(m.sqrt(((150/40)-9.8*m.sin(m.radians(a)))*(1.2*c*0.875*0.0125))*t)
        data_t.append(t)
        data.append(v)
        data_v[x]=data
for i in range(21):
    plt.plot(data_t,data_v[i],label='valeur de alfa' str(i))

plt.legend(loc='center left',fontsize = 7)
plt.grid(True)
plt.xlabel("temps s")
plt.ylabel("vitesse m/s")
plt.title("vitesse en fonction d'angle")
plt.show()

this is the graph : plots

  • Related