This is a bug & it is apparently here:

if (is.character(alp))
        tmp <- max(xx.tips) * 1.5

This line tells R to give 50% of the total tree height (or 1/3 of the plotting width) for labels if optimization of the amount of space to leave for labels fails (which makes is.character(alp) evaluate to TRUE); however that optimization is irrelevant if no labels are to be plotted!

If this were changed to:

if (is.character(alp)&&show.tip.label)
        tmp <- max(xx.tips) * 1.5

then the correct function appears to be restored.

All the best, Liam

Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: [email protected]
blog: http://blog.phytools.org

On 6/18/2015 1:04 PM, David Bapst wrote:
Hi all,

I was plotting some trees with obscenely long taxon names (long story)
and found an odd plotting artifact that leaves white-space when
show.tip.labels=FALSE, as if the plot was trying make room for the
extraordinarily long tip labels, even though they wouldn't be plotted.
I'm using R version 3.2.0 and ape 3.3.

Here's some reproducible code:

##################################

library(ape)
tree<-rcoal(1000)

tree1<-tree
tree1$tip.label<-paste0("a_really_long_obnoxious_very_very_long",
     "_when_is_it_going_to_end_name_are_we_there_yet_maybe",
     "okay_lets_do_this",1:1000)

tree2<-tree
tree2$tip.label<-paste0("a_long_name",1:1000)

plot(tree1, show.tip.label=FALSE)

#####################################

And we can see the plot of tree1 pushes the tips back, leaving a lot
of white space to the right. The curious thing is, plots for tree and
tree2 with its slightly longer name look identical, with the same
amount of whitespace.

##################################

plot(tree, show.tip.label=FALSE)

plot(tree2, show.tip.label=FALSE)

##################################

So there's some threshold to the length of the tip labels to produce
this white space.

For reasons not entirely clear to me, this issue inconsistently
appears when various layouts are used.

#######################################

#has it:
layout(matrix(1:4,2,2))
plot(tree,show.tip.label=FALSE)
plot(tree1,show.tip.label=FALSE)
plot(tree2,show.tip.label=FALSE)
plot(tree,show.tip.label=FALSE)

#doesn't has it
layout(1:4)
plot(tree,show.tip.label=FALSE)
plot(tree1,show.tip.label=FALSE)
plot(tree2,show.tip.label=FALSE)
plot(tree,show.tip.label=FALSE)

#######################################

Perhaps that suggests some clue to this odd behavior.

Apologies for all the emails lately!

Cheers,
-Dave


_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/

Reply via email to