What are Scatter Plots in Python and How to Plot Them

What are Scatter plots?

Scatter Plots represent relationship between two variables. It also helps to identify the outliers(extremely small or extremely large value). Scatter plots are used to plot numeric data. One can visualize the data using Scatter plot to find out the relation (if any) exists between the variables.

Scatter plots gives an idea about two numeric variables, the third dimension can be added with the parameter called ‘hue’ (which is discussed later) We plot very basic scatter plot and move on to plotting more interesting plots.

Observations

  • The above scatter plot shows that there is a linear relationship between x and y
  • Linear Relation signifies that with the increase/decrease of one variable, the other variable will increase/decrease.

Lets take a deeper look on how can we really play with scatter plots.

here we import 3 libraries

import numpy as np, random as rn, matplotlib as plt ( we can write it as it is in the notebook by giving commas even.)

Observations

  • The above scatter plots shows no relation between the variables.
  • The plot so obtained is because of the random numbers generated using numpy

Bubble Plota

Lets see the versatility of scatter plots we can transform to bubble plots. Have a look.a

Last example where we can see how to use markers ( here square and circles are used) to separate two classes from each other. We use if , else condition to here to plot the scatter.

Concluding Remarks

We can plot several scatter plots with different shapes, sizes and dimensions. Scatter plots are a great way to have a general view of the data. It is helpful to get an idea about the correlation, shape, distribution and spread of the data.

For more data Visualization plots visit :

https://www.udemy.com/course/data-analysis-visualization-with-python/?referralCode=834CBC3B42CEB204D5E3

Leave a Reply