Description
I modify the plot_genes_in_pseudotime function so that it can group the color of line for different cell types. Based on this, I also carry out facets of different gene. Now I want gene to group the color of facets according to its corresponding pathway. But since each gene has a different Y-axis after drawing, is there any way to set the block color of the facet?
This is my script
q <- ggplot(aes(Pseudotime, expression), data = epp) + geom_line(aes(x = Pseudotime, y = expectation, color = Celltype4), data = ep) + geom_rect( data=epp, aes(xmin=-Inf, xmax=Inf, ymin=Inf-5, ymax=Inf+5, fill=Description), alpha=0.4) + scale_color_manual(values = color_mapping) + scale_y_log10() + coord_cartesian(clip="off")+ facet_wrap(~feature_label, nrow = 7, ncol = 8, scales = "free_y") + scale_fill_manual(values = c("nuclear envelope" = "green", "nuclear speck" = "red", "focal adhesion" = "blue", "vacuolar membrane" = "black"))+ expand_limits(y = c(min_expr, 1)) + ylab("Relative Expression") + xlab("Pseudo-time")+ theme_bw()+ theme( strip.background = element_rect(fill=NA), strip.text = element_text(face="bold") ) q