A shiny module for d3heatmap plot
This is a d3heatmap packages based shiny module that provide plot control UI and heatmap output
This shiny module requires following packages. Please make sure they are installed.
install.package('d3heatmap')
install.package('RColorBrewer')
- Source the module file
source('d3HeatmapMod.R')
- Invoke module in server function. Make sure to set appropriate parameters.
server <- function(input, output, session) {
callModule(d3HeatmapMod, id = 'YOU_MODULE_ID',
data = reactive({mtcars}), # A numeric matrix to display (wrapped as a reactive object)
dendrogram = reactive(NULL), # One of "none"(default), "row", "column" or "both" (wrapped as a reactive object)
scale = reactive({'column'})) # One of "none"(default), "row" or "column" (wrapped as a reactive object)
# other codes
}
- Add control ui and heatmap output
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
width = 3,
d3HeatmapControl('YOU_MODULE_ID')
),
mainPanel(
width = 9,
d3HeatmapPlot('YOU_MODULE_ID')
)
)
)
- Run app and use control ui to adjust the appearance of the heatmap