Python Create a scatter plot using matplotlib.pyplot

Here, we are executing a python program to make a dissipate plot utilizing matplotlib.pyplot.

Issue explanation: Write a program in python (utilizing matplotlib.pyplot) to make a disperse plot.

Utilization of dissipating plot: Scatter plots are normally used to analyze two factors (three in the event that you are plotting in 3 measurements), searching for connection or gatherings.

Program:

import matplotlib.pyplot as plt

x = [1,2,3,4,5,6,7,8,9,10]
y = [3,9,6,12,5,1,10,5,4,9]

plt.scatter(x,y, label='scplots', color='r', s=60, marker="X")

plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Scatter Plot')
plt.legend()
plt.show()

Output:

Python Create a scatter plot using matplotlib.pyplot

Clarification:

Python library matplotlib.pyplot is utilized to draw the above diagram. Two irregular factors x and y are taken with arbitrary qualities. The dissipate work plots a disperse plot. The dissipate work takes 2 contentions for example x and y and a mark variable gives the name to the plot. To name the tomahawks X-hub and Y-pivot capacities are utilized and to give the title to the plot the title work is utilized. To show the legend the legend work is utilized lastly to show the plot the show work.

Leave a Comment