API: Plotting
sc.pl.highest_expr_genes()
Boxplot show the expression of top highly-expressed genes
For every gene, their UMI percentages in every cell were caculated and then used for comparison
sc.pl.highest_expr_genes(adata=scanpy_object, n_top=20, show=True, save=None, log=False)
adata=: AnnData object used to plot
n_top=: number of top highly-expressed genes to plot
show=: if print the plot on scrren; default is "True"
save=: if save the plot; default is "None"
log=: if log the expression value; default isFalseBased on the top highly-expressed genes, one can preliminarily estimate if there is some obvious error in the data, such like high expression of mitochondrial or ribosome-protein genes
sc.pl.highest_expr_genes(adata=scanpy_object_used, n_top=5)
sc.pl.violin()
https://scanpy.readthedocs.io/en/stable/generated/scanpy.pl.violin.html#scanpy.pl.violin
Violin plot of some important features
sc.pl.violin(adata, keys=, jitter=, multi_panel=)
keys=: strings or list of strings; 指定用.var/.obs中的哪些列(变量)进行绘图
jitter=: Boolean value; if add points to the whole plot; default isTrue
multi_panel=: Boolean value; if plot in group; default isNone
sc.pl.violin(scanpy_object_used, keys=['n_genes_by_counts', 'total_counts', 'pct_counts_mt'],jitter=0.4, multi_panel=True)
sc.pl.highly_variable_genes()
Scatter plot to show the dispersion versus mean-expression of every gene
sc.pl.highly_variable_genes(scanpy_object_used)
log=: log the axis;default=False
highly_variable_genes=: highlight the highlt variable genes;default=True
sc.pl.highly_variable_genes(scanpy_object_used)
sc.pl.pca()
https://scanpy.readthedocs.io/en/stable/api/generated/scanpy.pl.pca.html
scatter plot of the PCA results
sc.pl.pca(scanpy_object, dimensions=, color=, show=)
dimensions=: dimensions used for plot
color=: feature for color
show=: if plot the figure;default=True, plot the figure rather than return for plot; for return plot, it should beFalse
sc.pl.pca(scanpy_object, dimensions=[(0,1),(2,3)], color="total_counts")
sc.pl.pca_variance_ratio()
plot show the contribution of every PC to the whole variance
sc.pl.pca_variance_ratio(adata, n_pcs=, log=)
n_pcs=: number of PCs to plot;default=30
log=: show the log value of y-axis;default=False
sc.pl.pca_variance_ratio(scanpy_object, log=True)
sc.pl.umap(scanpy_object, use_raw=False, color=['CST3', 'NKG7', 'PPBP'])
sc.pl.umap()
https://scanpy.readthedocs.io/en/stable/api/generated/scanpy.pl.umap.html#scanpy.pl.umap
plot base on UMAP results
sc.pl.umap(adata, use_raw=, layer=, color=, size=, palette=, legend_fontsize=, show=, legend_loc=)
use_raw=: use the.rawdata for plot or not;default=None, the.rawwill be used for plotting
layer=:keyin.layerused for plot;de fault=None,.Xwill be used for plot
color=: the key of.obsor.varused for color the plot
size=: size of the scatter;7is good
palette=: colors used for plot; 'Set1', 'Set2' and 'Set3' can be choosed
legend_fontsize=: 指定图例中字体大小;选择7比较合适
show=: if plot the figure;default=True, plot the figure rather than return for plot; for return plot, it should beFalse
legend_loc=: 规定legend的位置;legend_loc=None表示不绘制legend
sc.pl.umap(scanpy_object, color=['leiden'], palette='Set1')
sc.pl.umap(scanpy_object, use_raw=False, color=['CST3', 'NKG7', 'PPBP'])
sc.pl.tsne()
https://scanpy.readthedocs.io/en/stable/api/generated/scanpy.pl.tsne.html#scanpy.pl.tsne
plot base on tSNE results
sc.pl.tsne(adata, use_raw=, layer=, color=, size=, palette=, legend_fontsize=, legend_loc=, show=, color_map=)
use_raw=: use the.rawdata for plot or not;default=None, the.rawwill be used for plotting
layer=:keyin.layerused for plot;de fault=None,.Xwill be used for plot
color=: the key of.obsor.varused for color the plot
size=: size of the scatter;7is good
palette=: colors used for plot; 'Set1', 'Set2' and 'Set3' can be choosed
legend_fontsize=: 指定图例中字体大小;选择7比较合适
legend_loc=:cluster标记显示的位置;on data表示标记在图中;legend_loc=None表示不绘制legend
show=: if plot the figure;default=True, plot the figure rather than return for plot; for return plot, it should beFalse
color_map=: 当用基因表达进行配色时,改变配色方案;viridis为经典配色;viridis_r为反向经典配色,比较常用
sc.pl.tsne(integration_of_Chem_FCA_and_AD_FCA, color="data", legend_fontsize='7')
sc.pl.violin()
https://scanpy.readthedocs.io/en/stable/generated/scanpy.pl.violin.html#scanpy.pl.violin
violin plot
sc.pl.violin(adata, groupby=, keys=)
groupby=: group base on this;'leiden'
keys=: features to plot
sc.pl.violin(scanpy_object, groupby='leiden', keys=['n_genes'])
sc.pl.dotplot()
https://scanpy.readthedocs.io/en/stable/generated/scanpy.pl.dotplot.html#scanpy.pl.dotplot
dotplot
sc.pl.dotplot(adata, groupby=, var_names=, use_raw=, layer=, figsize=)
groupby=: base on what to group; 'leiden'
var_names=: features for plot
use_raw=: if use the.raw.Xfor plot;default=None, the.raw.Xwill be used if present
layer=:keyin.layerused for plotting
figsize=: size of the plot; (3, 2)
sc.pl.dotplot(scanpy_object, var_names=['TNFRSF4', 'CPSF3L', 'ATAD3C', 'C1orf86', 'RER1', 'TNFRSF25', 'TNFRSF9'], groupby='leiden')
sc.pl.stacked_violin()
stacked violin plot
sc.pl.stacked_violin(adata, groupby=, var_names=, use_raw=, layer=, figsize=)
groupby=: base on what to group; 'leiden'
var_names=: features for plot
use_raw=: if use the.raw.Xfor plot;default=None, the.raw.Xwill be used if present
layer=:keyin.layerused for plotting
figsize=: size of the plot; (3, 2)
sc.pl.stacked_violin(scanpy_object, var_names=['TNFRSF4', 'CPSF3L', 'ATAD3C', 'C1orf86', 'RER1', 'TNFRSF25', 'TNFRSF9'], groupby='leiden', figsize=(4,2))
sc.pl.scatter()
https://scanpy.readthedocs.io/en/stable/generated/scanpy.pl.scatter.html#scanpy.pl.scatter
scatter plot
sc.pl.matrixplot()
https://scanpy.readthedocs.io/en/stable/generated/scanpy.pl.matrixplot.html#scanpy.pl.matrixplot
matrix plot: Create a heatmap of the mean expression values per group of each gene.











