plot_geneplot_spdfs: Lower-level function for carrying out the plotting step of...

View source: R/extended_geneplot.R

plot_geneplot_spdfsR Documentation

Lower-level function for carrying out the plotting step of extended_geneplot.

Description

Use after running calc_geneplot_spdfs to produce logprob, spdf_vals1 and spdf_vals2 and prepare_plot_params to set up the plotting details.

Usage

plot_geneplot_spdfs(
  logprob,
  spdf_vals1,
  spdf_vals2,
  plot_params,
  show_overlap_areas = TRUE,
  show_legend = TRUE,
  show_legend_below = TRUE,
  show_title = TRUE,
  title_text = NULL,
  show_quantiles = TRUE,
  only_plot_baseline_pop = FALSE,
  legend_width = 4,
  show_include_ids = 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.

spdf_vals1

Genetic Distributions with first reference population as the baseline population. Required for the auxiliary side plots, available as an output from calc_geneplot_spdfs.

spdf_vals2

Genetic Distributions with second reference population as the baseline population. Required for the auxiliary side plots, available as an output from calc_geneplot_spdfs.

plot_params

Plotting options and settings, output from prepare_plot_params. List includes allpopnames, logten, split_dat, colvec, shapevec, rimvec, orderpop, axispop, line_widths, cexpts, mark_impute, xyrange, ylim_input, display_names, x_lgp_label, y_lgp_label, grayscale_quantiles.

show_overlap_areas

(default FALSE) If TRUE, print the numerical Overlap Area values beneath the extended plot.

show_legend

(default TRUE) If TRUE, plot the legend.

show_legend_below

(default TRUE) If TRUE, show the legend as a row of coloured shapes and labels below the extended plot. If FALSE, show the legend within the GenePlot. Default is TRUE because putting the legend inside the central GenePlot can hide points from individual genotypes.

show_title

(default TRUE) Include a title for the plot.

title_text

(Optional) Provide alternative title text for the plot.

show_quantiles

(default TRUE) If TRUE, plot quantiles of each baseline population in the side plots.

only_plot_baseline_pop

(default FALSE) Plot the baseline population in each side plot i.e. the corresponding reference population, and do not plot the comparison population.

legend_width

(default 4cm) Change the width of the displayed legend. Units are cm.

show_include_ids

(default FALSE) Ignored unless includepopnames is supplied. If TRUE, plots individual genotypes from the additional included pops as points but also displays the ID for each genotype. This can be useful if one or more genotype shows unusual patterns of fit to the reference populations and you want to identify those genotypes.

Value

A list with the following components:

allpopnames Vector of populations included in the plot, starting with the reference populations followed by the included populations.

logten Whether the log scales in the plot are base 10 (default) or base e.

split_dat The Log-Genotype Probabilities for the supplied genotypes, split up into a list of data frames, with each data frame corresponding to the genotypes from a single named population and containing their Log-Genotype Probabilities with respect to both of the reference populations.

colvec, shapevec, rimvec Details of the colours and shapes used for the populations, and the outline colours for the GenePlot points

orderpop, axispop Order in which the populations were plotted in the central GenePlot, from back to front, and the x-y order of the two reference pops.

line_widths Line widths used in the side plot saddlepoint distribution curves.

cexpts Point sizes used in the central GenePlot.

mark_impute, xyrange, ylim_input, display_names Records the input options used to produce the plot.

x_lgp_label, y_lgp_label Full axis labels used in the plot.

grayscale_quantiles Whether the quantiles are plotted in grey or using the assigned population colours.


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