**60**wrote:

Hi All,

I was trying to plot a phylogeny tree along with bar plot side by side. I am using the following code. The problem is that my bar plot extend outside the right margin. Any help is appreciated. Thanks in advance.

TREE <- rcoal(10)

tip.order <- TREE$tip.label[TREE$edge[TREE$edge[, 2] <= Ntip(TREE), 2]]

tip.order

data<-matrix(seq(1:10),nrow = 10,ncol = 1,byrow = T)

rownames(data)<-apply(data,1, function(x) paste('t',x,sep = ''))

dordered<-data[tip.order,]

plot(TREE,x.lim=5)

barplot(c(NA,dordered),add=T,horiz = T,space = 0,offset = 1.4,axes = F,axisnames = F,width = 0.95,xlim = (0:10),par(pin=c(1,8)))

lab<-dordered

axis(1,lab + 1.2,label=lab,cex.axis=0.4,padj=0)

please provide a reproducible example

48kThanks. I updated the code.

60