Closed Pedramto89 closed 1 year ago
Hi @Pedramto89,
You are on the right track! You just need to adjust some of the plotting parameters. For instance, for vizAllTopics()
, try setting the parameter lwd
to something really small, like lwd=0.01
. This basically controls the thickness of the circle stroke. My guess is that it is too thick for your specific plot and so all you are seeing are the outer gray circle strokes and not the inside of the scatterpies. As for the VizTopic()
plots, you probably need to set the size of the points to be smaller using the parameter size
. I would recommend the same for the vizGeneCounts()
. Also, in general, I would increase the dimensions of the plots you are rendering. If you are outputting them as pdfs using ggplot2::ggsave()
, then increase the width
and height
parameters. If you are visualizing them in RStudio in an RMarkdown, you can increase the size of the inline plots using
{r fig.width=24, fig.height=12}
for example.
Hope this helps, Brendan
Thank you @bmill3r for your prompt response!
I made the change for lwd=0.01 but nothing changed and I got the same result, an image with no deconvolved cell type. Also, tried to add ggsave but got an error with this code:
`plt <- vizAllTopics(theta = deconProp, pos = pos, r = 45, lwd = 0.01, showLegend = TRUE, plotTitle = NA) + ggplot2::guides(fill=ggplot2::guide_legend(ncol=2)) +
ggplot2::geom_rect(data = data.frame(pos), ggplot2::aes(xmin = min(x)-90, xmax = max(x)+90, ymin = min(y)-90, ymax = max(y)+90), fill = NA, color = "black", linetype = "solid", size = 0.5) +
ggplot2::theme( plot.background = ggplot2::element_blank() ) +
ggplot2::guides(colour = "none") + ggplot2::ggsave(plt,width = 24,height = 12,device = NULL)`
Error in
ggplot2::ggsave(): !
device` must be "NULL", a string or a function.Backtrace:
Hi @Pedramto89,
Perhaps lwd=0.01
is still too large. Maybe try lwd=0.0
instead.
Also, for ggplot2::ggsave()
, check out the documentation here. Basically, device
should be something like "pdf"
. For example, given your ggplot2 object is called plt
:
ggplot2::ggsave(filename = "results.pdf",
plot = plt,
device = "pdf",
scale = 1,
width = 12,
height = 12,
units = c("in")
)
I tried to visualize with only cnaging lwd to 0.0 but got the same result, an image with no deconvolved cell type. Also, added the ggsave but got an error:
Error in
ggplot_add(): ! Can't add
ggplot2::ggsave(filename = "plt.pdf", plot = plt, device = "pdf", and
scale = 1, width = 12,
height = 12, units = c("in"))` to a Backtrace: ▆
+.gg
(...)Hi @Pedramto89,
As the error states, ggsave()
actually isn't added to a ggplot object - it is a stand alone function. You can explicitly tell it which plot to render and save with the plot
argument in the function. In this case, given that your ggplot2 object is plt
, thus plot = plt
in the function.
I'm curious to see how the rendered pdf via ggsave
looks.
Thanks and keep me posted, Brendan
I attempted to visualize some of the results but when I apply the commands, I cannot see the deconvolved cell types properly or distinctly. Also, I should mention that: 1- I get no error. Just the visualized images do not seem to be proper ones. 2- I do follow this link for my analysis: https://github.com/JEFworks-Lab/STdeconvolve/blob/devel/docs/visium_10x.md I hope I am on the right way.