Skip to content

Instantly share code, notes, and snippets.

@ArnauMontagud
Created August 5, 2021 11:25
Show Gist options
  • Save ArnauMontagud/1fea4dea5a7de1382b56db2df6dbd42a to your computer and use it in GitHub Desktop.
Save ArnauMontagud/1fea4dea5a7de1382b56db2df6dbd42a to your computer and use it in GitHub Desktop.
[R Interactive heatmap] Using heatmaply to have interactive heatmap #R
# interactive heatmap :
install.packages("heatmaply")
library(heatmaply)
a<-
heatmaply(mtcars, k_col = 2, k_row = 3) %>% layout(margin = list(l = 130, b = 40))
dev.off ()
# mtcars
# x <- heatmapr(mtcars)
library(heatmaply)
heatmaply(iris[,-5], k_row = 3, k_col = 2)
heatmaply(cor(iris[,-5]))
heatmaply(cor(iris[,-5]), limits = c(-1,1))
heatmaply(mtcars)
heatmaply(mtcars, k_row = 3, k_col = 2)
# make sure there is enough room for the labels:
heatmaply(mtcars) %>% layout(margin = list(l = 130, b = 40))
# control text angle
heatmaply(mtcars, column_text_angle = 90) %>% layout(margin = list(l = 130, b = 40))
# the same as using srtCol:
# heatmaply(mtcars, srtCol = 90) %>% layout(margin = list(l = 130, b = 40))
x <- mtcars
# different colors
heatmaply(x, colors = heat.colors(200))
# using special scale_fill_gradient_fun colors
heatmaply(x, scale_fill_gradient_fun = scale_colour_gradient())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment