Adding trend line to scatter plot?

Hi all,

Is there an easy way to add a trend line to scanpy scatterplot? I’m trying to visualize gene of interest over the time-course of experiments.


It’s matplotlib, so it’s probably doable, but it might be easier to use seaborn directly for something like this. So something like:

import scanpy as sc, seaborn as sns

df = sc.get.obs_df(adata, [gene_of_interest, "condition", "time"])
sns.lmplot(x="time", y= gene_of_interest, hue="condition", data= df)

But other linear model plotting functions from seaborn could be useful here too

1 Like