%matplotlib inline
import matplotlib.pyplot asplt
import numpy as np
X=np.linspace(0,2*np.pi)
y = np.sin(X)
plt.plot(x,y)
------------------------------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_26536\2280643985.py in<module>
3 y = np.sin(X)
4
---->5plt.plot(x,y)
NameError: name 'x' is not defined
It appears to be an error due to a case difference.Let's unify to one or the other.
Where X
is capitalized:
X=np.linspace(0,2*np.pi)
y = np.sin(X)
x
in lowercase:
plt.plot(x,y)
© 2024 OneMinuteCode. All rights reserved.