hansenlab / tricycle

23 stars 8 forks source link

plot_emb_circle_scale() output low resolutation image #3

Closed zhenzuo2 closed 2 years ago

zhenzuo2 commented 2 years ago

Hi,

My data has about 100, 000 cells and the figure generated by plot_emb_circle_scale() is of poor image quality (huge pixels).

png(some_output_path,
    units = "in", width = 15, height = 15, res = 600)
p <- plot_emb_circle_scale(sce, dimred = "UMAP", point.size = 0.5, point.alpha = 1) +
  theme_bw(base_size = 14)
legend <- circle_scale_legend(text.size = 5, alpha = 0.9)
plot_grid(p, legend, ncol = 2, rel_widths = c(1, 0.4))
dev.off()

I am not sure if it is caused by large sample size or default raster() argument. I can attach output image if needed.

zhenzuo2 commented 2 years ago

Screenshot 2021-11-02 135154

sjczheng commented 2 years ago

Could you make a pdf file to see how it looks?

sjczheng commented 2 years ago

And have you tried changing your res values in the png function?

zhenzuo2 commented 2 years ago
pdf(path_to_save,
    width = 15, height = 15)
p <- plot_emb_circle_scale(sce, dimred = "UMAP", point.size = 0.5, point.alpha = 1) +
  theme_bw(base_size 
legend <- circle_scale_legend(text.size = 5, alpha = 0.9)
plot_grid(p, legend, ncol = 2, rel_wi
dths = c(1, 0.4))
dev.off()

It does not work. I also tried ggsave(). But none of them worked.

zhenzuo2 commented 2 years ago

Screenshot 2021-11-02 135154

And have you tried changing your res values in the png function?

res = 600 is pretty high. It usually generated 20M figures. But the png saved by plot_emb_circle_scale() is less than 1M.

sjczheng commented 2 years ago

Yes. You are right. The size of the figure is much smaller than a regular ggplot scatter plot. The reason is that I use scatter more package (https://github.com/exaexa/scattermore) to plot the points. It seems like a rater issue by scattermore package. Could you change the point.size to 1 in plot_emb_circle_scale function to test? I kind of remember there is an issue if you use point.size less than 1 in scattermore.

zhenzuo2 commented 2 years ago

Screenshot 2021-11-02 135154

zhenzuo2 commented 2 years ago

Thank you. scattermore is much faster than a regular ggplot scatter plot. Rasterization may be a problem when raster size is too large.

sjczheng commented 2 years ago

Yeah. You may need to paly a little with the figure size to make it work. It seems to me that your figure size is too big.

kasperdanielhansen commented 2 years ago

Worth sending a report to scattermore authors

Best, Kasper (Sent from my phone.)

On Nov 2, 2021, at 15:37, Shijie C. Zheng @.***> wrote:

 Closed #3.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.