plotting_all_coordinates_2d: Plot all combinations of xyz coordinates in 2D

Description Usage Arguments Examples

View source: R/high_density.R

Description

Wrapper around ggplot2 to plot xyz coordinates. Plots xy, yz, and xz coordinates and merges the different plots together. It returns a list with 3 elements, each of which is a ggplot object. These can be merged with other functions, such as ggpubr

Usage

1
plotting_all_coordinates_2d(cells_df, var_to_colour = NULL, cols = NULL)

Arguments

cells_df

dataframe with xyz coordinates ("xPos", "yPos", "zPos") of the brain area of interest. Each row corresponds to a different cell.

var_to_colour

variable to use for colouring xyz coordinates. Default to NULL

cols

colours to use. Must have length equal to the levels of var_to_colour. Default to NULL

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- data.frame(
sample_id = rep(c(1:3), each = 100),
xPos = c(rnorm(100), rpois(100, 2), sample(100),
yPos = c(rnorm(100), rpois(100, 2), sample(100),
zPos = c(rnorm(100), rpois(100, 2), sample(100),
group = rep(c("a", "b", "c"), each = 100)
)
my_cols <- c("black", "green", "red")
g <- plotting_all_coordinates_2d(x, "group", my_cols)
ggpubr::ggarrange(g[[1]], g[[2]], g[[3]], nrow = 3, common.legend = TRUE, legend = "top")

valeriabonapersona/abc4d documentation built on Dec. 23, 2021, 2:09 p.m.