Problem in python's mathplotlib module
https://learn.365datascience.com/courses/python-programmer-bootcamp/matplotlib In this lesson around 5:15 , we are been informed to print dotted line.
How can I do same in Spyder?
i tried :-
plt.plot(x_axis,l,'ko--') as shown in lesson
Error i got:-
plt.plot(x_axis,l,'ko--')
NameError: name 'x_axis' is not defined
can you please explain.
thank you
1 answers ( 0 marked as helpful)
Hi Prafful,
you get the error because the x_axis variable has not been defined. In the video, the x_axis is a list of coordinates to be plotted with matplotlib.
You can try the following line of code(same as in the video) for an x_axis and it must be defined and run before you start plotting:
x_axis = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
Best,
Eli