Different ways to visualize your spatial data?

Giotto provides different ways to visualize your spatial data:

1. Functions specific to a task or analysis:

2. Functions that use the spatial coordinates of each cell or spot, they usually start with spatXXX

3. Functions that use the dimension reduction coordinates of each cell or spot, they usually start with dimXXX

4. Functions for co-visualization that combine spat (2) and dim (3)

5. Both in 2D and 3D

Most functions both have a 2D and 3D version, like spatDimPlot2D and spatDimPlot3D. In those cases the spatDimPlot2D is the same as spatDimPlot. So only in case you want to plot your spatial or dimension reduction data in 3D, you need to specifically say so.

6. ways to save plot

# 1. standard R way
pl = spatPlot(mygobject, cell_color = 'cell_types')
pdf(file = 'path/to/save/to/plot.pdf')
print(pl)
dev.off()

# 2. indicate to save plot, this will save the plot according to Giotto instructions file
# If the instruction file is not provided in the beginning, it uses the defaults (e.g. working directory)
spatPlot(mygobject, cell_color = 'cell_types', save_plot = TRUE)

# 3. indicate to save plot and specifiy specific saving parameters by providing a list to save_param
# they will overrule the giotto instructions
spatPlot(mygobject, cell_color = 'cell_types', save_plot = TRUE,
         save_param = list(save_folder = 'my_subfolder', save_name = 'my_name', save_format = 'png', units = 'in'))

# 4. don't save or return plot, but just view plot
# defaults are: save_plot = F, return_plot = T and show_plot = T
# this can be changed in the instructions file or at each specific plotting function
spatPlot(mygobject, cell_color = 'cell_types', save_plot = F, return_plot = F show_plot = T)


RubD/Giotto_site documentation built on April 12, 2025, 6:46 p.m.