Closed acmullen-med closed 1 month ago
Hi @acmullen-med, thanks for reporting this!
Could you share what you're running to hit this issue? I have ggplot2 3.5.1 installed and most of the trackplot stuff I run has worked ok. As a very small example, this runs fine for me and draws a legend with the expected horizontal orientation with title on top:
loops <- list(start=c(1,3), end=c(5,4), chr=c("chr1", "chr1"), score=c(1,2))
BPCells::trackplot_loop(loops, "chr1:1-6", color_by="score")
I think actually legend.title.position
was just introduced in ggplot2 3.5.0 (link), and the line you linked to appears to be talking about legend.title.align
instead.
That said, I think there is at least one change needed in BPCells which will be to bump the minimum ggplot2 version required to >= 3.5.0 in the DESCRIPTION
file.
If you could share the code you're running to hit this issue that would be helpful for me to investigate further.
-Ben
I think you can close this issue ticket. After rebuilding main it seems to be working fine. I must have had something wrong on my end. Both your toy example and my below are working fine now.
That being said, both of the plotting functions trackplot_gene() and trackplot_coverage() were giving me the above error; however, trackplot_scalebar() did not which does not call trackplot_theme(). I forked the library, removed line 26 from trackplots.R, and built the fork. The plots would render and they looked fine to me. I don't know if it was from removing the line or rebuilding.
It seems like you've taken a closer look at the ggplot2 docs than me. I agree with your assessment.
The below is what I was using as my test example when debugging.
gtfFilePath <- "/net/bbi/vol1/data/genomes_stage/zebrafish/zebrafish_rna/Danio_rerio.GRCz11.99.gtf.gz"
gene_anno <- rtracklayer::readGFF(gtfFilePath)
gene_anno$chromosome <- gene_anno$seqid
gene_anno$gene <- gene_anno$gene_id
gene_anno$transcript <- gene_anno$transcript_id
gene_anno$symbol <- gene_anno$gene_name
geneSubset <- gene_anno[gene_anno$gene_biotype == "protein_coding",]
geneSubset$feature <- geneSubset$type
geneSubset$chr <- geneSubset$seqid
geneSubset$chr <- paste0("chr",geneSubset$chr)
region <- gene_region(geneSubset, "tbx16", extend_bp = 5e4)
gene_plotTbx16 <- trackplot_gene(geneSubset, region)
gene_plotTbx16
Hello BPCells maintainers,
On line 26 of trackplots.R, the parameter legend.title.position has been deprecated in ggplot2 3.5.0: https://github.com/tidyverse/ggplot2/blob/fc62903c76d736510dbed24a36c42ef826762262/NEWS.md?plain=1#L54
When trying to use these plotting functions I receive this error:
sessionInfo:
I believe removing the legend.title.position will resolve the issue but I am not sure. When I tried to deprecate my version of ggplot2 to 3.4.0, the issue did not resolve.
Thank you for maintaining this package