plot_ratio_dist: plot_ratio_dist

Description Usage Arguments Value

View source: R/plot_ratio_distances.R

Description

This function uses the output of 'calc_ratio_dist' to create summary visualizations, either summarized by the samples or sources.

Usage

1
2
plot_ratio_dist(ratio_dist_dat, plot_type = "source-mean",
  percent_cutoff = 5, sample_order = NA)

Arguments

ratio_dist_dat

The output from 'calc_ratio_dist', a list of three dataframes.

plot_type

Options for different summary plots. Options include "sample", which color codes the sources and shows top source for each sample, "source-mean" which creates a 3-paneled plot of the calculated mean Euclidean distances between samples and sources for each double ratio plot and color- codes each bar by the mean rank of that source across all samples, and "source-top" which creates a bar chart of the proportion of source-sample comparisons where each source was the closest source to a sample.

percent_cutoff

Numeric, from 0 to 100. A cutoff for plot_type = "sample", below which sources will be pooled into category "other". The percent refers to the percent of source-sample comparisons where the source was ranked as the top source by Euclidean distance in a double ratio plot space. This allows the user to bin "unimportant" sources into "other" and reduces the color complexity of the plot.

sample_order

A vector of sample IDs (that are equivalent to the IDs stored in ratio_dist_dat) in the order they are to appear when plot_type = "sample". For example, samples could be sorted from low to high PAH concentration to look for patterns in likely sources across concentration gradients.

Value

One of three plots. "sample" returns a tiled plot showing the top source by each sample (y-axis) in all three double ratio comparisons (x-axis). "source-mean" creates a bar chart with source on the x-axis and mean Euclidean distance across all samples on the y-axis. The plot is organized into three panels, with each panel representing a different double ratio comparison. "source-top" creates a bar chart with source on the x-axis and the proportion of comparisons each source was considered the top or closest source for a given sample. A proportion rather than a raw count is given because not all sources were in each double ratio comparison. The bars are colored by the number of source to sample distances that were calculated for that source.


limnoliver/pah documentation built on April 30, 2020, 2:45 p.m.