Re: [R-sig-phylo] Plotting error edgelabels in phylogeny type=fan

2015-07-31 Thread Emmanuel Paradis

Hi Klaus.

Thanks for the fix. In ape now.

Cheers,

Emmanuel

Le 30/07/2015 22:45, Klaus Schliep a écrit :

Dear Julia,

this function should fix your problem and Emmanuel may can include it
into edgelables function:

edgeLabelsFan - function (text, edge, adj = c(0.5, 0.5), frame =
rect, pch = NULL,
   thermo = NULL, pie = NULL, piecol = NULL, col = black,
   bg = lightgreen, horiz = FALSE, width = NULL, height = NULL,
   date = NULL, ...)
{
 lastPP - get(last_plot.phylo, envir = .PlotPhyloEnv)
 if (missing(edge)) {
 sel - 1:dim(lastPP$edge)[1]
 subedge - lastPP$edge
 }
 else {
 sel - edge
 subedge - lastPP$edge[sel, , drop = FALSE]
 }
 r - sqrt(lastPP$xx^2 + lastPP$yy^2)

 XX - lastPP$xx[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
(r[subedge[,2]] * 2)
 YY - lastPP$yy[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
(r[subedge[,2]] * 2)
 if (!is.null(date))
 XX[] - max(lastPP$xx) - date
 BOTHlabels(text, sel, XX, YY, adj, frame, pch, thermo, pie,
piecol, col, bg, horiz, width, height, ...)
}




Kind regards,
Klaus





On Thu, Jul 30, 2015 at 1:10 PM, Julia Dupin julia.du...@gmail.com
mailto:julia.du...@gmail.com wrote:

Dear all,

I'm trying to plot a tree with some branches marked using
edgelabels() but
the function is misplacing the labels (it misses the actual
branches) when
I use it in a fan type tree.
Here is an example

tree-pbtree(n=10,scale=10)
plot(tree,type=fan)
edgelabels()

The phylogeny I am working on is pretty big so fan is the best
option for
me to visualize it.

Has anyone had this issue before? Is there a way to fix it? Or maybe an
alternative to edgelabels?

Thanks in advance!!

Julia

--
Julia Dupin
PhD candidate
Smith lab
Dept. Ecology and Evolutionary Biology, Ramaley Hall C127A
University of Colorado - Boulder
email: julia.du...@colorado.edu mailto:julia.du...@colorado.edu
website: http://www.colorado.edu/smithlab/

 [[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
mailto:R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at
http://www.mail-archive.com/r-sig-phylo@r-project.org/




--
Klaus Schliep
Postdoctoral Fellow
Revell Lab, University of Massachusetts Boston



___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] Plotting error edgelabels in phylogeny type=fan

2015-07-30 Thread Klaus Schliep
Dear Julia,

this function should fix your problem and Emmanuel may can include it into
edgelables function:

edgeLabelsFan - function (text, edge, adj = c(0.5, 0.5), frame = rect,
pch = NULL,
  thermo = NULL, pie = NULL, piecol = NULL, col = black,
  bg = lightgreen, horiz = FALSE, width = NULL, height = NULL,
  date = NULL, ...)
{
lastPP - get(last_plot.phylo, envir = .PlotPhyloEnv)
if (missing(edge)) {
sel - 1:dim(lastPP$edge)[1]
subedge - lastPP$edge
}
else {
sel - edge
subedge - lastPP$edge[sel, , drop = FALSE]
}
r - sqrt(lastPP$xx^2 + lastPP$yy^2)

XX - lastPP$xx[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
(r[subedge[,2]] * 2)
YY - lastPP$yy[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
(r[subedge[,2]] * 2)
if (!is.null(date))
XX[] - max(lastPP$xx) - date
BOTHlabels(text, sel, XX, YY, adj, frame, pch, thermo, pie,
   piecol, col, bg, horiz, width, height, ...)
}




Kind regards,
Klaus





On Thu, Jul 30, 2015 at 1:10 PM, Julia Dupin julia.du...@gmail.com wrote:

 Dear all,

 I'm trying to plot a tree with some branches marked using edgelabels() but
 the function is misplacing the labels (it misses the actual branches) when
 I use it in a fan type tree.
 Here is an example

 tree-pbtree(n=10,scale=10)
 plot(tree,type=fan)
 edgelabels()

 The phylogeny I am working on is pretty big so fan is the best option for
 me to visualize it.

 Has anyone had this issue before? Is there a way to fix it? Or maybe an
 alternative to edgelabels?

 Thanks in advance!!

 Julia

 --
 Julia Dupin
 PhD candidate
 Smith lab
 Dept. Ecology and Evolutionary Biology, Ramaley Hall C127A
 University of Colorado - Boulder
 email: julia.du...@colorado.edu
 website: http://www.colorado.edu/smithlab/

 [[alternative HTML version deleted]]

 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at
 http://www.mail-archive.com/r-sig-phylo@r-project.org/




-- 
Klaus Schliep
Postdoctoral Fellow
Revell Lab, University of Massachusetts Boston

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] Plotting error edgelabels in phylogeny type=fan

2015-07-30 Thread Julia Dupin
Hi Klaus,

thank you so much for your quick reply! I will give it a try. I ended up
color coding the branches using edge.color for now.
Thanks again!

Julia

On Thu, Jul 30, 2015 at 1:45 PM, Klaus Schliep klaus.schl...@gmail.com
wrote:

 Dear Julia,

 this function should fix your problem and Emmanuel may can include it into
 edgelables function:

 edgeLabelsFan - function (text, edge, adj = c(0.5, 0.5), frame = rect,
 pch = NULL,
   thermo = NULL, pie = NULL, piecol = NULL, col = black,
   bg = lightgreen, horiz = FALSE, width = NULL, height = NULL,
   date = NULL, ...)
 {
 lastPP - get(last_plot.phylo, envir = .PlotPhyloEnv)
 if (missing(edge)) {
 sel - 1:dim(lastPP$edge)[1]
 subedge - lastPP$edge
 }
 else {
 sel - edge
 subedge - lastPP$edge[sel, , drop = FALSE]
 }
 r - sqrt(lastPP$xx^2 + lastPP$yy^2)

 XX - lastPP$xx[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
 (r[subedge[,2]] * 2)
 YY - lastPP$yy[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
 (r[subedge[,2]] * 2)
 if (!is.null(date))
 XX[] - max(lastPP$xx) - date
 BOTHlabels(text, sel, XX, YY, adj, frame, pch, thermo, pie,
piecol, col, bg, horiz, width, height, ...)
 }




 Kind regards,
 Klaus





 On Thu, Jul 30, 2015 at 1:10 PM, Julia Dupin julia.du...@gmail.com
 wrote:

 Dear all,

 I'm trying to plot a tree with some branches marked using edgelabels() but
 the function is misplacing the labels (it misses the actual branches) when
 I use it in a fan type tree.
 Here is an example

 tree-pbtree(n=10,scale=10)
 plot(tree,type=fan)
 edgelabels()

 The phylogeny I am working on is pretty big so fan is the best option
 for
 me to visualize it.

 Has anyone had this issue before? Is there a way to fix it? Or maybe an
 alternative to edgelabels?

 Thanks in advance!!

 Julia

 --
 Julia Dupin
 PhD candidate
 Smith lab
 Dept. Ecology and Evolutionary Biology, Ramaley Hall C127A
 University of Colorado - Boulder
 email: julia.du...@colorado.edu
 website: http://www.colorado.edu/smithlab/

 [[alternative HTML version deleted]]

 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at
 http://www.mail-archive.com/r-sig-phylo@r-project.org/




 --
 Klaus Schliep
 Postdoctoral Fellow
 Revell Lab, University of Massachusetts Boston




-- 
Julia Dupin
PhD candidate
Smith lab
Dept. Ecology and Evolutionary Biology, Ramaley Hall C127A
University of Colorado - Boulder
email: julia.du...@colorado.edu
website: http://www.colorado.edu/smithlab/

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


[R-sig-phylo] Plotting error edgelabels in phylogeny type=fan

2015-07-30 Thread Julia Dupin
Dear all,

I'm trying to plot a tree with some branches marked using edgelabels() but
the function is misplacing the labels (it misses the actual branches) when
I use it in a fan type tree.
Here is an example

tree-pbtree(n=10,scale=10)
plot(tree,type=fan)
edgelabels()

The phylogeny I am working on is pretty big so fan is the best option for
me to visualize it.

Has anyone had this issue before? Is there a way to fix it? Or maybe an
alternative to edgelabels?

Thanks in advance!!

Julia

-- 
Julia Dupin
PhD candidate
Smith lab
Dept. Ecology and Evolutionary Biology, Ramaley Hall C127A
University of Colorado - Boulder
email: julia.du...@colorado.edu
website: http://www.colorado.edu/smithlab/

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/