plotSphereIntensity: Plot cell or hypersphere data

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plotSphereIntensity.R

Description

Visualize cells or hyperspheres in low-dimensional space, coloured by marker intensities or log-fold changes.

Usage

1
2
plotSphereIntensity(x, y, intensity, irange=NULL, 
    col.range=viridis(100), pch=16, ...)

Arguments

x, y

A numeric vector of coordinates for each hypersphere.

intensity

A numeric vector specifying the marker intensities for each hypersphere.

irange

A numeric vector of length 2, specifying the upper and lower bound for the intensities.

col.range

A vector of colours specifying the colour scale to be used for increasing intensity. More values represent a higher-resolution scale.

pch, ...

Additional arguments to pass to plot.

Details

Each hypersphere is represented by a point in the two-dimensional embedding, colored using the viridis colour scheme, i.e., purple (low intensity) to green (medium) to yellow (high). If irange is not NULL, extreme values in intensity will be winsorized to lie within irange. This preserves the resolution of colours for smaller changes at low intensities. Users should consider using intensityRanges to define appropriate values of irange for each marker.

Value

A plot of the low-dimensional embedding of the hypersphere locations is made on the current graphics device. A vector of colours equal to col.range is returned, containing the colour gradient used for the intensities. The vector names contain the numeric values associated with each colour. This can be used to construct a colour bar with createColorBar.

Author(s)

Aaron Lun

See Also

viridis, intensityRanges, createColorBar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Making up some coordinates.
x <- rnorm(100)
y <- rnorm(100) 

# Intensity plot and colour bar.
intensities <- rgamma(100, 2, 2)
out <- plotSphereIntensity(x, y, intensities)

plot(0,0, type="n", axes=FALSE, ylab="", xlab="", ylim=c(-1, 1), xlim=c(-1, 0.5))
createColorBar(out) 
text(-0.6, 0, srt=90, "Intensity", cex=1.2)

MarioniLab/cydar documentation built on April 20, 2021, 7:17 p.m.