mk_heatmap: Create a function that draws ggplot2 heat maps.

View source: R/mk_heatmap.R

mk_heatmapR Documentation

Create a function that draws ggplot2 heat maps.

Description

mk_heatmap takes a data frame as input and returns a function that can be used to make heat maps using variables in the data frame.

Usage

mk_heatmap(df)

Arguments

df

A data frame.

Value

function(xvar, yvar, fillby, facet_by = NULL, facet_ncol = 1, palette = "C", color_direction = -1, remove_legend = FALSE, legend_title = fillby, format_legend_as_comma = FALSE, font_size = 8)

  • xvar. String, name of a categorical variable for x-axis.

  • yvar. String, name of another categorical variable for y-axis.

  • fillby. String, name of a continuous variable, and its values are used to color the tiles.

  • facet_by. String, name of a categorical variable for grouping and creating facets. Default = NULL.

  • facet_ncol. Number of columns when facetting. Default = 1. Only works when facet_by is not NULL.

  • palette. String, the colormap option to use. Possible values are "A", "B", "C" (default), "D" and "E".

  • color_direction. 1 or -1. Sets the order of colors in the scale. If 1, colors are ordered from darkest to lightest. If -1 (default), ordered from lightest to darkest.

  • remove_legend. Logical, hide or show legend. Default = FALSE (show legend).

  • legend_title. String, legend title. Default uses the name of the fillby variable.

  • format_legend_as_comma. Logical. If TRUE, display numbers like 2000 as 2,000 on legend. If FALSE (default), display numbers as they are.

  • font_size. Overall font size. Default = 8. The font size of the axes and legend text is a fraction of this value.

Examples

inst/examples/ex-mk_heatmap.R

gmlang/ezplot documentation built on Sept. 18, 2022, 6:33 a.m.