skylineplot               package:ape               R Documentation

_D_r_a_w_i_n_g _S_k_y_l_i_n_e _P_l_o_t _G_r_a_p_h_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions provide various ways to draw _skyline plot_ graphs
     on the current graphical device. Note that 'skylineplot(z, ...)'
     is simply a shortcut for 'plot(skyline(z, ...))'. The skyline plot
     itself is an estimate of effective population size through time,
     and is computed using the function 'skyline'.

_U_s_a_g_e:

     ## S3 method for class 'skyline':
     plot(x, show.years=FALSE, subst.rate, present.year, ...)
     ## S3 method for class 'skyline':
     lines(x, show.years=FALSE, subst.rate, present.year, ...)
     skylineplot(z, ...)
     skylineplot.deluxe(tree, ...)

_A_r_g_u_m_e_n_t_s:

       x: skyline plot data (i.e. an object of class '"skyline"').

       z: Either an ultrametric tree (i.e. an object of class
          '"phylo"'),  or coalescent intervals (i.e. an object of class
          '"coalescentIntervals"'), or collapsed coalescent intervals
          (i.e. an object of class '"collapsedIntervals"').

    tree: ultrametric tree (i.e. an object of class '"phylo"').

show.years: option that determines whether the time is plotted in units
          of of substitutions (default) or in years (requires
          specification of substution rate and year of present).

subst.rate: substitution rate (see option show.years).

present.year: present year (see option show.years).

     ...: further arguments to be passed on to 'skyline()' and
          'plot()'.

_D_e_t_a_i_l_s:

     See 'skyline' for more details (incl. references) about the
     skyline plot method.

_A_u_t_h_o_r(_s):

     Korbinian Strimmer (<URL:
     http://www.stat.uni-muenchen.de/~strimmer/>)

_S_e_e _A_l_s_o:

     'plot' and 'lines' for the basic plotting function in R,
     'coalescent.intervals', 'skyline'

_E_x_a_m_p_l_e_s:

     library(ape)

     # get tree
     data("hivtree.newick") # example tree in NH format
     tree.hiv <- read.tree(text = hivtree.newick) # load tree

     #### classic skyline plot
     skylineplot(tree.hiv) # shortcut

     #### plot classic and generalized skyline plots and estimate epsilon
     sk.opt <- skylineplot.deluxe(tree.hiv) 
     sk.opt$epsilon

     #### classic and generalized skyline plot ####
     sk1 <- skyline(tree.hiv)   
     sk2 <- skyline(tree.hiv, 0.0119) 

     # use years rather than substitutions as unit for the time axis
     plot(sk1, show.years=TRUE, subst.rate=0.0023, present.year = 1997, col=c(grey(.8),1))
     lines(sk2,  show.years=TRUE, subst.rate=0.0023, present.year = 1997)
     legend(.15,500, c("classic", "generalized"), col=c(grey(.8),1),lty=1)

     #### various skyline plots for different epsilons
     layout(mat= matrix(1:6,2,3,byrow=TRUE))
     ci <- coalescent.intervals(tree.hiv)
     plot(skyline(ci, 0.0));title(main="0.0")
     plot(skyline(ci, 0.007));title(main="0.007")
     plot(skyline(ci, 0.0119),col=4);title(main="0.0119")
     plot(skyline(ci, 0.02));title(main="0.02")
     plot(skyline(ci, 0.05));title(main="0.05")
     plot(skyline(ci, 0.1));title(main="0.1")
     layout(mat= matrix(1:1,1,1,byrow=TRUE))

