Skip to contents

This function generates a ggtree plot from a given concert setlists distance tree. The tree tips are colored based on either country or leg, allowing for visual differentiation of the tips in the plot.

Usage

create_ggtree_plot_colored(
  setlist_tree,
  show_info,
  color_by = c("country", "leg")
)

Arguments

setlist_tree

A concert setlists distance tree object (of class `phylo` or `hclust`) to be plotted.

show_info

A data frame containing show information, including city-date, country, and leg.

color_by

A string indicating whether to color tips by "country" or "leg". Default is "country".

Value

A `ggtree` plot object with colored tips based on the specified grouping.

Examples

library(ggtree)
# Example tree structure (replace with actual tree object)
setlist_tree <- rtree(10)  # Generate a random tree with 10 tips
show_info <- data.frame(city_date = paste("City", 1:10),
                         country = sample(c("USA", "Canada"), 10, replace = TRUE),
                         leg = sample(c("Leg 1", "Leg 2"), 10, replace = TRUE))
plot <- create_ggtree_plot_colored(setlist_tree, show_info, color_by = "country")
#> Error in element_text(size = 8): could not find function "element_text"
print(plot)
#> function (x, y, ...) 
#> UseMethod("plot")
#> <bytecode: 0x56319665baf0>
#> <environment: namespace:base>