我正在尝试向我的 Shiny 应用程序添加交互式热图,但我也有使用 ggiraph 的交互式图表。我目前正在使用 d3heatmap 包,但热图未在应用程序中呈现。我创建了一个玩具示例来说明这一点:
library(shiny)
library(ggiraph)
library(d3heatmap)
ui <- fluidPage(
d3heatmapOutput('d3'),
ggiraphOutput('gg')
)
server <- function(input, output, session) {
# Create heatmap
output$d3 <- renderD3heatmap({
d3heatmap(matrix(1:100, nrow = 100, ncol = 100))
})
# Create ggiraph
output$gg <- renderggiraph({
p <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Width,
color = Species, tooltip = iris$Species) ) +
geom_point_interactive()
ggiraph(code = {print(p)})
})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
总之,只有 ggiraph 渲染,但热图没有。但是,如果您注释掉 ggiraph 代码,则会呈现热图。我尝试切换加载包的顺序,但这仍然不起作用。
我目前在 R 3.2.2 上运行(我必须使用这个版本,因为公司服务器只在这个版本上运行,我的经理和我都没有更新它的权限)。我尝试下载 …