-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I am trying to do a umap graph with 3 genes and I can get the color to work, but then when it has to create the legend it fails with the error:
Error in if (0 <= angle & angle < 90) { : the condition has length >
trace back info:
- rotate_just(angle, hjust, vjust)
- title_spec(label, x = x, y = y, hjust = hjust, vjust = vjust,
angle = angle, gp = gp, debug = debug, check.overlap = check.overlap) - titleGrob(label, x, y, hjust = hj, vjust = vj, angle = angle,
gp = modify_list(element_gp, gp), margin = margin, margin_x = margin_x,
margin_y = margin_y, debug = element$debug, ...) - element_grob.element_text(title.theme, label = label, angle = ang,
x = unit(pos[, 1], "cm"), y = unit(pos[, 2], "cm"), hjust = 0.5,
vjust = 0, ) - element_grob(title.theme, label = label, angle = ang, x = unit(pos[,
1], "cm"), y = unit(pos[, 2], "cm"), hjust = 0.5, vjust = 0,
) - withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning")) - suppressWarnings(element_grob(title.theme, label = label, angle = ang,
x = unit(pos[, 1], "cm"), y = unit(pos[, 2], "cm"), hjust = 0.5,
vjust = 0, )) - build_cube_titles(guide, theme, axes$params)
- guide_gengrob.colourcube(X[[i]], ...)
- FUN(X[[i]], ...)
- lapply(gdefs, guide_gengrob, theme)
- guides_gengrob(gdefs, theme)
- build_guides(plot$scales, plot$layers, plot$mapping, position,
theme, plot$guides, plot$labels) - ggplot_gtable.ggplot_built(data)
- ggplot_gtable(data)
- print.ggplot(x)
- (function (x, ...)
UseMethod("print"))(x)
If i suppress the legend with theme(legend.position='none') I can get the graph to work. Similarly if I only use two genes I can see the graph and the legend.
I made a dataframe with the umap coordinates and the SCT normalized expression for 3 genes. Tried to look at your code to figure out what was wrong with my input. I am running this on a docker image with RStudio with ggplot2 3.4.3.
Here is my code
tes<-subset(immune_combined2, features= c('Zbtb16','Gata3','Rorc'))
FD<-cbind(immune_combined2@reductions$umap@cell.embeddings,t(tes@assays$SCT$data))
FD<-data.frame(FD)
g1<-ggplot(FD, aes(x = umap_1, y = umap_2))+geom_point(aes(colour = rgb_spec(Zbtb16, Gata3, Rorc)))+theme_classic()