plot_melted_mat: Quickly plot a melted matrix

Description Usage Arguments Details Value

View source: R/plot_melted_mat.R

Description

A convenience function that ggplots numeric matrices with sensible defaults. This function takes a dataframe x, possibly the output of melt_mat(), as input, along with three strings, .row, .col, .value, which indicate the names of the associated columns in the data.frame.

Usage

1
2
3
4
5
6
7
8
plot_melted_mat(
  x,
  .row = "Var1",
  .col = "Var2",
  .value = "value",
  geom = "raster",
  rotate_xaxis_text = TRUE
)

Arguments

x

a long-form data.frame

.row

character, name of column in x that holds labels for matrix rows

.col

character, name of column in x that holds labels for matrix cols

.value

character, name of column in x that holds numeric values for matrix cells

geom

"raster" (for geom_raster) or "tile" for (geom_tile), defaults to "raster" for speed, esp. with larger matrices.

rotate_xaxis_text

boolean, should x-axis text (column labels) be rotated 90 degrees? useful with long labels / large matrices.

Details

#' The default arguments are set to work with the labels that reshape2::melt() uses when names(dimnames(x)) are not set.

Value

a ggplot object


mcfreund/mfutils documentation built on Feb. 6, 2022, 4:57 a.m.