make.colour.plot: Create a dot plot (X vs Y) coloured by a selected continuous...

Description Usage Arguments Author(s) References See Also Examples

View source: R/make.colour.plot.R

Description

This function allows you to create a coloured XY plot where each cell is coloured by a selected column. Typically used to plot cells on tSNE1/2 or UMAP1/2 coloured by select cellular markers or clusters, samples, groups etc.

Usage

1
make.colour.plot(dat, x.axis, y.axis, col.axis)

Arguments

dat

NO DEFAULT. data.table Input sample.

x.axis

NO DEFAULT. Character. Column for X axis.

y.axis

NO DEFAULT. Character. Column for Y axis.

col.axis

DEFAULT = NULL. If not specified, plot is coloured by density. If you provide a character name of a column (e.g. "BV605.Ly6C", "Group", "FlowSOM_metacluster" etc), then each point will be coloured by the value in that column.

col.type

DEFAULT = "continuous". Can also be "factor".

add.label

DEFAULT = FALSE. Adds labels on the plot at the centroid of each factor. Only works if col.type = "factor".

hex

DEFAULT = FALSE. Whether to split the data into bins and show the average expression of the bin.

hex.bins

DEFAULT = 30. Number of bins to split into. Only used if hex is TRUE.

colours

DEFAULT = "spectral". Only used if type = 'colour', ignored if type = 'factor'. Specify a colour scheme. Can be "jet", "spectral", "viridis", "inferno", "magma", or "BuPu".

col.min.threshold

DEFAULT = 0.01. Numeric. Define minimum threshold for colour scale. Values below this limit will be coloured as the chosen minimum threshold.

col.max.threshold

DEFAULT = 0.995 Numeric. Define maximum threshold for colour scale. Values above this limit will be coloured as the chosen maximum threshold.

align.xy.by

DEFAULT = dat. data.table Sample to use to determine minimum and maximum X and Y axis values.

align.col.by

DEFAULT = dat. data.table. Sample to use to determine minimum and maximum colour values.

title

DEFAULT = col.axis. Character. Title for the plot.

dot.size

DEFAULT = 1. Numeric. Size of the dots.

plot.width

DEFAULT = 9. Width of the ggplot when saved to disk.

plot.height

DEFAULT = 7. Height of the ggplot when saved to disk.

nudge_x

DEFAULT = 0.5. When add.label = TRUE, distance the label is shifted from the centroid point on the X axis.

nudge_y

DEFAULT = 0.5. When add.label = TRUE, distance the label is shifted from the centroid point on the Y axis.

square

DEFAULT = TRUE. Ensures the plot is saved as a square. Set to FALSE if you want a plot with different X and Y lengths.

legend.loc

DEFAULT = 'right'. By default plot legends will be on the right hand side. Can specify the legend location to "bottom" if desired, or 'none' to remove it entirely.

save.to.disk

DEFAULT = TRUE. Will save the ggplot to disk. If FALSE, will only show the ggplot.

path

DEFAULT = getwd(). The location to save your ggplot. By default, will save to current working directory. Can be overidden.

blank.axis

DEFAULT = FALSE Logical, do you want a minimalist graph?

Author(s)

Thomas M Ashhurst, thomas.ashhurst@sydney.edu.au Givanna Putri, ghar1821@uni.sydney.edu.au

References

https://sydneycytometry.org.au/spectre

See Also

https://sydneycytometry.org.au/spectre for usage instructions and vignettes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Load packages
library(Spectre)
package.check()
package.load()

# Read data
cell.dat <- Spectre::demo.umap
cell.dat <- as.data.table(cell.dat)

# Draw plot
Spectre::make.colour.plot(dat = cell.dat,
                          x.axis = "UMAP_42_X",
                          y.axis = "UMAP__42Y",
                          col.axis = "BV605.Ly6C")

sydneycytometry/Spectre documentation built on March 20, 2021, 2:15 a.m.