Why does the highest expression plotted with most negative density? Disagreement between FeaturePlot vs plot_density
Opened this issue · 7 comments
Hi there,
Thanks for a great tool.
I plot the joint density of a vector of genes that were scored using AddModuleScore.
When I plotted this score for each cell using FeaturePlot and plot_density. The results are entirely opposite of each other. Would you mind helping me to correct this?
Thank you again.
With FeaturePlot:
With plot_density:
Hello, I'm not a developer but you can find a workaround by specifying the kernel density method to method = "wkde". Hope that helps!
Hi @denvercal1234GitHub did you solve the issue? I have the same problem
@gabsax: Have you tried @p-gueguen's suggestion of setting method = "wkde"
? It works for me.
Hi @mschili87, it partially solve the problem but the result it's not accurate. But I found it works better if in addition to setting method = "wkde"
I also transform the data:
obj$signature <- round((obj$signature + abs(min(obj$signature))) * 100)
You can view the plots in the attachment. The Featureplot accurately shows the cells expressing the signature. When visualizing the signature with Nebulosa by simply adding the argument method = "wkde"
, there are still some cells that shouldn't express it (Nebulosa 1 in the red circle). However, if you transform the data as I showed earlier, you can obtain a Nebulosa plot very comparable to the Featureplot (Nebulosa 2).
Interesting example. I guess it's the negative values that create the difference. So there are lots of cells expressing the feature but those are balanced out by a lot of others that do not express it at all. 🤔
@joseah: Any thoughts on this?