Skip to contents

Draws on angle plot on top of a selected region. The plot is meant to help defining angle intervals for computing radial distances with RadialDistance.

Usage

AnglePlot(
  object,
  column_name,
  selected_group,
  radius = 0.3,
  nbreaks = 9,
  centroid_size = 8,
  image_use = NULL,
  coords_use = "raw",
  crop_area = NULL,
  pt_size = 1,
  pt_alpha = 1,
  pt_stroke = 0,
  section_number = NULL,
  label_by = NULL,
  ncol = NULL,
  colors = NULL,
  override_plot_dims = FALSE,
  drop_na = FALSE,
  ...
)

Arguments

object

An object of class Seurat

column_name

A character specifying a meta data column holding the categorical feature vector.

selected_group

A label defining a group of spots found in a column of the meta data slot specified by column_name

radius

A numeric value between 0.1 and 1 specifying the size of the "angle plot" overlaid on the spatial plot.

nbreaks

Number of intervals to cut the angles into

centroid_size

Size of the centroid spot

image_use

A character specifying image type to use.

coords_use

A character specifying coordinate type to use.

crop_area

A numeric vector of length 4 specifying a rectangular area to crop the plots by. These numbers should be within 0-1. The x-axis is goes from left=0 to right=1 and the y axis is goes from top=0 to bottom=1. The order of the values are specified as follows: crop_area = c(left, top, right, bottom). The crop area will be used on all tissue sections and cannot be set for each section individually. using crop areas of different sizes on different sections can lead to unwanted side effects as the point sizes will remain constant. In this case it is better to generate separate plots for different tissue sections.

pt_size

A numeric value specifying the point size passed to geom_point

pt_alpha

A numeric value between 0 and 1 specifying the point opacity passed to geom_point. A value of 0 will make the points completely transparent and a value of 1 will make the points completely opaque.

pt_stroke

A numeric specifying the point stroke width

section_number

An integer select a tissue section number to subset data by

label_by

A character specifying a column name in object with labels that can be used to provide a title for each subplot. This column should have 1 label per tissue section. This can be useful when you need to provide more detailed information about your tissue sections.

ncol

An integer value specifying the number of columns in the output patchwork.

colors

A character vector of colors to use for the color scale. The number of colors should match the number of labels present.

override_plot_dims

A logical specifying whether the image dimensions should be used to define the plot area. Setting override_plot_dims can be useful in situations where the tissue section only covers a small fraction of the capture area, which will create a lot of white space in the plots. The same effect can be achieved with the crop_area but the crop area is instead determined directly from the data.

drop_na

A logical specifying if NA values should be dropped

...

Arguments passed to other methods

Value

An object of class patchwork

Details

The region of interest is selected with selected_group and has to be a group of a categorical variable selected with column_name which is stored in the meta data of the input Seurat object. The selected region has to be spatially connected.

See also

Author

Ludvig Larsson

Examples

library(semla)

se_mcolon <- readRDS(system.file("extdata/mousecolon", "se_mcolon", package = "semla"))
se_mcolon <- DisconnectRegions(se_mcolon, column_name = "selection", selected_groups = "GALT")
#>  Extracting disconnected components for group 'GALT'
#>  Detecting disconnected regions for 106 spots
#> Loading required namespace: tidygraph
#>  Found 8 disconnected graph(s) in data
#>  Sorting disconnected regions by decreasing size
#>  Found 12 singletons in data
#> →   These will be labeled as 'singletons'
se_mcolon <- LoadImages(se_mcolon)
#> 
#> ── Loading H&E images ──
#> 
#>  Loading image from /private/var/folders/8r/bfm2m_q17znfk0m_8dt330tm0000gp/T/RtmpLHpYU7/temp_libpath305b1609463d/semla/extdata/mousecolon/spatial/tissue_lowres_image.jpg
#>  Scaled image from 541x600 to 400x444 pixels
#>  Saving loaded H&E images as 'rasters' in Seurat object
AnglePlot(se_mcolon, column_name = "GALT_split", selected_group = "S1_region1", pt_size = 2,
        image_use = "raw", crop_area = c(0.4, 0.5, 0.7, 0.8), radius = 0.4, nbreaks = 12)