Generating Funky Heatmaps for Data Frames

Allows generating heatmap-like visualisations for data frames. Funky heatmaps can be fine-tuned by providing annotations of the columns and rows, which allows assigning multiple palettes or geometries or grouping rows and columns together in categories. Saelens et al. (2019) .


{funkyheatmap}

cran R-CMD-check

{funkyheatmap} allows generating heatmap-like visualisations for data frames. Funky heatmaps can be fine-tuned by providing annotations of the columns and rows, which allows assigning multiple palettes or geometries or grouping rows and columns together in categories.

Installation

You can install funkyheatmap like so:

install.packages("funkyheatmap")

You can also download {funkyheatmap} as a standalone executable or a Nextflow pipeline.

Example

Let’s use the mtcars dataset as an example of what a funky heatmap looks like.

library(funkyheatmap)
library(dplyr, warn.conflicts = FALSE)
library(tibble, warn.conflicts = FALSE)

data("mtcars")

data <- mtcars %>%
  rownames_to_column("id") %>%
  arrange(desc(mpg))

You need to provide some information on how each column should be rendered, for example:

column_info <- tribble(
  ~id,     ~group,         ~name,                      ~geom,        ~palette,    ~options,
  "id",    "",             "",                         "text",       NA,          list(hjust = 0, width = 6),
  "mpg",   "overall",      "Miles / gallon",           "bar",        "palette1",  list(width = 4, legend = FALSE),
  "cyl",   "overall",      "Number of cylinders",      "bar",        "palette2",  list(width = 4, legend = FALSE),
  "disp",  "group1",       "Displacement (cu.in.)",    "funkyrect",  "palette1",  lst(),
  "hp",    "group1",       "Gross horsepower",         "funkyrect",  "palette1",  lst(),
  "drat",  "group1",       "Rear axle ratio",          "funkyrect",  "palette1",  lst(),
  "wt",    "group1",       "Weight (1000 lbs)",        "funkyrect",  "palette1",  lst(),
  "qsec",  "group2",       "1/4 mile time",            "circle",     "palette2",  lst(),
  "vs",    "group2",       "Engine",                   "circle",     "palette2",  lst(),
  "am",    "group2",       "Transmission",             "circle",     "palette2",  lst(),
  "gear",  "group2",       "# Forward gears",          "circle",     "palette2",  lst(),
  "carb",  "group2",       "# Carburetors",            "circle",     "palette2",  lst()
)

Now you can generate the funky heatmap:

funky_heatmap(
  data,
  column_info = column_info,
  position_args = position_arguments(expand_xmax = 4)
)

More information

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("funkyheatmap")

0.5.2 by Robrecht Cannoodt, 2 years ago


https://funkyheatmap.github.io/funkyheatmap/, https://github.com/funkyheatmap/funkyheatmap


Report a bug at https://github.com/funkyheatmap/funkyheatmap/issues


Browse source code at https://github.com/cran/funkyheatmap


Authors: Robrecht Cannoodt [aut, cre] , Wouter Saelens [aut] , Louise Deconinck [ctb] , Artuur Couckuyt [ctb] , Nick Markov [ctb] , Luke Zappia [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports assertthat, cli, cowplot, dplyr, ggforce, ggplot2, grDevices, jsonlite, patchwork, purrr, RColorBrewer, Rdpack, stringr, tibble, tidyr

Suggests kableExtra, knitr, testthat, magick, readr


Suggested by UCSCXenaShiny.


See at CRAN