Link Search Menu Expand Document

PLOT MODELS IN PHRAPL

You can build beautiful plots in PHRAPL. This tool is handy to help you visualize models and think about hypotheses that can be tested using your data. If you manually edit a PHRAPL model ("migrationindividual"), it is always important to plot it and make sure that parameters were correctly changed. Note that the current implementation of the plotting function does to display population growth — something to add to the wishlist.

  1. 3D plots
  2. 2D plots
  3. Save stl files and 3D print your favorite model

3D plots

The following example will guide you on how to create a 3D plot for model 22 from the migrationArray object created in example 1 of Generate a set of models.

######################
####  3D plotting   ##

setwd("/your_working_directory/")
library(phrapl)
require(rgl)

# Load a migrationArray object from github repository
load(url("https://github.com/ariadnamorales/phrapl-manual/raw/master/data/models_migrationArray/MigrationArray_3Pop_4K.allTopologies.symmMigration.rda"))
#load("MigrationArray_3Pop_4K.rda") 	## If file is stored in your working directory

# See parameters assigned to a given model (e.g. model 22)
migrationArray[[22]]

# Create a beautiful 3D plot
PlotModel(migrationArray[[22]], taxonNames=c("pop1", "pop2", "pop3")

#Save pdf
rgl.postscript("model22.pdf","pdf")

And this awesome plot will be created.

Fig. 3D plot of a model.

2D plots

PHRAPL can also create 2D plots. This function has some bugs…

#######################
####  2D plotting   ###

setwd("/your_working_directory/")
library(phrapl)

# Load a migrationArray object from github repository
load(url("https://github.com/ariadnamorales/phrapl-manual/raw/master/data/models_migrationArray/MigrationArray_3Pop_4K.allTopologies.symmMigration.rda"))
#load("MigrationArray_3Pop_4K.rda") 	## If file is stored in your working directory

# Make a publication-quality 2D plot (e.g. model 26)
pdf("2dplot_model26.pdf", width=4, height=4)      # use this function to save a pdf directly
PlotModel2D(migrationArray[[26]], taxonNames=c("pop1", "pop2", "pop3"))
dev.off()

Fig. 2D plot a model.

Save stl files and 3D print your favorite model

A statuette of your prefered model can be printed using 14 carat gold, which could be useful as a project souvenir/retirement nest egg, etc. Just follow this link.

Fig. 3D statuette in 14 carat gold.