Issue
I would like to plot x^c for different values of c on the same graph using just for loop and matplotlib library, with different colors for each function . When I try using for loop, the output just shows one graph.
****CODE****
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
plt.figure()
x = np.linspace(0,1,100)
for i in range(-10,10,21):
if i<0:
plt.plot(x,x**(abs(1/i)))
elif i>0:
plt.plot(x,x**i)
plt.show()
Solution
Your range()
function right now produces only a single value of -10. May be you need
for i in range(-10,10,1):
which produces
Answered By - Sheldore
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.