Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shiny 渲染图像不输出光泽 output$plot_Shiny - Fatal编程技术网

Shiny 渲染图像不输出光泽 output$plot

Shiny 渲染图像不输出光泽 output$plot,shiny,Shiny,尝试创建一个反应图,如下所示 output$plot <- renderImage({ outfile <- tempfile(fileext = '.png') png(outfile, width = 400, height = 300) venn.diagram( x = list( T = T, I = I ), main = "Venn Diagram ", filename =outfile, output=T

尝试创建一个反应图,如下所示

  output$plot <- renderImage({
  
outfile <- tempfile(fileext = '.png')
png(outfile, width = 400, height = 300)
venn.diagram(
  x = list(
    T = T,
    I = I
  ),
  main = "Venn Diagram ",
  filename =outfile, output=TRUE,
  lwd = 2,na = "remove",
  fill = c("orange", "blue"),
  alpha = c(0.5,0.5),
  label.col = "black",
  cex=1.5,
  fontface = "plain",
  cat.col = c("cornflowerblue", "pink"),
  cat.cex = 1.5,
  cat.fontfamily = "serif",
  cat.fontface = "plain",
  cat.dist = c(0.05, 0.05),
  cat.pos = c(-20, 14),
  cat.default.pos = "text",
  scaled = FALSE
)
dev.off()

list(src = outfile,
     contentType = 'image/png',
     width = 400,
     height = 300,
     alt = "This is alternate text")
}, deleteFile = TRUE)

output$plot
output$plot仍然没有输出我使用
shinDashboard::box(imageOutput(“plot”,height=“550px”)
ui
侧获取输出。显然,我正在绘制另一个绘图。我认为这是关于venn.diagram包的。首先,您需要验证您是否可以在RStudio中获取绘图,而无需使用Shiny。
output$plot <- renderImage({
    vennd <- reactive({venn.diagram(
      x = list(
        T = T,
        I = I
      ),
      main = "Venn Diagram ",
      filename =outfile, output=TRUE,
      lwd = 2,na = "remove",
      fill = c("orange", "blue"),
      alpha = c(0.5,0.5),
      label.col = "black",
      cex=1.5,
      fontface = "plain",
      cat.col = c("cornflowerblue", "pink"),
      cat.cex = 1.5,
      cat.fontfamily = "serif",
      cat.fontface = "plain",
      cat.dist = c(0.05, 0.05),
      cat.pos = c(-20, 14),
      cat.default.pos = "text",
      scaled = FALSE
    )
    })
    outfile <- tempfile(fileext = '.png')
    png(outfile, width = 400, height = 300)
    vennd()
    dev.off()
    
    list(src = outfile,
         contentType = 'image/png',
         width = 400,
         height = 300,
         alt = "This is alternate text")
  }, deleteFile = TRUE)
output$plot <- renderImage({
 
  vennd <- reactive({venn.diagram(
    x = list(
       T = T,
       I = I
    ),
    main = "",
    filename =outfile, output=TRUE,
    lwd = 2,na = "remove",imagetype="png",
    fill = c("orange", "blue"),
    alpha = c(0.5,0.5),
    label.col = "black",
    cex=1.5,
    fontface = "plain",
    cat.col = c("cornflowerblue", "pink"),
    cat.cex = 1.5,
    cat.fontfamily = "serif",
    cat.fontface = "plain",
    cat.dist = c(0.05, 0.05),
    cat.pos = c(-20, 14),
    cat.default.pos = "text",
    scaled = FALSE
  )
  })
  outfile <- tempfile(fileext = '.png')
  png(outfile, width = 500, height = 500,type="cairo")
  vennd()
   dev.off()
  
  list(src = outfile,
       contentType = 'image/png',
       width = 500,
       height = 500,
       alt = "This is alternate text")
}, deleteFile = TRUE)