## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", message = FALSE ) ## ----example_data------------------------------------------------------------- library(ape) library(phylobar) set.seed(1) tree <- rtree(20) samples <- matrix(rpois(100 * 20, 1), nrow = 100, ncol = 20) phylobar(samples, tree) ## ----palette_example---------------------------------------------------------- # Custom qualitative palette (as many colors as you want; repeats if needed) my_palette <- c( "#4E79A7", "#F28E2B", "#E15759", "#76B7B2", "#59A14F", "#EDC948" ) phylobar(samples, tree, palette = my_palette) ## ----widget_size-------------------------------------------------------------- phylobar(samples, tree, width = 800, height = 500 ) ## ----sample_label_styling----------------------------------------------------- phylobar(samples, tree, width = 800, height = 500, sample_font_size = 10, sample_label_margin = 10, # space between labels and bars sample_label_space = 100, # reserved margin for labels sample_magnify = 1.3, # how much to enlarge labels on hover sample_show_all = TRUE ) ## ----layout_ratio------------------------------------------------------------- phylobar( samples, tree, width = 800, height = 500, sample_label_space = 100, sample_magnify = 1.3, rel_width = 0.2, # narrower tree rel_height = 0.70, # shorter tree (more space for legend) rel_space = 14 # larger gap between panels ) ## ----legend_below------------------------------------------------------------- # Legend below the tree (default) phylobar( samples, tree, width = 800, height = 500, sample_label_space = 100, sample_magnify = 1.3, legend_mode = TRUE, legend_x_start = 20, # horizontal start in pixels legend_spacing = 20 # vertical spacing between legend items in pixels ) ## ----legend_inside------------------------------------------------------------ # Put labels inside the tree instead of a separate legend phylobar( samples, tree, width = 800, height = 500, sample_label_space = 100, sample_magnify = 1.3, legend_mode = FALSE, legend_x_start = 20, # horizontal start in pixels legend_spacing = 20 # vertical spacing between legend items in pixels ) ## ----hclust_no---------------------------------------------------------------- # Keep the input order as-is phylobar( samples, tree, width = 800, height = 500, sample_label_space = 100, sample_magnify = 1.3, hclust_order = FALSE ) ## ----session------------------------------------------------------------------ sessionInfo()