Skip to contents

Add point layer to SpatialData plot

Usage

plotPoint(i = 1, j = NULL, x = NULL, ...)

Arguments

i

Index or name of point to plot.

j

Index or name of coordinate transformation to use. If NULL, the coordinate transformation will be inherited from plotSpatialData().

x

SpatialData object. If NULL, the object will be inherited from plotSpatialData().

...

Optional aesthetic arguments passed to geom_sf.

Value

An object of type sd_point, which can be added to an existing ggplot.

Examples

x <- file.path("extdata", "blobs.zarr")
x <- system.file(x, package="spatialdataR")
x <- readSpatialData(x)

i <- "blobs_points"
p <- plotSpatialData(x)
p + plotPoint(i=i)                       # simple
#> Coordinate system already present.
#> ℹ Adding new coordinate system, which will replace the existing one.

p + plotPoint(i=i, colour="genes")       # discrete
#> Coordinate system already present.
#> ℹ Adding new coordinate system, which will replace the existing one.

p + plotPoint(i, colour="instance_id") # continuous
#> Coordinate system already present.
#> ℹ Adding new coordinate system, which will replace the existing one.