plot-methods: Plot a signal from the feature data of an imaging dataset

Description Usage Arguments Author(s) See Also Examples

Description

Create and display plots for the feature data of an imaging dataset using a formula interface.

Usage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#### Methods for Cardinal >= 2.x classes ####

## S4 method for signature 'DataFrame,ANY'
plot(x, y, ...)

## S4 method for signature 'XDataFrame,missing'
plot(x, formula,
        groups = NULL,
        superpose = FALSE,
        strip = TRUE,
        key = superpose || !is.null(groups),
        ...,
        xlab, xlim,
        ylab, ylim,
        layout,
        col = discrete.colors,
        breaks = "Sturges",
        grid = FALSE,
        jitter = FALSE,
        subset = TRUE,
        add = FALSE)

## S4 method for signature 'MassDataFrame,missing'
plot(x, ..., type = if (isCentroided(x)) "h" else "l")

## S4 method for signature 'SparseImagingExperiment,missing'
plot(x, formula,
        pixel,
        pixel.groups,
        groups = NULL,
        superpose = FALSE,
        strip = TRUE,
        key = superpose || !is.null(groups),
        fun = mean,
        hline = 0,
        ...,
        xlab, xlim,
        ylab, ylim,
        layout,
        col = discrete.colors,
        grid = FALSE,
        subset = TRUE,
        add = FALSE)

## S4 method for signature 'MSImagingExperiment,missing'
plot(x, formula,
        pixel = pixels(x, coord=coord, run=run),
        pixel.groups,
        coord,
        run,
        plusminus,
        ...,
        xlab, ylab,
        type = if ( is_centroided ) 'h' else 'l')

## S4 method for signature 'SparseImagingResult,missing'
plot(x, formula,
        model = modelData(x),
        superpose = is_matrix,
        ...,
        column,
        xlab, ylab,
        type = 'h')

## S4 method for signature 'PCA2,missing'
plot(x, formula,
    values = "loadings", ...)

## S4 method for signature 'PLS2,missing'
plot(x, formula,
    values = c("coefficients", "loadings", "weights"), ...)

## S4 method for signature 'SpatialFastmap2,missing'
plot(x, formula,
    values = "correlation", ...)

## S4 method for signature 'SpatialKMeans2,missing'
plot(x, formula,
    values = c("centers", "correlation"), ...)

## S4 method for signature 'SpatialShrunkenCentroids2,missing'
plot(x, formula,
    values = c("centers", "statistic", "sd"), ...)

## S4 method for signature 'SpatialDGMM,missing'
plot(x, model = modelData(x),
    values = "density", type = 'l', ...)

## S4 method for signature 'MeansTest,missing'
plot(x, model = modelData(x),
    values = "fixed", ...)

## S4 method for signature 'SegmentationTest,missing'
plot(x, model = modelData(x),
    values = "fixed", ...)

## S4 method for signature 'AnnotatedImage,ANY'
plot(x, breaks = "Sturges",
        key = TRUE, col,
        add = FALSE, ...)

## S4 method for signature 'AnnotatedImageList,ANY'
plot(x, i, breaks = "Sturges",
        strip = TRUE,
        key = TRUE, col,
        layout = !add,
        add = FALSE, ...)

## S4 method for signature 'AnnotatedImagingExperiment,ANY'
plot(x, i, ...)

#### Methods for Cardinal 1.x classes ####

## S4 method for signature 'SImageSet,missing'
plot(x, formula = ~ Feature,
    pixel,
    pixel.groups,
    groups = NULL,
    superpose = FALSE,
    strip = TRUE,
    key = FALSE,
    fun = mean,
    ...,
    xlab,
    xlim,
    ylab,
    ylim,
    layout,
    type = 'l',
    col = "black",
    subset = TRUE,
    lattice = FALSE)

## S4 method for signature 'MSImageSet,missing'
plot(x, formula = ~ mz,
    pixel = pixels(x, coord=coord),
    pixel.groups,
    coord,
    plusminus,
    ...,
    type = if (centroided(x)) 'h' else 'l')

## S4 method for signature 'ResultSet,missing'
plot(x, formula,
    model = pData(modelData(x)),
    pixel,
    pixel.groups,
    superpose = TRUE,
    strip = TRUE,
    key = superpose,
    ...,
    xlab,
    ylab,
    column,
    col = if (superpose) rainbow(nlevels(pixel.groups)) else "black",
    lattice = FALSE)

## S4 method for signature 'CrossValidated,missing'
plot(x, fold = 1:length(x), layout, ...)

## S4 method for signature 'PCA,missing'
plot(x, formula = substitute(mode ~ mz),
    mode = "loadings",
    type = 'h',
    ...)

## S4 method for signature 'PLS,missing'
plot(x, formula = substitute(mode ~ mz),
    mode = c("coefficients", "loadings",
        "weights", "projection"),
    type = 'h',
    ...)

## S4 method for signature 'OPLS,missing'
plot(x, formula = substitute(mode ~ mz),
    mode = c("coefficients", "loadings", "Oloadings",
        "weights", "Oweights", "projection"),
    type = 'h',
    ...)

## S4 method for signature 'SpatialFastmap,missing'
plot(x, formula = substitute(mode ~ mz),
    mode = "correlation",
    type = 'h',
    ...)

## S4 method for signature 'SpatialShrunkenCentroids,missing'
plot(x, formula = substitute(mode ~ mz),
    mode = c("centers", "tstatistics"),
    type = 'h',
    ...)

## S4 method for signature 'SpatialKMeans,missing'
plot(x, formula = substitute(mode ~ mz),
    mode = c("centers", "betweenss", "withinss"),
    type = 'h',
    ...)

Arguments

x

An imaging dataset.

formula, y

A formula of the form 'y ~ x | g1 * g2 * ...' (or equivalently, 'y ~ x | g1 + g2 + ...'), indicating a LHS 'y' (on the y-axis) versus a RHS 'x' (on the x-axis) and conditioning variables 'g1, g2, ...'.

Usually, the LHS is not supplied, and the formula is of the form '~ x | g1 * g2 * ...', and the y-axis is implicityl assumed to be the feature vectors corresponding to each pixel in the imaging dataset specified by the object 'x'. However, a variable evaluating to a feature vector, or a sequence of such variables, can also be supplied.

The RHS is evaluated in fData(x) and should provide values for the x-axis.

The conditioning variables are evaluated in pData(x). These can be specified in the formula as 'g1 * g2 * ...'. The argument 'pixel.groups' allows an alternate way to specify a single conditioning variable. Conditioning variables specified using the formula interface will always appear on separate plots. This can be combined with 'superpose = TRUE' to both overlay plots based on a conditioning variable and use conditioning variables to create separate plots.

coord

A named vector or list giving the coordinate(s) of the pixel(s) to plot.

run

A character, factor, or integer vector giving the run(s) of the pixel(s) to plot.

plusminus

If specified, a window of pixels surrounding the one given by coord will be included in the plot with fun applied over them, and this indicates the number of pixels to include on either side.

pixel

The pixel or vector of pixels for which to plot the feature vectors. This is an expression that evaluates to a logical or integer indexing vector.

pixel.groups

An alternative way to express a single conditioning variable. This is a variable or expression to be evaluated in pData(x), expected to act as a grouping variable for the pixels specified by 'pixel', typically used to distinguish different regions of the imaging data for comparison. Feature vectors from pixels in the same pixel group will have 'fun' applied over them; 'fun' will be applied to each pixel group separately, usually for averaging. If 'superpose = FALSE' then these appear on separate plots.

groups

A variable or expression to be evaluated in fData(x), expected to act as a grouping variable for the features in the feature vector(s) to be plotted, typically used to distinguish different groups of features by varying graphical parameters like color and line type. By default, if 'superpose = FALSE', these appear overlaid on the same plot.

superpose

Should feature vectors from different pixel groups specified by 'pixel.groups' be superposed on the same plot?

strip

Should strip labels indicating the plotting group be plotting along with the each panel? Passed to 'strip' in xyplot.

key

A logical, or list containing components to be used as a key for the plot. This is passed to 'key' in levelplot if 'lattice = TRUE'.

fun

A function to apply over feature vectors grouped together by 'pixel.groups'. By default, this is used for averaging over pixels.

hline

The y-value(s) for a horizontal reference line(s).

xlab

Character or expression giving the label for the x-axis.

ylab

Character or expression giving the label for the x-axis.

xlim

A numeric vector of length 2 giving the left and right limits for the x-axis.

ylim

A numeric vector of length 2 giving the lower and upper limits for the y-axis.

layout

The layout of the plots, given by a length 2 numeric as c(ncol, nrow). This is passed to levelplot if 'lattice = TRUE'. For base graphics, this defaults to one plot per page.

col

A specification for the default plotting color(s).

type

A character indicating the type of plotting.

grid

Should a grid be added to the plot?

jitter

Should a small amount of noise be added to numeric variables before plotting them?

breaks

The number of breaks when plotting a histogram.

subset

An expression that evaluates to a logical or integer indexing vector to be evaluated in fData(x).

...

Additional arguments passed to the underlying plot or xyplot functions.

i

Which data element should be plotted.

fold

What folds of the cross-validation should be plotted.

model

A vector or list specifying which fitted model to plot. If this is a vector, it should give a subset of the rows of modelData(x) to use for plotting. Otherwise, it should be a list giving the values of parameters in modelData(x).

mode

What kind of results should be plotted. This is the name of the object to plot in the ResultSet object.

values

What kind of results should be plotted. This is the name of the object to plot in the ImagingResult object. Renamed from mode to avoid ambiguity.

column

What columns of the results should be plotted. If the results are a matrix, this corresponds to the columns to be plotted, which can be indicated either by numeric index or by name.

lattice

Should lattice graphics be used to create the plot?

add

Should the method call plot.new() or be added to the current plot?

Author(s)

Kylie A. Bemis

See Also

image

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
setCardinalBPPARAM(SerialParam())

set.seed(1)
x <- simulateImage(preset=2, npeaks=10, dim=c(10,10))
m <- mz(metadata(x)$design$featureData)

plot(x, pixel=23)
plot(x, coord=c(x=3, y=3), plusminus=1)
plot(x, coord=c(x=3, y=3), groups=mz > 1000)
plot(x, coord=c(x=7, y=7), superpose=TRUE)

sm <- summarizeFeatures(x, FUN=c("mean", "sd"), as="DataFrame")

featureData(x)$mean <- sm$mean
featureData(x)$sd <- sm$sd

plot(x, mean + I(-sd) ~ mz, superpose=TRUE)

Cardinal documentation built on Nov. 8, 2020, 11:10 p.m.