data(nancycats)
ia(nancycats)
# Pairwise over all loci:
data(partial_clone)
res <- pair.ia(partial_clone)
plot(res, low = "black", high = "green", index = "Ia")
## Not run:
#
# # Get the indices back and plot the distributions.
# nansamp <- ia(nancycats, sample = 999, valuereturn = TRUE)
#
# plot(nansamp, index = "Ia")
# plot(nansamp, index = "rbarD")
#
# # You can also adjust the parameters for how large to display the text
# # so that it's easier to export it for publication/presentations.
# library("ggplot2")
# plot(nansamp, labsize = 5, linesize = 2) +
# theme_bw() + # adding a theme
# theme(text = element_text(size = rel(5))) + # changing text size
# theme(plot.title = element_text(size = rel(4))) + # changing title size
# ggtitle("Index of Association of nancycats") # adding a new title
#
# # Get the index for each population.
# lapply(seppop(nancycats), ia)
# # With sampling
# lapply(seppop(nancycats), ia, sample = 999)
#
# # Plot pairwise ia for all populations in a grid with cowplot
# # Set up the library and data
# library("cowplot")
# data(monpop)
# splitStrata(monpop) <- ~Tree/Year/Symptom
# setPop(monpop) <- ~Tree
#
# # Need to set up a list in which to store the plots.
# plotlist <- vector(mode = "list", length = nPop(monpop))
# names(plotlist) <- popNames(monpop)
#
# # Loop throgh the populations, calculate pairwise ia, plot, and then
# # capture the plot in the list
# for (i in popNames(monpop)){
# x <- pair.ia(monpop[pop = i], limits = c(-0.15, 1)) # subset, calculate, and plot
# plotlist[[i]] <- ggplot2::last_plot() # save the last plot
# }
#
# # Use the plot_grid function to plot.
# plot_grid(plotlist = plotlist, labels = paste("Tree", popNames(monpop)))
#
# ## End(Not run)
Run the code above in your browser using DataLab