Closed kaizen89 closed 3 weeks ago
Thank you for your question. In fact, the show_col2
function is part of my private package (hyc) and not included in SeuratExtend. This function is primarily used for building tutorials to showcase different color sets and is not directly involved in single-cell analysis.
If you'd like to use this function, here's the code:
show_col2 <- function(palette_list, ncol) {
library(ggplot2)
pal_mtx_list <- lapply(palette_list, function(x) {
if (length(x) < ncol) x <- x[1:ncol]
return(matrix(x, ncol = ncol))
})
facet_row <-
lapply(names(pal_mtx_list), function(x) {
rep(x, nrow(pal_mtx_list[[x]]))
}) %>% unlist
pal_mtx <- list.rbind(pal_mtx_list)
ToPlot <- melt(pal_mtx)
ToPlot$facet_row <- factor(rep(facet_row, times = ncol), levels = unique(facet_row))
p <-
ggplot(ToPlot, aes(Var2, Var1)) +
geom_tile(aes(fill = value), colour = "white", linewidth = 1) +
theme_classic()+
scale_fill_identity() + NoAxes() +
scale_y_reverse() +
theme(strip.background = element_blank(),
strip.text.y.left = element_text(angle = 0, size = 12)) +
facet_grid(rows = vars(facet_row), scales = "free", space = "free", switch = "y")
return(p)
}
Regarding the 'hyc' package, it's currently a private package, so I apologize that I can't provide installation instructions. However, it contains many single-cell analysis-related functions that are still in development. These functions will be gradually incorporated into SeuratExtend in the future, so please stay tuned for updates.
Hi, Thanks for this nice tool. I was looking through the
Visualization.Rmd
file and I couldn't use the functionshow_col2
as it is not defined. Also I couldn't find the library "hyc". Maybe it's related. Could you please clarify how to install "hyc". Thanks,