我想在以下位置重现示例:https : //scip.shinyapps.io/scip_app/
基本上,我有一个 300 x 300 调整的相关矩阵和一个 300 x 300 未调整的相关矩阵,并希望通过放大和缩小功能以交互方式显示它们。文本描述应显示点估计和置信区间。
有什么模板可以快速参考吗?
基于 Mike 的数据,您可以使用该d3heatmap
库
library(d3heatmap)
library(shiny)
n1 <- 100
n2 <- 100
nr <- 30
nc <- 30
set.seed(1)
x <- matrix(rnorm(n1), nrow=nr, ncol=nc)
y <- matrix(rnorm(n2), nrow=nr, ncol=nc)
MAT <- cor(x,y)
ui <- fluidPage(
mainPanel(
d3heatmapOutput("heatmap", width = "100%", height="600px")
)
)
## server.R
server <- function(input, output) {
output$heatmap <- renderD3heatmap({d3heatmap(MAT)})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
编辑:根据需要指定颜色并按原样显示数据,请注意Colv = T
默认情况下,这意味着它将相关项目组合在一起
output$heatmap <- renderD3heatmap({d3heatmap(MAT, colors = "Blues", Colv = FALSE)})
Run Code Online (Sandbox Code Playgroud)