library(magrittr)
set.seed(2020)

Quick start

ape::rtree(100, br = rpois(100, 40)) %>% ggtree::ggtree() + 
    ggcsgb::chrono_strati_arg() + 
    ggcsgb::chrono_strati_bar() + 
    ggcsgb::chrono_strati_axis() + 
    ggcsgb::chrono_strati_label()
#> Warning: `as.tbl()` is deprecated as of dplyr 1.0.0.
#> Please use `tibble::as_tibble()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> Warning: `data_frame()` is deprecated as of tibble 1.1.0.
#> Please use `tibble()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.

Store parameters

Unfortunately, you have to add chrono_strati_arg() first, which store some arguments.

p <- ape::rtree(100, br = rpois(100, 40)) %>% ggtree::ggtree() + ggcsgb::chrono_strati_arg()

Add layers

Then you can add layers like normal geom_s 1 in any combination:

p + ggcsgb::chrono_strati_bar() 

p + ggcsgb::chrono_strati_axis() 

p + ggcsgb::chrono_strati_label()

p + ggcsgb::chrono_strati_bar()   + ggcsgb::chrono_strati_axis() 

p + ggcsgb::chrono_strati_axis()  + ggcsgb::chrono_strati_label()

p + ggcsgb::chrono_strati_label() + ggcsgb::chrono_strati_bar()

p + ggcsgb::chrono_strati_bar()   + ggcsgb::chrono_strati_axis() + ggcsgb::chrono_strati_label() 


  1. Actually they aren’t, they have own parameters, and can only works with ggtree()+chrono_strati_arg().↩︎