PyPlot and Pylot
Oddly specific Daily Mix with PyP~l~ot as artist. Let's make an electronic music inspired PyPlot of Pylot streaming numbers.
import matplotlib.pyplot as plt
from sklearn import linear_model
import numpy as np
from matplotlib.collections import LineCollection
from matplotlib.colors import ListedColormap, BoundaryNorm
The data
x = [[4*60+22], [4*60+6], [3*60+21], [5*60+25], [3*60+8]]
y = [2_762_823, 6_184_448, 4_826_424, 3_544_263, 1_249_864]
Linear regression
reg = linear_model.LinearRegression()
reg.fit(x, y)
p = np.array([[p] for p in np.linspace(3*60, 6*60, 20)])
yhat = reg.predict(p)
fig, ax = plt.subplots()
# Scatter
plt.scatter(x, y, c=y, cmap='plasma')
plt.plot(p, yhat, color="pink", linewidth=3)
plt.colorbar()
plt.ylabel('#Streams')
plt.xlabel('Duration (s)')
plt.show()