Silhouette Plot shows a blank image with Shiny

What I'm trying to do is to display a Silhouette Plot in my Shiny apps. But I always get a blank image, which only shows its content when I click Open in Browser . Below is my code:

output$sil_image <- renderPlot({
  # distance1 already defined in global.R
  sil1 <- silhouette(db1$cluster, dist=distance1)
  plot(sil1)
})

I've seen someone asking a similar question as a comment of the answer in this question , but did not receive any reply.

Below is the image I receive:


Thanks in advance~!

does this app 'work' for you ?

library(cluster)
library(shiny)


data(ruspini)
pr4 <- pam(ruspini, 4)
si <- silhouette(pr4)
# plot(si) # silhouette plot

library(shiny)

ui <- fluidPage(
  plotOutput("mysil")
)

server <- function(input, output, session) {
  output$mysil <- renderPlot({
    plot(si)
  })
}

shinyApp(ui, server)

I've solved my question myself. Setting the plot(sil1, border = NA) would WORK :rofl:
Thanks nevertheless.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.