Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do_DimPlot: sizes.highlight not working when raster = TRUE #22

Closed
dfernandezperez opened this issue Feb 16, 2023 · 1 comment
Closed

Comments

@dfernandezperez
Copy link

Hey there!

I was doing some plots trying to highlight specific cells when I found that, if raster = TRUE when using do_DimPlot, the sizes.highlight argument is ignored. I can change the point size of all cells using pt.size, but I can't using sizes.highlight. Here a small code to reproduce the problem:

library(Seurat)
library(tidyverse)
data("pbmc_small")

cells_to_highlight <- sample(Cells(pbmc_small), 10)

# Raster + highlight
SCpubr::do_DimPlot(
  sample = pbmc_small, 
  cells.highlight = cells_to_highlight,
  sizes.highlight = 16,
  pt.size = 8,
  raster = TRUE
) & coord_fixed()

# NO raster + highlight
SCpubr::do_DimPlot(
  sample = pbmc_small, 
  cells.highlight = cells_to_highlight,
  sizes.highlight = 4,
  pt.size = 1,
  raster = FALSE
) & coord_fixed()

Thanks a lot!!

Daniel

@enblacar
Copy link
Owner

Hi @dfernandezperez,

Thanks for using my package! And nice catch on that bug!

Luckily, it was a simple bug to solve. I just made the changes and it looks fine now to me:

p1 <- SCpubr::do_DimPlot(sample,
                         idents.highlight = "1",
                         plot.title = "Raster = F | sizes.highlight = 1")

p2 <- SCpubr::do_DimPlot(sample,
                         idents.highlight = "1",
                         sizes.highlight = 3,
                         plot.title = "Raster = F | sizes.highlight = 3")

p3 <- SCpubr::do_DimPlot(sample,
                         idents.highlight = "1",
                         raster = TRUE,
                         plot.title = "Raster = T | sizes.highlight = 1")

p4 <- SCpubr::do_DimPlot(sample,
                         idents.highlight = "1",
                         sizes.highlight = 3,
                         raster = TRUE,
                         plot.title = "Raster = T | sizes.highlight = 3")
p <- (p1 | p2) / (p3 | p4)
p

dimplot

As always, one needs to play with pt.size and sizes.highlight to get the rasterised figure to look like the non-rasterised one.

I just pushed the changes to GitHub and will roll out on the next CRAN update!
Best,
Enrique

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

No branches or pull requests

2 participants