Skip to content

Instantly share code, notes, and snippets.

@jeasinema
jeasinema / smooth_plot.py
Last active February 26, 2019 08:15
Plot smooth curve like other people do
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def smooth(y, box_pts):
box_pts = max(box_pts, 1) if len(y) > box_pts else 1
box = np.ones(box_pts)/box_pts
y_smooth = np.convolve(y, box, mode='valid')
return y_smooth