Entering edit mode
16 months ago
logbio
▴
30
I want to see the circular heatmap in the output of my code in R Shiny App. However, when I first run the code, circular heatmap works fine, but no longer outputs circular.
library(shiny)
library(shinydashboard)
library(ComplexHeatmap)
library(BiocManager)
library(circlize)
library(RColorBrewer)
# Shiny app
ui <- dashboardPage(
dashboardHeader(title = "Circular Heatmap"),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(
title = "Circular Heatmap",
width = 12,
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("heatmap_plot")
)
)
)
)
server <- function(input, output) {
output$heatmap_plot <- renderPlot({
#dataset
set.seed(123)
mat <- matrix(rnorm(100), ncol = 10)
colnames(mat) <- paste0("Gene", 1:10)
rownames(mat) <- paste0("Sample", 1:10)
# ComplexHeatmap create
color_palette <- colorRampPalette(brewer.pal(11, "RdBu"))(101)
col_fun <- colorRamp2(seq(-3, 3, length.out = 101), color_palette)
ht <- Heatmap(mat,
col = col_fun,
name = "Expression",
show_row_names = FALSE,
show_column_names = TRUE,
cluster_rows = FALSE,
cluster_columns = FALSE)
# ComplexHeatmap
draw(ht)
# ComplexHeatmap to circular
circos.par(start.degree = 90)
circos.heatmap(mat, col = col_fun) # control.circle argümanını kaldırdık
})
}
shinyApp(ui, server)
Yes please remove
Heatmap
part of code-Your final code will be like this-
And your plot will look like this-