Scatter plot

A scatter plot is a type of graph used to display the relationship between two continuous variables. It visually represents the correlation or pattern between these variables. The graph consists of a horizontal x-axis that represents one variable and a vertical y-axis that represents the other variable.

In a scatter plot, each data point is plotted as a single dot or marker on the graph, with its position determined by the values of the two variables it represents. The x-coordinate of a data point corresponds to the value of one variable, while the y-coordinate corresponds to the value of the other variable.

By examining the distribution and clustering of the data points on the scatter plot, you can gain insights into the relationship between the variables. The general patterns that can be observed in scatter plots include:

1. Positive correlation: The data points tend to form an upward sloping pattern from left to right, indicating that as one variable increases, the other variable tends to increase as well.

2. Negative correlation: The data points tend to form a downward sloping pattern from left to right, indicating that as one variable increases, the other variable tends to decrease.

3. No correlation: The data points appear to have no discernible pattern or relationship, scattered randomly across the graph.

Scatter plots are especially useful for identifying outliers, clusters, or trends in the data. They are commonly used in various fields such as statistics, data analysis, and scientific research to explore relationships and discover insights between two continuous variables.

Python Example

import matplotlib.pyplot as plt # Sample data x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # Values for the x-axis y = [3, 5, 2, 8, 6, 9, 4, 7, 1, 2] # Values for the y-axis # Create a scatter plot plt.scatter(x, y) # Add labels and title plt.xlabel('X-axis') plt.ylabel('Y-axis') plt.title('Scatter Plot Example') # Display the plot plt.show()

In this example, we create a scatter plot using the scatter() function from Matplotlib. We provide two lists, x and y, which represent the values for the x-axis and y-axis, respectively. The scatter() function plots the data points on the graph.

We then add labels to the x-axis and y-axis using xlabel() and ylabel() functions, respectively. Finally, we set a title for the plot using the title() function.

To display the scatter plot, we use show() function. When you run this code, a window will appear showing the scatter plot with the provided data points.

Scatter Plot result