Description Usage Arguments Value Author(s) References
View source: R/geneplot_plots.R
Produce GenePlots of the results obtained from running calc_logprob
, or replot
the results obtained from running geneplot
.
1 2 3 4 5 6 7 8  plot_logprob(logprob_results,
plot_type = switch(as.character(length(refpopnames)), `2` = "twopop",
"manypop"), plot_bars = F, colvec = NA, shapevec = NA,
mark_impute = F, txt = "points", use_legend = T,
legend_pos = "bottomleft", xyrange = NULL, orderpop = NULL,
axispop = NULL, axis_labels = NULL, short_axis_labels = F,
grayscale_quantiles = F, dim1 = 1, dim2 = 2,
layout_already_set = F, cexpts = 1.4)

logprob_results 
A data frame containing the results of the GenePlot
calculations, as obtained by running 
plot_type 
(default NULL) Can be used to specify "twopop" or "manypop"
plots. Defaults to "twopop" for 2 reference pops (i.e. 2 pops listed in

plot_bars 
(default FALSE) Specify what type of plot to use for >2
reference populations.
FALSE (default) plots PCA of the outputs from 
colvec 
(default=grDevices::rainbow(npop, s=0.5, start=0.625, end=0.42)) Vector
of colours for plotting. The colours correspond to populations
specified in the order of 
shapevec 
Vector of shapes for the plotting points.
These are named shapes from the following list:
"Circle", "Square", "Diamond", "TriangleUp", "TriangleDown", "OpenSquare",
"OpenCircle", "OpenTriangleUp", "Plus", "Cross", "OpenDiamond",
"OpenTriangleDown", "Asterisk"
which correspond to the following pch values for R plots:
21, 22, 23, 24, 25, 0, 1, 2, 3, 4, 5, 6, 8.
Do not use the numbers, use the words, which will be automatically
converted within plot_logprob into the appropriate codes.
The elements of shapevec correspond to the populations specified in the
order of 
mark_impute 
(default FALSE) Boolean, indicates whether to mark individuals with missing data using asterisks. 
txt 
(default "points") Defines whether to plot individuals as points on
the GenePlot ( 
use_legend 
(default TRUE) Plot the legend (or FALSE for don't plot the legend). 
legend_pos 
(default "bottomleft") Define where to plot the legend,
uses the same position labels as in the 
xyrange 
(default NULL) Specify the xyrange as a vector, will be the same range for both axes. Default is slightly wider than the range of the calculated LogGenotypeProbabilities for all individuals in the plot. 
orderpop 
Specify the plotting order for the populations. E.g. if orderpop=c("Pop4", "Pop2"), then points for individuals from Pop4 will be plotted first, then individuals from Pop2 will be plotted over the top of them, etc. Default is NULL, in which case populations are plotted in order of size, so the population with the largest number of points is plotted at the bottom, and the population with the smallest number of individuals/points is plotted over the top, so as not to be obscured. 
axispop 
is used when 
axis_labels 
(default NULL) Used for plots with 2 reference pops.
Character vector, 2 elements, can be used to specify more readable axis
labels. Defaults to the 'pop' labels in 
short_axis_labels 
(default FALSE) Used for plots with 2 reference pops. FALSE (default) gives fulllength axis labels of the form "Log10 genotype probability for population Pop1" TRUE gives shortform axis labels of the form "LGP10 for population Pop1" 
grayscale_quantiles 
(default FALSE) Used for plots with 2 reference pops. FALSE (default) plots the quantile lines using colvec colours TRUE plots the quantile lines in gray (as the default colours can be quite pale, the grayscale quantile lines can be easier to see than the default coloured ones). 
dim1 
(default 1) Used for plots with more than 2 reference pops, when plot_bars=FALSE. Specifies which principal component should be plotted on xaxis. 
dim2 
(default 2) Used for plots with more than 2 reference pops, when plot_bars=FALSE. Specifies which principal component should be plotted on yaxis. 
layout_already_set 
(default=FALSE) Boolean, used for plots with more
than 2 reference pops, when plot_bars=TRUE.
Indicates whether the 
cexpts 
(default 1.4) Specify the size of the points in the plot. 
Displays the plot.
LogGenotypeProbability calculations based on the method of Rannala and Mountain (1997) as implemented in GeneClass2, updated to allow for individuals with missing data and to enable accurate calculations of quantiles of the LogGenotypeProbability distributions of the reference populations. See McMillan and Fewster (2017) for details.
McMillan, L. and Fewster, R. "Visualizations for genetic assignment analyses using the saddlepoint approximation method" (2017) Biometrics. Rannala, B., and Mountain, J. L. (1997). Detecting immigration by using multilocus genotypes. Proceedings of the National Academy of Sciences 94, 9197–9201. Piry, S., Alapetite, A., Cornuet, J.M., Paetkau, D., Baudouin, L., and Estoup, A. (2004). GENECLASS2: A software for genetic assignment and firstgeneration migrant detection. Journal of Heredity 95, 536–539.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.