Hi Oscar.

You need to first use paintSubTree to 'paint' each of the clades you want to label with a different state.

e.g.:

tree<-paintSubTree(tree,node=104,state="Asterid_1")
tree<-paintSubTree(tree,node=191,state="Asterid_2")

and so on.

Then you should be able to use the method="plotSimmap" and colors arguments to color each subclade differently with plotTree.wBars.

If you need a function to find the common ancestor (parent node) of each subclade, you can use the function ape::getMRCA or phytools::findMRCA.

Let me know if you need more help. Liam


Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 2/5/2017 9:07 PM, Oscar Valverde wrote:
Hi everyone

I am trying to paint different clades in a tree with a set of values on
the tips. I used the function plotTree.wBars to plot and color the bars,
and used node labels to define important clades in my study. However,
for publication, the reviewers want me to remove the labels and use
colors instead to separate clades. However, I still could not figure out
how to do this from the plotTree.wBars function (tried the
method="plotSimmap", but I get an error

Error in plotSimmap(tree, type = "fan", ftype = if (tip.labels) "i" else
"off")

Attached an example of the tree I submitted so far. Any advice will be
greatly appreciated.


Oscar Valverde
Post Doctorate Associate
International Center on Tropical Botany
Florida International University

‘Anything else you’re interested in is not going to happen if you can’t
breathe the air and drink the water. Don’t sit this one out. Do
something. You are by accident of fate alive at an absolutely critical
moment in the history of our planet.’ ~Carl Sagan

On Fri, Jan 13, 2017 at 11:32 PM, Liam J. Revell <liam.rev...@umb.edu
<mailto:liam.rev...@umb.edu>> wrote:

    Hi Katharine.

    You can try to search my blog for examples of the function
    add.simmap.legend. That might do what you want.

    All the best, Liam

    Liam J. Revell, Associate Professor of Biology
    University of Massachusetts Boston
    web: http://faculty.umb.edu/liam.revell/
    <http://faculty.umb.edu/liam.revell/>
    email: liam.rev...@umb.edu <mailto:liam.rev...@umb.edu>
    blog: http://blog.phytools.org

    On 1/13/2017 10:57 AM, Katharine Walter wrote:

        Hi,

        I am trying to visualize a few different character traits on a
        tree using
        phytools. My tiplabels are colored by sampling location and I'd
        like to add
        alongside the tree a color bar that represents values of a discrete
        character trait (bacterial serotypes) for each tip sample. There
        is a nice
        explanation for how to do this for a continuous trait (
        
http://blog.phytools.org/2014/03/putting-barplot-next-to-plotted-tree.html
        
<http://blog.phytools.org/2014/03/putting-barplot-next-to-plotted-tree.html>)
        and I'm wondering a way to visualize a discrete trait instead.

        Thank you for your help!

                [[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
        <https://stat.ethz.ch/mailman/listinfo/r-sig-phylo>
        Searchable archive at
        http://www.mail-archive.com/r-sig-phylo@r-project.org/
        <http://www.mail-archive.com/r-sig-phylo@r-project.org/>


    _______________________________________________
    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
    <https://stat.ethz.ch/mailman/listinfo/r-sig-phylo>
    Searchable archive at
    http://www.mail-archive.com/r-sig-phylo@r-project.org/
    <http://www.mail-archive.com/r-sig-phylo@r-project.org/>




_______________________________________________
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 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/

Reply via email to