Basic matplotlib functions
Basic functionalities for matplotlib package
import numpy as np
import matplotlib.pyplot as plt
scatter plot:
x = np.random.normal(5.0, 1.0, 1000) # x array
y = np.random.normal(10.0, 2.0, 1000) # y array
plot 2d funcion: x^4 + 3x^3 - x^2 + 5
x = np.linspace(-1,1, 1000) # from -1 to 1 and 1000 samples total
mutiple plots using subplots plot four different functions and adjust spacing between them add title for each subplots add title for the plot function1: f(X) = x
function2: f(X) = x^2
function3: f(X) = (x-1)^2
function4: f(X) = x^3
x = np.linspace(-1,1, 1000) # from -1 to 1 and 1000 samples total
plot above functions on same plot using legend
x = np.linspace(-1,1, 1000) # from -1 to 1 and 1000 samples total
bar plots
langs = ['C', 'C++', 'Java', 'Python', 'PHP']
students = [23,17,35,29,12]
plot histogram of distribution of sepalwidth in iris dataset
import pandas as pd
dataset_path = 'https://datahub.io/machine-learning/iris/r/iris.csv'
dataframe = pd.read_csv(dataset_path)
plot image
path = 'https://matplotlib.org/stable/_images/sphx_glr_logos2_001_2_0x.png'
from skimage import io
np_image = io.imread(path)