Install
devtools::install_github("stemangiola/tidyHeatmap@redefine-show")
Define data frame
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.3 ✓ purrr 0.3.4
## ✓ tibble 3.1.0 ✓ dplyr 1.0.5
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(tidyHeatmap)
## ========================================
## tidyHeatmap version 1.1.5
## If you use tidyHeatmap in published research, please cite:
## 1) Mangiola et al. tidyHeatmap: an R package for modular heatmap production
## based on tidy principles. JOSS 2020.
## 2) Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
## genomic data. Bioinformatics 2016.
## This message can be suppressed by:
## suppressPackageStartupMessages(library(tidyHeatmap))
## ========================================
##
## Attaching package: 'tidyHeatmap'
## The following object is masked from 'package:stats':
##
## heatmap
m <- matrix(rnorm(10*10), 10, 10)
rownames(m) <- sprintf("g%d", 1:10)
colnames(m) <- sprintf("s%d", 1:10)
expr <- m %>% as_tibble(rownames="gene") %>%
gather(sample, value, -gene)
expr
## # A tibble: 100 x 3
## gene sample value
## <chr> <chr> <dbl>
## 1 g1 s1 -1.11
## 2 g2 s1 -0.896
## 3 g3 s1 0.827
## 4 g4 s1 1.64
## 5 g5 s1 0.285
## 6 g6 s1 1.23
## 7 g7 s1 0.712
## 8 g8 s1 0.0116
## 9 g9 s1 -1.85
## 10 g10 s1 1.40
## # … with 90 more rows
Produce plot
I just get the printout
p
## [1] "This show function is called"
show explicitelyshow(p)
## [1] "This show function is called"