flatPlot {twoddpcr} | R Documentation

## Plot droplet amplitudes with all droplets classified as "N/A" (or a chosen class).

### Description

There are occasions where classification algorithms fail for various reasons (such as poor choice/number of centres in k-means clustering). In these cases, it may be helpful to the user if an app draws a 'flat' plot with just one colour rather than nothing at all.

If a `ddpcrWell` object is given as a parameter, plot the droplets in the well and colour them according to a given class.

If a `ddpcrPlate` object is given as a parameter, plot the droplets in all wells and colour them according to a given class.

### Usage

    flatPlot(droplets, ch1Label = "Ch1 Amplitude", ch2Label = "Ch2 Amplitude",
      classString = ddpcr$na, initialCentres = NULL, selectedCentre = NULL,
      plotLimits = list(x = c(1000, 9000), y = c(3000, 13500)))

    ## S4 method for signature 'data.frame'
    flatPlot(droplets, ch1Label = "Ch1 Amplitude",
      ch2Label = "Ch2 Amplitude", classString = ddpcr$na,
      initialCentres = NULL, selectedCentre = NULL, plotLimits = list(x =
      c(1000, 9000), y = c(3000, 13500)))

    ## S4 method for signature 'ddpcrWell'
    flatPlot(droplets, ch1Label = "Ch1 Amplitude",
      ch2Label = "Ch2 Amplitude", classString = ddpcr$na,
      initialCentres = NULL, selectedCentre = NULL, plotLimits = list(x =
      c(1000, 9000), y = c(3000, 13500)))

    ## S4 method for signature 'ddpcrPlate'
    flatPlot(droplets, ch1Label = "Ch1 Amplitude",
      ch2Label = "Ch2 Amplitude", classString = ddpcr$na,
      initialCentres = NULL, selectedCentre = NULL, plotLimits = list(x =
      c(1000, 9000), y = c(3000, 13500)))

### Arguments

`droplets` | A data frame of droplet amplitudes, or a `ddpcrWell` or `ddpcrPlate` object.
`ch1Label` | The label for the channel 1 target. Defaults to "Ch1 Amplitude".
`ch2Label` | The label for the channel 2 target. Defaults to "Ch2 Amplitude".
`classString` | The class that all droplets should be classified as. Defaults to the `ddpcr$na` ("N/A") character string.
`initialCentres` | A data frame of initial centres to plot (e.g. initial cluster centres used in the k-means). This is _not_ restricted to the class `classString` only. If `NULL`, nothing is plotted. Defaults to `NULL`.
`selectedCentre` | An initial centre to highlight. This should be either "NN", "PN", "NP" or "PP", but is _not_ restricted to the class 'classString' only. If `NULL`, nothing is highlighted. Defaults to `NULL`.
`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))`.

### Value

A ggplot object in just one colour corresponding to `classString`.

### Author(s)

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

### Examples

    ## Plot the data frame with no classification.
    aWell <- KRASdata[["E03"]]
    flatPlot(aWell)

    ## Take a ddpcrWell object that is mostly classified as "NN" and colour it
    ## as such.
    aWell <- KRASdata[["H04"]]
    emptiedWell <- aWell[aWell$Cluster == 1, ]
    emptiedWell <- ddpcrWell(well=emptiedWell)
    flatPlot(emptiedWell, classString="NN")

    ## Plotting all of a ddpcrPlate object works the same way.
    krasPlate <- ddpcrPlate(wells=KRASdata)
    flatPlot(krasPlate)

[Package twoddpcr version 1.10.0 Index]