d3heatmapOutput | R Documentation |
Use d3heatmapOutput
to create a UI element, and renderD3heatmap
to render the heatmap.
d3heatmapOutput(outputId, width = "100%", height = "400px")
renderD3heatmap(expr, env = parent.frame(), quoted = FALSE)
outputId |
Output variable to read from |
width , height |
The width and height of the map (see shinyWidgetOutput) |
expr |
An expression that generates a |
env |
The environment in which to evaluate |
quoted |
Is |
## Not run:
library(d3heatmap)
library(shiny)
ui <- fluidPage(
h1("A heatmap demo"),
selectInput("palette", "Palette", c("YlOrRd", "RdYlBu", "Greens", "Blues")),
checkboxInput("cluster", "Apply clustering"),
d3heatmapOutput("heatmap")
)
server <- function(input, output, session) {
output$heatmap <- renderD3heatmap({
d3heatmap(
scale(mtcars),
col = input$palette,
dendrogram = if (input$cluster) "both" else "none"
)
})
}
shinyApp(ui, server)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.