library(gplots)
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
library(RColorBrewer)
df <- scale(mtcars)
# Default plot
heatmap(df, scale ="none")

col<- colorRampPalette(c("red","white","blue"))(256)
col <- colorRampPalette(brewer.pal(10,"RdYlBu"))(256)
# Use RColorbrewer color palette names
col <- colorRampPalette(brewer.pal(10,"RdYlBu"))(256)
heatmap(df, scale = "none", col = col,
RowSideColors = rep(c("blue", "pink"), each = 16),
ColSideColors = c(rep("purple", 5), rep("orange", 6)))

heatmap.2(df, scale = "none", col = bluered(100),
trace = "none", density.info = "none")

library ("pheatmap")
pheatmap(df, cutree_rows = 4)

# library("d3heatmap")
# d3heatmap(scale(mtcars), colors = "RdYlBu",
# k_row= 4, # Number of groups in rows
# k_col= 2 # Number of groups in colums
#)
#library(dendextend)
# order for rows
#Rowv <- mtcars %>% scale %>% dist %>% hclust %>% as.dendrogram %>%
# set("branches_k_color", k = 2, value = c("orange", "blue")) %>%
#set("branches_lwd", 1.2) %>%
#ladderize
#heatmap(scale(mtcars), Rowv = Rowv, Colv= Colv,
#scale = "none")
#library(gplots)
#heatmap.2(scale(mtcars), scale= "none", col = bluered(100),
#Rowv = Rowv, Colv = Colv,
#trace= "none", density.info = "none")
#library("d3heatmap")
#d3heatmap(scale(mtcars), colors = "RdBu",
#Rowv = Rowv, Colv = Colv)
#s1ource("https://bioconductor.org/biocLite.R")
#biocLite("ComplexHeatmap")
#library(ComplexHeatmap)
#Heatmap(df,
#name = "mtcars", #title of legend
#column_title = "Variables", row_title = "Samples",
#row_names_gp = gpar(fontsize = 7) # Test size for row names
#)
#library(circlize)
#mycols <- colorRamp2 (breaks = c(-2, 0, 2),
#colors = c("green", "white", "red") )
#Heatmap(df, name = "mtcars",
#col = mycols)
#library("circlize")
#library("RColorBrever")
#Heatmap(d, nane - "mtcars
#col = colorRamp2(e(-2, 0, 2), brever.pal (n=3, name="RdBu")))
#library(dendextend)
#row dend = helust (dist (df)) # row custering
#col dend
#= hclust (dist(t(df)))
#column ciusterino
#Heatmap(df, name = "mtcars'
#CON naz03 8D = gpar fontsiz0 = 6.5)
#cluster rows
#= color branches (rov dend, k = 4)
#cluster_colunns = color_ branches (col dend, k = 2))
# Divide into 2 groups
#set.seed(2)
#Heatmap(df, name = "mtcars", k = 2)
# split by a vector specifying rowgroups
#Heatmap(df, name = "mtcars", split = mtcars$cyl,
#row_names_gp = gpar(fontsize = 7))
#expr <- readRDS (paste0 (system.file (package = "ComplexHeatmap")
#, "/extdata/gene_expression.rde"))
#mat <- a8.matrix (expr[, grep("cell" colnames(expr))])
#type <- gsub("s\\d+_","",colnames(mat))
#ha = HeatmapAnnotation (df = data.frase (type = type))
#Heatmap(mat,name = "expression" km = 5, top annotation " ha,
#top annotation height = unit(4,"mm"),
#show_rov names = FALSE, show_column names = FALSE) +
#Heatmap(expr$length,name = "length" width = unit (5,
#"mm"),
#col = circlize: :colorRamp2(c(0, 100000), c("white"
#"orange"))) +
#Heatmap(expr$type,name=
#"type", width = unit (5, "mm")) +
#Heatmap(expr$chr, name = "chr"
#width = unit(5,
#'"mm")
#col = circlize: :rand_color (length (unique (expr$chr))))
#library("FactoMineR")
#library("factoextra")
#data(decathlon2)
# head(decathlon2)
#decathlon2.active <- decathlon2[1:23, 1:10]
#head(decathlon2.active[,1:6],4)
#PCA(X, scale.unit = TRUE, ncp = 5, graph = TRUE)
#library("FactoMineR")
#res.pca <- PCA(deacthlon2.active, graph = FALSE)
#print(res.pca)
#library("factoextra")
#eig.val <- get_eigenvalue(Res.pca)
#eig.val
#fviz_eig(res.pca, addlabels = TRUE, ylim = c(0, 50))
#var <- get_pca_var(res.pca)
#var
#Coordinates
#head(var$coord)
# Cos2: quality on the factore map
#head(var$cos2)
# Contributions to the principal components
#head(var$contrib)
#Coordinates of variables
#head (var$coord, 4)
#head(var$cos2, 4)
#fviz_eig(res.pca)
# Scree plot
#fviz_pca_ind(res.pca) # Graph of individuals
#fviz_pca_var(res.pca) # Graph of variables