prepare_plot_params: Lower-level function for preparing the plot details step of...

View source: R/extended_geneplot.R

prepare_plot_paramsR Documentation

Lower-level function for preparing the plot details step of extended_geneplot. Prepare the colour and shape for each population, the order in which to plot the populations and the axis labels.

Description

Use after calc_geneplot_spdfs and before plot_geneplot_spdfs.

Usage

prepare_plot_params(
  logprob,
  refpopnames,
  logten = TRUE,
  colvec = NA,
  shapevec = NA,
  line_widths = NULL,
  cexpts = 1,
  orderpop = NULL,
  axispop = NULL,
  display_names = NULL,
  axis_labels = NULL,
  short_axis_labels = FALSE,
  xyrange = NULL,
  ylim_input = NULL,
  geneplot_multiplier = 3,
  mark_impute = TRUE,
  grayscale_quantiles = FALSE
)

Arguments

logprob

Log-Genotype Probabilities for individual genotypes with respect to each of the reference populations. Required for GenePlot, available as an output from calc_geneplot_spdfs.

refpopnames

Character vector of reference population names, that must match two values in the 'pop' column of dat. The SPDF methods currently only work for a pair of baseline populations, so refpopnames must be length 2.

logten

(default TRUE) Boolean, indicates whether to use base 10 for the logarithms, or base e (i.e. natural logarithms). logten=TRUE is default because it's easier to recalculate the original non-log numbers in your head when looking at the plots. Use FALSE for natural logarithms.

colvec

(Optional) Vector of colours for the populations, starting with the reference populations in the order refpopnames and followed by any included populations in the order includepopnames. The same colours are used in the GenePlot and the side plots. Colours can be specified using rgb objects, hexadecimal codes, or any of the R colour names (see http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf for a PDF of R colours).

shapevec

(Optional) Vector of shapes for the populations plotted on the central GenePlot. 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.

line_widths

(Optional) Vector of line widths for all the populations for the genetic distribution side plots. Default widths are 4. Length must be the number of reference populations plus the number of additional included populations.

cexpts

(Optional) Point size for points in the central GenePlot (default is 1).

orderpop

(Optional) Vector of names of the reference populations and include populations, to indicate the order their points should be plotted within the GenePlot. The first will be plotted first and so will appear to be "beneath" all the other populations, and the last will be plotted last and so will appear to be "above" all the the other populations. Use if you have a particular population whose individuals you are interested in and need to see on top of the rest: put this population last in orderpop. 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

(Optional) Vector of reference populations, indicating which to plot as the baseline on the x-axis and which on the y-axis. The default is that the first entry in refpopnames is plotted on the x-axis.

display_names

(default refpopnames) Use this to supply alternative display names for the populations. The refpopnames, as columns in the dataset, cannot have spaces, for example, whereas the display names can have spaces.

axis_labels

(Optional) Vector of axis labels. Defaults are constructed depending on whether the logten argument is TRUE or FALSE, and whether short_axis_labels is TRUE or FALSE.

short_axis_labels

(Optional) Default is FALSE, If TRUE, a shortened version of the default axis labels is used e.g. Log-Genotype Probability is shortened to LGP. Use this if you want to display a small plot without space for the full axis labels.

xyrange

(Optional) Numerical limits for the GenePlot axes, which also form the x-axes of the two side plots. The plot is always symmetrical, so the same limits will be used for the x and the y axes. This is to ensure that comparisons between the two reference populations are fair. The values are a range of Log-Genotype Probability values so the maximum is 0. Default is slightly wider than the range of the calculated Log-Genotype Probabilities for all individuals in the plot.

ylim_input

(Optional) Numerical limits for the y-axes of the two side plots. Has no effect on the central GenePlot. Run with the defaults first to see what the range of values is for the given populations.

geneplot_multiplier

(default 3) Ratio of width of GenePlot to sideplots. Default is 3, i.e. the GenePlot height will be three times the height of the bottom plot and the GenePlot width will be three times the width of the left-hand plot.

mark_impute

(default FALSE) Boolean, indicates whether to mark individuals with missing data using asterisks on the GenePlot.

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).


lfmcmillan/geneplot documentation built on Nov. 27, 2024, 1:35 a.m.