ggpLayerSpatAnnOutline.Rd
Adds a ggplot2 layer of polygons visualizing the outline of spatial annotations.
ggpLayerSpatAnnOutline(
object,
ids = NULL,
tags = NULL,
test = "any",
alpha = 0.5,
fill = NA,
line_alpha = 0.9,
line_color = "black",
line_size = 1,
line_type = "solid",
use_colors = FALSE,
clrp = NULL,
clrp_adjust = NULL,
inner = TRUE,
incl_edge = FALSE,
merge_edge = FALSE,
incr_vert = FALSE,
expand_outline = NULL,
xrange = getCoordsRange(object)$x,
yrange = getCoordsRange(object)$y,
...
)
An object of class SPATA2
or, in case of S4 generics,
objects of classes for which a method has been defined.
Character vector or NULL
. If character, the tags for the image annotation
selection. See section Selection of spatial annotations for more information.
Character value. One of c('any'. 'all', 'identical', 'not_identical', 'none').
Specifies how input for tags
is used to select spatial annotations.
See section Selection of spatial annotations for more information.
Character value or NA. If character, specifies the color with which the outline of the spatial annotation is filled.
Numeric. Affects alpha of main lines of the plot.
Character. Affects color of the main lines of the plot.
Numeric. Affects size of the main lines of the plot.
Character. The line type. One of 'blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash' and 'twodash'.
Logical value. If TRUE
, the color aesthetic is used to display
each outline in a different color while providing a legend.
Character value. Specifies the color palette to be used to represent
groups of discrete variables. Run validColorPalettes()
to obtain valid
input options.
Named character vector or NULL. If character, it adjusts the color palette that is used to represent the groups. Names of the input vector must refer to the group and the respective named element denotes the color with which to represent the group.
Logical value. If FALSE
, only outer borders of the annotation
are displayed.
Logical value. If TRUE
, the function includes the tissue edge
(see identifyTissueOutline()
) in the visualization and removes the parts of
the outline that transgress the tissues edge.
Logical value. If incl_edge = TRUE
the outline of the
tissue edge is used to replace the part of the annotation outline that was
removed due to crossing the tissue edge.
Logical value. If TRUE
, the number of vertices of the polygon
to be plotted is increased by linear interpolation. This can lead to smoother
visualization but also to increased runtime.
Distance measure by which the outline of the area is expanded.
Distance vector of length
two or NULL
. If not NULL
, specifies the x- and y-range to which
the spatial output is cropped. E.g. xrange = c(200, 500)
results in
the two dimensional space being cropped from x-coordinate 200px up to
x-coordinate 500px. If NULL
, the original range is used.
Used to absorb deprecated arguments or functions.
ggpLayer*()
-functions return lists of ggproto
objects
that can be added to ggplots via the +
operator. In most of the cases
they are supposed to be added to plots created with the plotSurface*()
family.
Adds two additional layers to set the scales for the color- and fill aesthetic of the plot.
expand_outline
only works if inner
is FALSE (or the spatial annotation
does not contain any inner borders).
library(SPATA2)
library(patchwork)
object <- loadExampleObject("UKF275T")
object <-
createNumericAnnotations(
object = object,
variable = "HM_HYPOXIA",
threshold = "kmeans_high",
id = "hypoxia_ann",
inner_borders = FALSE,
force1 = TRUE
)
# range of hypoxia annotation
hr <- getSpatAnnRange(object, id = "hypoxia_ann")
hr_ggpL <- ggpLayerSpatAnnOutline(object, ids = "hypoxia_ann")
plotSurface(object, "HM_HYPOXIA") + hr_ggpL
p_rect <-
plotImage(object) +
hr_ggpL +
ggpLayerRect(object, xrange = hr$x, yrange = hr$y)
p_zoomed <-
plotImage(object) +
ggpLayerZoom(object, xrange = hr$x, yrange = hr$y)
p_rect + p_zoomed