data-visualization

About Matplotlib

import matplotlib.pyplot as plt

Matplotlib is a popular Python library that can be used to create your Data Visualizations quite easily. as plt means that we can use plt anywhere in the code in place of matplotlib.pyplot which is very long to type repeatably in the code.

Numpy

import numpy as np

NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.

Scatter Plot

Scatter plots are great for showing the relationship between two variables since you can directly see the raw distribution of the data.

def scatterplot(x_data, y_data, x_label="", y_label="", title="", color="r", yscale_log=False):
    _, ax = plt.subplots()
    ax.scatter(x_data, y_data, s = 10, color = color, alpha = 0.75)
    if yscale_log == True:
        ax.set_yscale('log')
    ax.set_title(title)
    ax.set_xlabel(x_label)
    ax.set_ylabel(y_label)
scatterplot([1,2.2,3.1,4.5],[2.3,3.8,4.6,5.9])

Built With

Share this project:

Updates