dynplot icon indicating copy to clipboard operation
dynplot copied to clipboard

How to change plotting order in plot_dimred, as in Seurat?

Open erzakiev opened this issue 2 years ago • 0 comments

I want to change the plotting order in accordance to the expression level of a certain gene/set of genes: cells expressing a certain gene at a higher level are plotted on top of those expressing it at a lower level.

Because I see that with the current plotting scheme the cells with low expression are often plotted above the cells with high expression of a certain gene.

In Seurat, for instance, the plotting order can be controlled with an argument called order

Seurat::FeaturePlot(x, "feature", cols = c("grey90", viridis::inferno(10000, begin = 0, end = 1, direction = -1)), reduction = "pca", dims = c(2,3))

When order=F image

When ordering is to be done: image

For the ggplot2, the basis of our plot_dimred, I found this post and tried both answers, none worked.

Reproducible example:

library(dyno)
smol <- readRDS(url('https://drive.google.com/u/0/uc?id=1ZjMOSiF2BULWIO4A5Ki58jGDfyMEXYAF&export=download'))
plot_dimred(smol, feature_oi = 'T_signature_gene')

image

erzakiev avatar Oct 04 '23 14:10 erzakiev