In the last blog we already created a plot, but perhaps you only want the figure to show points not with lines, how can you do that? In this blog, I will show you how to do just that.
Plot Without Line
In the Matplotlib plot
, you can create a plot without the line. Let me show you how to do it.
First, let us create a normal plot with a line
import matplotlib.pyplot as plt
import numpy as np
xpoints = np.array([0, 6])
ypoints = np.array([0, 250])
plt.plot(xpoints, ypoints)
plt.show()
In order to make a plot without the line, you just need to pass o
as the third argument to the plot
method
import matplotlib.pyplot as plt
import numpy as np
xpoints = np.array([0, 6])
ypoints = np.array([0, 250])
plt.plot(xpoints, ypoints, 'o')
plt.show()
If you run the above code, you will get the following output result
That is it! that is how you can create a plot without the line. Thank you for reading this blog and have a nice day!
Top comments (0)