I have created a graph of three curves in Python where I want the colors to be different for each curve. How can I put different colors on each curve? For example green, blue and red, instead of red on all three.
Following is the Python code:
import matplotlib.pyplot as plt
import math
a = 9.8 # Acceleration due to gravity, m/s^2
theta = []
v = 50.0
m = 10.0
c = 1.29
vt = (m * 9.8) / c # terminal velocity #151.93
time = []
horizontal_range = []
vertical_range = []
for th in range(0,60,15):
for t in range(0, 50):
var = (-a * t) / vt
z = (vt / 9.8) * (v * 0.866 + vt) * (1.0 - (2.718 ** var)) - vt * t
x = ((1.0 - math.exp(var)) * (v * vt * math.cos(th))) / a
horizontal_range.append(x)
vertical_range.append(z)
time.append(t)
theta.append(th)
plt.plot(horizontal_range, vertical_range, color='red')
plt.xlabel('x')
plt.ylabel('z')
plt.ylim(0)
plt.xlim(0)
plt.title('Projectile')
plt.show()