alanocallaghan / scater

Clone of the Bioconductor repository for the scater package.
https://bioconductor.org/packages/devel/bioc/html/scater.html
94 stars 40 forks source link

plotReducedDim hex #209

Closed DarioS closed 4 months ago

DarioS commented 4 months ago

hex: Logical, whether to use geom_hex. Note that geom_hex is broken in ggplot2 version 3.4.0.

What about ggplot2 version 3.5.1? I don't see any open issues at ggplot2 Issue Tracker regarding this. But, it doesn't work for me.

alanocallaghan commented 4 months ago

Can you be in any way more specific, posting perhaps a reproducible example, expected outputs, your scater version, etc?

DarioS commented 4 months ago

I thought that it was an established issue package maintainer is tracking. Regardless, I copied and pasted example code.

library(scater)
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
example_sce <- runPCA(example_sce)
plotPCA(example_sce, hex = TRUE) # I modified the function's example code by specifying the hex parameter.

The result is identical to when hex is unspecified. I used scater version 1.32 and ggplot2 version 3.5.1 in R version 4.4.0.

alanocallaghan commented 4 months ago

plotPCA(example_sce, hex = TRUE, bins=2)

alanocallaghan commented 4 months ago

\item{bins}{Number of bins, can be different in x and y, to bin and summarize the points and their values, to avoid overplotting. If \code{NULL} (default), then the points are plotted without binning. Only used when both x and y are numeric.}

The documentation makes this clear. I guess I could change the bins argument default to be something like if (hex) 20 else NULL but I don't fancy introducing complex dependencies between function arguments at the moment. And anyways it'll bin2d it even if not hex.

I thought that it was an established issue package maintainer is tracking. Regardless, I copied and pasted example code.

The code in this repo has a pretty broad history, most of it nothing to do with me. I've been maintaining it for about 4 years since my PhD, which was in single cell data. I also maintain parts of OSCA, and a few smaller Bioc packages. I've not had a day job directly related to single cell for about 2 years, and as of 2023 my day job isn't even related to R. As such there are likely to be plenty of issues I'm not familiar with; things that may have once been an issue but were solved by somebody else years ago, etc.

Most of the time when I'm looking at issues related to these projects, I am switching from a totally different context (mainly python/groovy/Java programming in image analysis these days). It is helpful for me if I can look at an issue, immediately identify what the problem is, what the expected outcome/output is, and how the problem might have come about. Even if it seems quite obvious to you, I assure you that when I am switching from my main job to have a look at an R problem, it is usually not obvious at all.