-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.R
More file actions
55 lines (48 loc) · 1.64 KB
/
server.R
File metadata and controls
55 lines (48 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
shinyServer(function(input, output) {
sampleMatrix <- reactive({
myN <- sample(1:474, input$size)
myMatrix <- CorMat[myN, myN]
return(myMatrix)
})
output$plotlyHM <- renderPlotly({
myMatrix <- sampleMatrix()
myClust <- hclust(dist(myMatrix))
myMatrix <- myMatrix[myClust$order, rev(myClust$order)]
p <- plot_ly(z = myMatrix,
x = colnames(myMatrix),
y = row.names(myMatrix),
colorscale = list(
c(0.0, "rgb(0,0,255)"),
c(0.3333, "rgb(255,255,255)"),
c(0.6667, "rgb(255,0,0)"),
c(1, "rgb(0,0,0)")
),
zmin = -0.5,
zmax = 1,
type = "heatmap",
showscale = TRUE
)
layout(p,
title = "Pairwise correlations",
autosize = FALSE,
width = 850,
height = 800,
margin = list(l = 250, r = 50, b = 250, t = 50, pad = 4),
font = list(size = 12),
xaxis = list(title = ""),
yaxis = list(title = "")
)
})
output$d3HM <- renderD3heatmap({
myPalette <- colorRampPalette(c("white", "red", "black"))(100)
d3heatmap(sampleMatrix(),
show_grid = FALSE,
anim_duration = 0,
colors = myPalette,
xaxis_font_size = "12px",
yaxis_font_size = "12px",
xaxis_height = 250,
yaxis_width = 250
)
})
})