How to use scatter() In Python
scatter is a method present in matplotlib library which is used to set individual point sizes. It takes 3 parameters 2 data points and a list of marker point sizes.
Python3
# import necessary packages import matplotlib.pyplot as plt # data1&data2 data1 = [ 1 , 2 , 3 , 4 , 5 ] data2 = [ 0 , 0 , 0 , 0 , 0 ] # size of marker points sizes = [ 10 , 20 , 30 , 40 , 50 ] # plot graph plt.scatter(data1, data2, sizes) plt.xlabel( 'x-axis' ) plt.ylabel( 'y-axis' ) |
Output:
There is flexibility in scatter that is we can specify the size for each point so that it can be easily distinguished.
How to Adjust Marker Size in Matplotlib?
In this article, we are going to see how to adjust marker size in Matplotlib in Python.
We can adjust marker size in plots of matplotlib either by specifying the size of the marker in either plot method or scatter method while plotting the graph.