library(rotl) library(pbapply) library(dplyr) groups<-c('Mammalia','Amphibia','Reptilia','Aves','Fabaceae','Brassicaceae','Asteraceae') complete_dataset <- pblapply(seq_along(groups), function(y){ res <- studies_find_trees(property="ot:ottTaxonName", value=groups[y], detailed=TRUE) treesize<-do.call(rbind,lapply(seq_len(nrow(res)), function(x){ tryCatch({ tree<-get_study(res$study_ids[x]) n<-if(class(tree)=='phylo'){ length(tree$tip.label)}else{ max(unlist(lapply(tree, function(x) length(x$tip.label)))) } cbind.data.frame(n=n, year= res$study_year[x], doi=res$study_doi[x]) }, error=function(e){}) })) }) names(complete_dataset)<-groups df3 <- dplyr::bind_rows(complete_dataset, .id = 'Lineage') df3<-df3[!df3$n >5000 ,] df3<- df3[!(df3$Lineage == 'Aves' & df3$year >2005 & log(df3$n)<2),] summary(lm(log(n)~ as.numeric(as.character(year))+Lineage, df3)) library(ggplot2) library(ggthemr) ggthemr('solarized') fig1<-ggplot(df3, aes(as.numeric(as.character(year)),log(n))) + geom_point(aes(color=Lineage), size=2)+ theme(panel.background = element_rect(colour = "black", size=0.5), axis.line = element_line(size = 0.01, linetype = "solid"))+ ylab('Number of tips (log)')+xlab('Year')+ scale_y_continuous(breaks = round(seq(min(log(df3$n)), max(log(df3$n)), by = 1.6),1))+ stat_smooth(method = "loess", se=F ,formula = y ~ x, size = 1,color='black')+ theme(legend.justification = c(0, 1), legend.position = c(0, 1), legend.box.margin=margin(c(1,5,5,5)))+ theme(legend.title=element_blank()) pdf('Fig.1.pdf',5,4) fig1 dev.off()