imageOutputのサイズをshiny上で変更して、より高品質の画像を出力しようとしました。しかし、幅と高さのサイズは変更できず、list()の幅と高さを「auto」に設定したときにも同じことが起こりました。
library(shiny) library(shinyjqui) library(ggplot2) # Define UI for app that draws a histogram ---- ui <- fluidPage( titlePanel("Hello Shiny!"), mainPanel( h3("Low resolution"), jqui_resizable(plotOutput(outputId = "Plot")), hr(), h3("High resolution"), jqui_resizable(imageOutput("myImage", height = "100%", width = "100%")) ) ) # Define server logic required to draw a histogram ---- server <- function(input, output, session) { output$Plot <- renderPlot({ g <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point() return(g) } #height = 200, width = 200 Adding This code, I cant move picture ) # Plot the data #### output$myImage <- renderImage({ g <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point() # A temp file to save the output. # This file will be removed later by renderImage outfile <- tempfile(fileext = '.png') # Generate the PNG png(outfile, width = 200*8, height = 200*8, res = 72*8) print(g) dev.off() # Return a list containing the filename list(src = outfile, contentType = 'image/png', width = 200, height = 200, alt = "This is alternate text")}, deleteFile = TRUE)} shinyApp(ui, server)
あなたの回答
tips
プレビュー