Multiple Highest value points on top of UMAP

Hi @mmccoy, I was able to graph out a Umap with the highest value points alongside the regular Umaps.

I was only able to get one though because whenever I ran the code with two I got this message.

I also got these lines highlighted but I couldn’t find any errors regarding commas or parentheses

I could just graph each gene individually with the highest point and crop them together so it isn’t too big of a deal.

Hi @Mark_Sandwich , good job. However, with complex functions like this, where you have functions embedded within other functions, it is often easier to figure out what’s going on by saving the plots individually. Then, after you know each plot works on it’s own, combine the plots with plot_grid or some other plot combining function. It’s also easier to understand when you look at it later, or when you show it to somebody else. Here’s an example:

g1 <- plotReducedDim(sce, dimred = "umap", colour_by = gene1)
gg1 <- g1 %>%
  pluck("data") %>%
  arrange(colour_by) %>%
  ggplot(aes(x = X, y = Y, col = colour_by)) +
  geom_point(alpha = 0.6) +
  theme_classic() +
  scale_color_viridis_c(name = gene) +
  xlab("UMAP1") +
  ylab("UAMP2")

g2 <- plotReducedDim(sce, dimred = "umap", colour_by = gene2)
gg2 <- g2 %>%
  pluck("data") %>%
  arrange(colour_by) %>%
  ggplot(aes(x = X, y = Y, col = colour_by)) +
  geom_point(alpha = 0.6) +
  theme_classic() +
  scale_color_viridis_c(name = gene) +
  xlab("UMAP1") +
  ylab("UAMP2")

plot_grid(
  gg1,
  gg2
)

I was able to get all 6 genes I was looking at on one plot_grid aligned to two columns by adding
ncol = 2,.
I’m wondering if it’s possible to make the images larger and not stretched? The titles for Wnt6 and Wnt10a are cropped off of the top too.

Oops, I think I sent the wrong screenshot maybe this one will work.

Hi @Mark_Sandwich , nice job. How are you saving the plot? One way to do this is to run the code in the console, then save the plot from the bottom right hand corner in Rstudio. That way you can adjust the width and height to your liking.

I just ran the code and then got an image below. I’ve tried running it in the console to do what you’re talking about but it didn’t work, maybe because of the variables?

Oh, it just finished right now and I got these messages. But no plot in the Plots tab on the right.

Sometimes you have to run it in the console twice after you’ve been plotting in the R notebook. It’s kind of a bug. Just try again one more time in the console.

Okay, I was able to get it now, thank you! :+1:

@mmccoy
My R-Studio crashed, and I can’t use Wnt1 and Wnt10b in any of my graphs. Instead of a regular Umap, I get the blanked-out ones as seen on the bottom. I also can’t run it in the console anymore either. Oh I also made no changes to the code either, so I’m pretty sure something messed up when R-Studio crashed.