facetPlot {twoddpcr} | R Documentation

## Draw each of the individual wells in a ddPCR experiment.

### Description

Plot each of the wells in a `ddpcrPlate` object or a large data frame of droplets. By default, a density plot is returned for speed purposes.

### Usage

    facetPlot(
      droplets,
      ch1Label = "Ch1 Amplitude",
      ch2Label = "Ch2 Amplitude",
      cMethod = NULL,
      binwidth = 100,
      pointSize = 0.1,
      plotLimits = list(x = c(1000, 9000), y = c(3000, 13500)),
      showEmptyWells = FALSE
    )

    ## S4 method for signature 'data.frame'
    facetPlot(
      droplets,
      ch1Label = "Ch1 Amplitude",
      ch2Label = "Ch2 Amplitude",
      cMethod = NULL,
      binwidth = 100,
      pointSize = 0.1,
      plotLimits = list(x = c(1000, 9000), y = c(3000, 13500)),
      showEmptyWells = FALSE
    )

    ## S4 method for signature 'ddpcrPlate'
    facetPlot(
      droplets,
      ch1Label = "Ch1 Amplitude",
      ch2Label = "Ch2 Amplitude",
      cMethod = NULL,
      binwidth = 100,
      pointSize = 0.1,
      plotLimits = list(x = c(1000, 9000), y = c(3000, 13500)),
      showEmptyWells = FALSE
    )

### Arguments

`droplets` | A `ddpcrPlate` object or a data frame of droplet amplitudes with a "Well" column.
`ch1Label` | The label for the channel 1 target. Defaults to "Ch1 Amplitude".
`ch2Label` | The label for the channel 2 target. Defaults to "Ch2 Amplitude".
`cMethod` | This should be the name or column number of `droplets` corresponding to the classification to be plotted. This column should only have entries in "NN", "PN", "NP, "PP", "Rain" and "N/A". If "None", plots the droplets with all of them classified as `N/A`. If `NULL`, a density plot is plotted. Defaults to `NULL`.
`binwidth` | The width of each hexagonal bin in the density plot. Ignored if `cMethod` is not `NULL` (see `pointSize` instead). Defaults to 100.
`pointSize` | If `cMethod` is not `NULL`, this is the size to draw each droplet. Otherwise this parameter is ignored (see `binwidth` instead). Defaults to 0.1.
`plotLimits` | A list of 2-element vectors with names `x` and `y`. These are used to fix the x and y limits of the plot, which is especially useful for comparing plots. Defaults to `list(x=c(1000, 9000), y=c(3000, 13500))`.
`showEmptyWells` | If `TRUE`, plots a `facet_grid` of all the wells in the plate, including the empty ones. If `FALSE`, plots a `facet_wrap` of only the loaded (nonempty) wells. Defaults to `FALSE`.

### Value

A collection of plots as a `ggplot` object.

### Author(s)

Anthony Chiu, anthony.chiu@cruk.manchester.ac.uk

### References

The nice log-scaled palette was achieved using http://www.everydayanalytics.ca/2014/09/5-ways-to-do-2d-histograms-in-r.html

### See Also

By default, each subplot uses the same plotting style as `heatPlot`.

### Examples

    ## Plot a facet wrap of density plots of each well.
    krasPlate <- ddpcrPlate(wells=KRASdata)
    facetPlot(krasPlate)

[Package twoddpcr version 1.12.0 Index]