I'm confused about how I can change the colors of graphs in the plots, each line represents an approximation of Euler with different h value.
import numpy as np
import matplotlib.pylab as plt
# your function
def Eulergraph(h, N, ax):
K = 12; r = 0.43; Po = 1;
#defining dP/dt as a function f(P)
f = lambda P: r*P*(1-P/K)
P = np.array([])
P = np.append(P,Po) #initializing P with Po
for n in range(N+1):
Pn = P[n] + h*f(P[n])
P = np.append(P,Pn)
# formatting of your plot
plt.xlabel (' Value of n ”' )
plt.ylabel (" Value of p[n] ”")
plt.title (" Approximate Solution with Euler’s Method " )
plt.show()
