Skip to content
Complex, interactive heatmaps in R
R JavaScript Other
Branch: master
Clone or download
AliciaSchep Merge pull request #64 from ropensci/no-ld
make tests robust to less precision
Latest commit 50b6cf4 Nov 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R ignore colors Nov 17, 2019
data
inst add citation Sep 29, 2017
man ignore colors Nov 17, 2019
paper add complexheatmap doi Apr 30, 2017
tests
vignettes update links Aug 26, 2019
.Rbuildignore ignore colors Nov 17, 2019
.gitattributes update gitattributes May 1, 2017
.gitignore add cran comments Sep 30, 2017
.travis.yml modify travis Mar 9, 2019
CONDUCT.md
CONTRIBUTING.md Update CONTRIBUTING.md Jun 4, 2017
DESCRIPTION make tests compatible with new version of scales package Nov 10, 2019
LICENSE
NAMESPACE
NEWS.md make tests compatible with new version of scales package Nov 10, 2019
README.md update links Aug 26, 2019
_pkgdown.yml remove plotly r package dependency Jun 4, 2017
appveyor.yml
codecov.yml
codemeta.json update codemeta Nov 16, 2019
cran-comments.md make tests robust to less precision Nov 22, 2019
vaccine.gif first git commit Mar 16, 2017

README.md

Build Status AppVeyor Build Status codecov R version JOSS CRAN License: MIT

iheatmapr

iheatmapr is an R package for building complex, interactive heatmaps using modular building blocks. "Complex" heatmaps are heatmaps in which subplots along the rows or columns of the main heatmap add more information about each row or column. For example, a one column additional heatmap may indicate what group a particular row or column belongs to. Complex heatmaps may also include multiple side by side heatmaps which show different types of data for the same conditions. Interactivity can improve complex heatmaps by providing tooltips with information about each cell and enabling zooming into interesting features. iheatmapr uses the plotly library for interactivity.

While there are already plenty of awesome R packages for making heatmaps, including several great packages for making relatively simple interactive heatmaps (heatmaply and d3heatmap) or complex static heatmaps (ComplexHeatmap), iheatmapr seeks to make it easy to make complex interactive heatmaps.

Installation

To install the CRAN version of iheatmapr:

install.packages("iheatmapr")

To install the github version of iheatmapr:

devtools::install_github("ropensci/iheatmapr")

iheatmapr has a Bioconductor dependency, so if you have never installed a package from Bioconductor before you will need to install BiocInstaller first:

source("https://bioconductor.org/biocLite.R")
biocLite("BiocInstaller")

Example Complex Heatmap

As an example of a complex heatmap, we can make a version of the famous vaccines plot from the Wall Street Journal that has been recreated in several other heatmap frameworks in R.

The code to create this heatmap is:

library(iheatmapr)
data(measles, package = "iheatmapr")

main_heatmap(measles, name = "Measles<br>Cases", x_categorical = FALSE,
             layout = list(font = list(size = 8))) %>%
  add_col_groups(ifelse(1930:2001 < 1961,"No","Yes"),
                  side = "bottom", name = "Vaccine<br>Introduced?",
                  title = "Vaccine?",
                  colors = c("lightgray","blue")) %>%
  add_col_labels(ticktext = seq(1930,2000,10),font = list(size = 8)) %>%
  add_row_labels(size = 0.3,font = list(size = 6)) %>% 
  add_col_summary(layout = list(title = "Average<br>across<br>states"),
                  yname = "summary")  %>%                 
  add_col_title("Measles Cases from 1930 to 2001", side= "top") %>%
  add_row_summary(groups = TRUE, 
                  type = "bar",
                  layout = list(title = "Average<br>per<br>year",
                                font = list(size = 8)))
              

Modular components of the plot are added in an iterative fashion to the top, right, left, or bottom of the heatmap. iheatmapr also contains a function (iheatmap) to make a fairly standard heatmap with optional dendrograms and row or column annotation heatmaps (See vignette).

All the plots aligned with the main heatmap horizontally share the same y axis and thus zooming in the y direction within the heatmap will also zoom in to those subplots. The plots aligned vertically share an x axis with that heatmap and zooming horizontally within those plots will be linked.

Hovering over the heatmaps yields a tooltip with the name of the row and column as well as the value represented.

Documentation

See the vignette for a more thorough introduction to the package.

Acknowledgements

This package includes the open source Plotly.js library, which does much of the work of making these interactive plots possible! In creating this package, I also drew inspiration & some code from the great plotly R package; in particular, the code for the iheatmapr htmlwidget is adapted from an earlier version of the plotly R package. Additionally, numerous people at Genentech helped provide feedback and guidance for this project, including but not limited to Justin Finkle, August Guang, Michael Lawrence, Gabe Becker, Steve Lianoglou, Pete Haverty... thanks to all who helped review code and/or provide feedback! This package also went through the on-boarding process for rOpensci -- thanks to the reviewers Carl Ganz and Andee Kaplan and editor Maëlle Salmon for all their helpful feedback!

ropensci_footer

You can’t perform that action at this time.