Skip to contents

Function for density plots for features for multiple modalities at the spatial in situ level

Usage

spatInSituPlotDensity(
  gobject,
  feats = NULL,
  feat_type = "rna",
  sdimx = "x",
  sdimy = "y",
  alpha = 0.95,
  show_polygon = TRUE,
  polygon_feat_type = "cell",
  polygon_color = "black",
  polygon_fill = NULL,
  polygon_fill_as_factor = NULL,
  polygon_alpha = 0.5,
  polygon_size = deprecated(),
  polygon_line_size = 0.5,
  coord_fix_ratio = 1,
  axis_text = 8,
  axis_title = 8,
  legend_text = 6,
  background_color = "black",
  cow_n_col = NULL,
  cow_rel_h = 1,
  cow_rel_w = 1,
  cow_align = "h",
  show_plot = NULL,
  return_plot = NULL,
  save_plot = NULL,
  save_param = list(),
  default_save_name = "spatInSituPlotDensity"
)

Arguments

gobject

giotto object

feats

features to plot

feat_type

feature types of the feats

sdimx

spatial dimension x

sdimy

spatial dimension y

alpha

alpha of density plot

show_polygon

overlay polygon information (e.g. cell shape)

polygon_feat_type

feature type associated with polygon information

polygon_color

color for polygon border. Set NA to remove border

polygon_fill

character. what to color to fill polgyons by (e.g. metadata col or spatial enrichment col)

polygon_fill_as_factor

is fill color a factor

polygon_alpha

alpha of polygon

polygon_size

deprecated

polygon_line_size

line width of the polygon's outline

coord_fix_ratio

fix ratio between x and y-axis

axis_text

axis text size

axis_title

title text size

legend_text

legend text size

background_color

background color

cow_n_col

cowplot param: how many columns

cow_rel_h

cowplot param: relative heights of rows (e.g. c(1,2))

cow_rel_w

cowplot param: relative widths of columns (e.g. c(1,2))

cow_align

cowplot param: how to align

show_plot

logical. show plot

return_plot

logical. return ggplot object

save_plot

logical. save the plot

save_param

list of saving parameters, see showSaveParameters

default_save_name

default save name for saving, don't change, change save_name in save_param

Value

ggplot

Details

TODO

See also

Other In Situ visualizations: spatInSituPlotHex(), spatInSituPlotPoints()

Examples

g <- GiottoData::loadGiottoMini("vizgen")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> /home/runner/work/_temp/Library/GiottoData/Mini_datasets/Vizgen/VizgenObject/Features/rna_feature_spatVector.shp
#> rna
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> aggregate_spatInfo_spatVector.shp z0_spatInfo_spatVector.shp
#>  z1_spatInfo_spatVector.shp
#> aggregate
#> z0
#> z1
#> 
#> 3.2 read Giotto spatial centroid information
#> aggregate
#> z0
#> z1
#> 
#> 3.3 read Giotto spatial overlap information
#> rna_aggregate_spatInfo_spatVectorOverlaps.shp
#>  rna_z0_spatInfo_spatVectorOverlaps.shp rna_z1_spatInfo_spatVectorOverlaps.shp
#> poly_ID feat_ID feat_ID_uniq stack
#> aggregate and rna
#> poly_ID feat_ID feat_ID_uniq
#> z0 and rna
#> poly_ID feat_ID feat_ID_uniq
#> z1 and rna
#> 
#> 4. read Giotto image information
#> 
#> no external python path or giotto
#>  environment was specified, will check if a
#>  default python path is available
#> 
#> A default python path was found: /usr/bin/python3 and will be used
#>  If this is not the correct python path, either
#> 
#> 1. use installGiottoEnvironment() to install
#>  a local miniconda python environment along with required modules
#> 
#> 2. provide an existing python path to
#>  python_path to use your own python path which has all modules
#>  installed
#> Set options("giotto.use_conda" = FALSE) if
#>  python functionalities are not needed
spatInSituPlotDensity(g, feats = c("Mlc1", "Gprc5b", "Gfap"),
polygon_feat_type = "z0")