cole-trapnell-lab / monocle3

Other
327 stars 101 forks source link

Plot continuous features from colData(cds) using plot_genes_in_pseudotime #312

Closed npervola closed 4 years ago

npervola commented 4 years ago

Hello,

I am running an analysis and would like to visualize some variables/features that are currently stored in my colData through pseudotime using plot_genes_in_pseudotime(). These variables of interest are continuous, and should lend themselves well to being visualized in this fashion. I have made several attempts at reformatting the cds object to allow for this, but the checks in the plotting function are catching issues and it will not plot. I know the plot_cells function can already do something similar, and it would be great to have the same functionality in the other plots available. Any help would be appreciated.

hpliner commented 4 years ago

If you are looking to plot variables outside of the monocle3 workflow, I recommend exploring ggplot2 - most of our plotting functions are based on ggplot2, so the aesthetics will be similar. Off the top of my head, something like

library(ggplot2)
new_df <- data.frame(pseudotime = pseudotime(cds), new_var = colData(cds)$new_var)

ggplot(aes(pseudotime, new_var), data = new_df) + geom_point()

Lots of great info about ggplot available on their website https://ggplot2.tidyverse.org/