Creates a scatter plot of cell positions, coloured by phenotype or cluster.
Usage
plot_cell_map(
dt,
colour_by = "phenotype",
colours = NULL,
point_size = 0.5,
title = NULL,
y_down = TRUE
)Arguments
- dt
A
data.tablewith columnsxandy.- colour_by
Character string. Column name to colour cells by. Default
"phenotype".- colours
Named character vector of colours, or
NULLfor automatic colours.- point_size
Numeric. Size of plotted points. Default
0.5.- title
Character string or
NULL. Plot title.- y_down
Logical. If
TRUE(default), y increases downward, as in image coordinates (origin at the top left; QuPath, cellspecR), so the map has the orientation of the tissue image. UseFALSEfor coordinates whose y axis points up.
Examples
dt <- data.table::data.table(
sample_id = "s1", cell_id = 1:50,
x = runif(50, 0, 500), y = runif(50, 0, 500),
phenotype = sample(c("CD3+", "CD8+", "Negative"), 50, replace = TRUE)
)
plot_cell_map(dt)