# Re: [R-sig-phylo] keeping states discrete when plotting HiSSE results

```Hi, Bonnie. It's not treating binary characters as continuous, but rather
showing the uncertainty in what the state is: an intermediate color means
it's not really sure. There's substantial uncertainty with ancestral
states, and our goal was to communicate that rather than the point estimate
of whatever state is best at a time lest people over interpret it [which
reminds me to finish testing the justifiably controversial OUwie ancestral
state recon that was asked about before on R-sig-phylo]. However, the way
plot.hisse.states works is basically plotting a tree of rates and then a
narrower tree of states on top of that, so I think you could just plot a
third tree of states on top of all that. You can get the internal
reconstructions and terminal states as binary characters by doing```
```
states.tips <- hisse:::ConvertManyToBinaryState(hisse.results, "tip.mat")
states.internal <- hisse:::ConvertManyToBinaryState(hisse.results,
"node.mat")

and then use phytools to plot a tree with discrete traits using these on
top of the hisse plot. Here's the relevant code we use for plotting: you'll
want to change contMapGivenAnc to a function to give discrete change
mappings.

state.tree <- contMapGivenAnc(tree=tree.to.plot, x=states.tips, plot=FALSE,
anc.states=states.internal, lims=state.lims, ...)
state.colors <- colorRampPalette(state.colors,
space="Lab")(length(rate.tree\$cols))
state.tree\$cols[]<- state.colors
plot(state.tree, outline=FALSE, lwd=edge.width.state, legend=FALSE,
type=type, fsize=fsize, ...)

Hope this helps,
Brian

_______________________________________________________________________
Brian O'Meara, http://www.brianomeara.info, especially Calendar
<http://brianomeara.info/calendars/omeara/>, CV
<http://brianomeara.info/cv/>, and Feedback
<http://brianomeara.info/teaching/feedback/>

Associate Professor, Dept. of Ecology & Evolutionary Biology, UT Knoxville
Associate Head, Dept. of Ecology & Evolutionary Biology, UT Knoxville
Associate Director for Postdoctoral Activities, National Institute for
Mathematical & Biological Synthesis <http://www.nimbios.org> (NIMBioS)

On Tue, Jul 3, 2018 at 9:44 AM Bonnie Blaimer <bonnieblai...@gmail.com>
wrote:

> Hi all,
>
> I am using the HiSSE package and function plot.hisse.states on a list of
> several HiSSE objects to generate a heatmap phylogeny of model-averaged
> results.
>
> I'm wondering if there is a way to plot the character state reconstructions
> as being discrete changes, and if so, could someone provide guidance on
> how? The default seems to treat the binary characters as continuous and
> shows a somewhat gradual transition between the two different colors
> specified for the two states.
>
> Many thanks!
> Bonnie
>
> --
> *Bonnie B Blaimer*
> Assistant Professor
> Department of Entomology & Plant Pathology
> 3204D Gardner Hall, Campus Box 7613
> North Carolina State University
> Raleigh, NC 27695-7613
>
>         [[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/
>

[[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/
```