Draw a scatter plot in Matplotlib
Draw a scatter plot:
The following code block draws a scatter plot that depicts the relation between the demand and price:
import matplotlib.pyplot as plt x1 = [214, 5, 91, 81, 122, 16, 218, 22] x2 = [12, 125, 149, 198, 22, 26, 28, 32] plt.scatter(x1, x2) # Set X and Y axis labels plt.xlabel('Demand') plt.ylabel('Price') #Display the graph plt.show()
The following is the output that will be obtained:
2018-10-23T02:37:43+05:30
2018-10-23T02:37:43+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution