liamrevell / phytools

GNU General Public License v3.0
198 stars 56 forks source link

wrong scale bar size in plot.cophylo #127

Closed dvs closed 1 year ago

dvs commented 1 year ago

Hi,

I noticed that cophylo plot has slightly wrong size of its scale bars. Scale bars also depend on the fsize parameter. See the code example below. Perhaps, this discrepancy is caused by tree rescaling in phylogram function.

<----- cut here -----> library(phytools)

a <- read.tree(text = "(a:0.5,(b:0.5,c:0.5):0.5);") b <- read.tree(text = "((a:0.5,b:0.5):0.5,c:0.5);")

pdf('plot1.pdf') obj <- phytools::cophylo(a, b) plot(obj, fsize=1, scale.bar=c(1,1)) dev.off()

pdf('plot2.pdf') obj <- phytools::cophylo(a, b) plot(obj, fsize=5, scale.bar=c(1,1)) dev.off()

liamrevell commented 1 year ago

Hello @dvs. Thanks for this report. I will look into it.

liamrevell commented 1 year ago

This should now be fixed on GitHub. Unfortunately, I just submitted a phytools update to CRAN, so (unless my current submission is bounced) this fix will not be in the CRAN phytools version until the next update. Please give me a thumbs-up if fixed. Thanks for the report.