Skip to content

Commit

Permalink
annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jzeyl committed Mar 14, 2021
1 parent 4d3e4a1 commit 03f6c45
Show file tree
Hide file tree
Showing 19 changed files with 616 additions and 919 deletions.
Binary file modified .RData
Binary file not shown.
Binary file added .RDataTmp
Binary file not shown.
1,006 changes: 503 additions & 503 deletions .Rhistory

Large diffs are not rendered by default.

File renamed without changes.
4 changes: 2 additions & 2 deletions Load phylogeny and make CDO.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ birdtreels<-birdtree
distinctdf<-distinct(df, Binomial, .keep_all = TRUE)
distinctdforder<-arrange(distinctdf,Binomial)

#put current correct binomials on the tree, updated from t he birdtree
#put current correct binomials on the tree, updated from the birdtree
new<-cbind.data.frame(birdtreels$tip.label,distinctdf$Binomial,gsub(" ","_",distinctdf$Birdtree))
colnames(new)<-c("tiplabel","binomial","birdtree")
#View(new)
Expand All @@ -20,7 +20,7 @@ str(birdtreels$tip.label)
birdtreels$tip.label<-new$binomialordered
birdtreels$tip.label<-as.character(birdtreels$tip.label)

#make comparative data object for caper
#make comparative data object for caper's pgls function
birdCDO<-comparative.data(phy = birdtreels,data = distinctdf, #avgdf[avgdf$Category!="Terrestrial",]
names.col = Binomial,
vcv = TRUE, na.omit = FALSE,
Expand Down
44 changes: 39 additions & 5 deletions Plot PCA.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,42 @@ d<-as.data.frame(diag(pPCA$Eval)/sum(pPCA$Eval)*100)
d$PC1<-row.names(d)
d$percentexplained<-d$`diag(pPCA$Eval)/sum(pPCA$Eval) * 100`


#eigenvalue plot
p<-ggplot(d, aes(x = reorder(PC1,-percentexplained), y = percentexplained))+
geom_bar(stat = "identity")+
theme_classic()+
geom_bar(stat = "identity", col = "white")+
theme_minimal()+
xlab("Principal component")+
ylab("Percent variance \n explained")
p

#remove lavels for inset plot
p<-ggplot(d[1:6,], aes(x = reorder(PC1,-percentexplained), y = percentexplained))+
geom_bar(stat = "identity")+
theme_classic()+
xlab("")+
ylab("")+
theme(axis.text.x = element_blank(),
axis.text.x = element_text(angle = 90),
panel.background = element_blank(),
panel.grid = element_blank())
p


themejz<-function (base_size = 11, base_family = "", base_line_size = base_size/22,
base_rect_size = base_size/22)
{
theme_grey(base_size = base_size, base_family = base_family,
base_line_size = base_line_size, base_rect_size = base_rect_size) %+replace%
theme(panel.background = element_blank(), panel.border = element_rect(), panel.grid = element_line(),
panel.grid.minor = element_blank(),
strip.background = element_rect(fill = "grey85",
colour = "grey20"), legend.key = element_rect(fill = "white",
colour = NA), complete = TRUE)
}



################Make a grouping of orders that includes species with one underwater-pursuit species#####################
speciesPCAvalues$Order<-as.character(speciesPCAvalues$Order)
speciesPCAvalues$Order2<-NA
Expand Down Expand Up @@ -238,8 +267,8 @@ pPCAloadings$factor<-gsub("logHeadmassg","",pPCAloadings$factor)


loadings1<-ggplot(pPCAloadings, aes(x = PC1, y = PC2, label =factor)) +
xlab(label = "pPC1")+
ylab(label = "pPC2")+
xlab(label = "pPC1(43.4%)")+
ylab(label = "pPC2(14%)")+

#geom_point(aes(), size = 0.005) +
#geom_point(data = pPCAloadings)+
Expand All @@ -251,8 +280,13 @@ loadings1<-ggplot(pPCAloadings, aes(x = PC1, y = PC2, label =factor)) +
theme(legend.position = "bottom")
loadings1

loadings2<-loadings1 + annotation_custom(ggplotGrob(p),
xmin = 0.25, xmax = 1,
ymin = 0, ymax = 1)
loadings2

ggarrange(loadings1,plunge,divescore, order,labels = c("A","B","C","D"))
ggarrange(loadings2,plunge,divescore, order,
labels = c("A","B","C","D"))

ggsave("D:/00_Manuscripts/0Avian aquatic hearing project/___Oct 1 version/PCAOct 4_noair.pdf",width = 10, height = 10)
ggsave("D:/00_Manuscripts/0Avian aquatic hearing project/___Oct 1 version/PCAOct 4_withair.pdf",width = 10, height = 10)
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

# A_T-stats

[![DOI](https://zenodo.org/badge/313591727.svg)](https://zenodo.org/badge/latestdoi/313591727)
## 1. Data files
There are 3 data files:
>Main dataframe: "data Nov 17_.csv"
There are three data files:
>Main dataframe: "Eardata.csv"
Phylogeny: "JZ tree Prum merged hackett.tree"
Dive depth data: "Depth list.csv"

Expand Down Expand Up @@ -50,4 +50,6 @@ This runs the analysis comparing. There is a separate script for the interaural

## 7. Other plotting scripts
> "plot ecology on circular phylogeny.R" - plot ecological groupings on circular phylogeny (Fig 2), and sampling by phylogeny (Fig S2)
"Residualphylogplots.R - plotting residual plot (Fig 3)
"Residualphylogplots_a panel top.R - plotting residual plot (Fig 3)


Loading

0 comments on commit 03f6c45

Please sign in to comment.