 # 'spline feature plots' like monocle?

Is it possible to generate plots like these from a scanpy object (perhaps using PAGA trajectory) from monocle:

The following seems to work fine:

# # sample pyplot pseudotime scatter
from scipy.interpolate import make_interp_spline, BSpline
import matplotlib.pyplot as plt
import matplotlib.colors as cl
import numpy as np
n_t = 10
n_y = 15
T_min = 0
T_max = 20
data = np.zeros((n_t*n_y,3))
times = np.linspace(T_min, T_max, num=n_t)
count = 0
count_t = 0
y_means = np.zeros(n_t)
for t in times:
y_t = np.zeros(n_y)
for y in range(n_y):
y_t[y] = np.log(np.random.poisson(lam=t)+1)
data[count,0] = t
data[count,1] = y_t[y]
cat = np.random.randint(2)
data[count,2] = cat
count += 1
y_means[count_t] = np.mean(y_t)
count_t += 1

# 300 represents number of points to make between T.min and T.max
xnew = np.linspace(times.min(), times.max(), 300)

spl = make_interp_spline(times, y_means, k=3)  # type: BSpline
power_smooth = spl(xnew)

colors = ['red','green']
fig, ax = plt.subplots()
ax.scatter(data[:,0],data[:,1],c=data[:,2],cmap=cl.ListedColormap(colors))
ax.plot(xnew, power_smooth)
ax.set_xlabel(r"$\alpha$")
ax.set_ylabel("relative expression")


### Output: 1 Like