make_threecolor_heatmap_ggplot: Make a ggplot heatmap object from an input matrix (3-color).

View source: R/application_visualization.R

make_threecolor_heatmap_ggplotR Documentation

Make a ggplot heatmap object from an input matrix (3-color).

Description

make_threecolor_heatmap_ggplot Make a ggplot heatmap object from an input matrix containing continuous values. Three-color scale with colors of choice. Ideal for plotting log fold change expression.

Usage

make_threecolor_heatmap_ggplot(matrix, y_name, x_name, y_axis = TRUE,x_axis = TRUE, x_axis_position = "top", legend_position = "top", low_color = "blue",mid_color = "whitesmoke", high_color = "red",mid = 0,legend_title = "score",...)

Arguments

matrix

Matrix with continuous values to plot in heatmap

y_name

Title of the y-axis

x_name

Title of the x-axis

y_axis

Should y-axis label names and titles be displayed? TRUE or FALSE. Default: TRUE.

x_axis

Should x-axis label names and titles be displayed? TRUE or FALSE. Default: TRUE.

x_axis_position

X-axis position: "top" or "bottomm"; only relevant if x_axis == TRUE. Default:"top".

legend_position

Legend position: "top", "bottom", "left", "right" or "none". Default: "top".

low_color

Color for lowest continuous value in heatmap. Color gradient will go from "whitesmoke" to this color. Default: "blue".

mid_color

Color for the "mid" value as defined by that parameter. Default: "whitesmoke".

high_color

Color for highest continuous value in heatmap. Color gradient will go from "whitesmoke" to this color. Default: "red".

mid

Continuous value that will receive the "mid_color" color. Default: 0

legend_title

Title of the legend.

...

Optional arguments passed to element_text(); used to set font type and size of axis labels and titles.

Value

A ggplot object displaying a heatmap

Examples

## Not run: 
library(dplyr)
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
ligands = list("TNF","BMP2",c("IL4","IL13"))
ligand_target_matrix = construct_ligand_target_matrix(weighted_networks, ligands, ltf_cutoff = 0.99, algorithm = "PPR", damping_factor = 0.5,ligands_as_cols = TRUE)
p = make_threecolor_heatmap_ggplot(ligand_target_matrix[1:50,] %>% t(), y_name = "ligand", x_name = "target")

## End(Not run)

saeyslab/nichenetr documentation built on April 27, 2024, 9:24 p.m.