Skip to content

Conversation

@ollieeknight
Copy link

@ollieeknight ollieeknight commented Jan 24, 2026

pbmc3k <- readRDS(url("https://alserglab.wustl.edu/files/mascarade/examples/pbmc3k_seurat5.rds"))

maskTable <- generateMaskSeurat(pbmc3k)

DimPlot(pbmc3k) + NoLegend() +
  ggthemes::scale_color_tableau() +
  fancyMask(maskTable, ratio=1, cols = ggthemes::tableau_color_pal()(10))
image

@assaron
Copy link
Contributor

assaron commented Jan 24, 2026

@ollieeknight Thanks for the PR. Can you extend the changes to support more flexible setting of colors?

I left this feature as a to-do, since I couldn't easily figure out the best interface. I think it should have several modes, depending on the value of the argument (or maybe combination of arguments). Here are the things I was thinking it should (but not necessarily need to) support:

  1. Be compatible with Seurat::DimPlot, that is values that can be used as cols there should be also supported by fancyMask.
  2. Setting a fixed color, e.g. black.
  3. Providing a palette function, e.g. ggthemes::tableau_color_pal() in your case, without requiring to specify the number of colors.
  4. And a vector of colors, as you have implemented, but also possibly named?

Another consideration was that, it might better to do some decisions on the geometry level, where I think it should be possible to take the colors from previous ggplot layers, so there is no need for duplicate specification of the color.

With all of this in mind, before accepting this PR, I would like to see at least a discussion how it fits into this bigger picture, and ideally an implementation of some of the above features. If you can pull out the geometry-level support, I'll be very grateful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants