library(ape)
library(warbleR)
## Loading required package: maps
## Loading required package: tuneR
## Loading required package: seewave
## Loading required package: NatureSounds
## 
## NOTE: functions are being renamed (run 'print(new_function_names)' to see new names). Both old and new names are available in this version 
##  Please see citation('warbleR') for use in publication
tre <- read.tree("~/MEGA/Phylogenies & data/1-s2.0-S1055790316303906-mmc3-Heliconiaceae-2017.nwk")

gen <- sapply(tre$tip.label, function(x) try_na(strsplit(x, "_")[[1]][1]), simplify = T, USE.NAMES = FALSE)

sp <- sapply(tre$tip.label, function(x) try_na(strsplit(x, "_")[[1]][2]), simplify = T, USE.NAMES = FALSE)


tre$tip.label <- paste(gen, sp, sep = "_")

# plot(tre, no.margin = T, type = "fan", cex = 0.7)
# plot(tre, no.margin = T, cex = 0.7)
# nodelabels()

tre2 <- extract.clade(tre, node = 225)
tre2 <- chronopl(tre2, lambda = 0.5)

tre2$tip.label <- gsub("H_", "", tre2$tip.label)

tre3 <- drop.tip(phy = tre2, tip = unique(c(which(duplicated(tre2$tip.label)), which(tre2$tip.label %in% c("sp", "x")))))

# pdf(file = "heliconia tree test.pdf", height = 20)

# plot(tre3, no.margin = T, cex = 0.6)
plot(tre3, no.margin = T, type = "fan", cex = 0.7)

# dev.off()

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.