ggheat: ggheat

View source: R/ggplots.R

ggheatR Documentation

ggheat

Description

Function to plot a heat map using ggplot.

Usage

ggheat(
  cors = NULL,
  data = NULL,
  limits = c(-1, 1),
  gradn = rev(heat.colors(10)),
  gradc = c("white", "steelblue")
)

Arguments

cors

matrix (or matrix-like object) of correlations

data

data frame of data (in progress)

limits

range of color scale in legend; see discrete_scale

gradn

vector of n colors to use, from low to high; see details

gradc

vector of length two, low color and high color; see details

gradc takes a low color and a high color, respectively, and generates a continuous scale between those colors; see scale_fill_gradient

Details

gradn takes a vector of n colors: either a list of names, a list of hexadecimal values, an existing color palette (i.e., heat.colors, rainbow, etc); see also palette, colors, the RColorBrewer package, etc.

See Also

cor, ggheat2, icorr

Examples

library('ggplot2')
tmp <- rawr::rescaler(matrix(1:25, 5))
diag(tmp) <- 1
colnames(tmp) <- rownames(tmp) <- LETTERS[1:5]
ggheat(cors = tmp, limits = c(0, 1))
ggheat(cors = tmp, gradn = NULL, gradc = c('white', 'red'))


raredd/plotr documentation built on Nov. 19, 2023, 4:09 a.m.