如何在 Shiny App 中调整绘图高度

问题描述 投票:0回答:0

这是我第一次开发闪亮的应用程序。

我想根据屏幕大小调整绘图的高度,但我尝试过的都不起作用。

The plot looks like this now

正如您在图片中看到的那样,绘图下方有一个空白区域,所以我想通过调整绘图的高度来解决这个问题。

这是代码。它不可复制,因为我正在使用本地文件创建模型。

ui <- fluidPage(theme = shinytheme("yeti"),
       navbarPage(
       "Анализ тональности",
       tabPanel("Облако слов"),
       tabPanel("Проверка предложения"), 
       tabPanel("SVM-модель",
                mainPanel(plotOutput("plot"), width = "100%", height = "1100px")),
       )#navbarPage
) #fluidPage

server <- function(input, output, session) {
  output$plot <- renderPlot({
    beta.svm <- drop(t(model$coefs) %*% dfmat_train[model$index,])
    plot(colSums(dfmat_train),
         beta.svm,
         pch = 19,
         col = rgb(0,0,0,.3),
         cex =.5, 
         log = "x", 
         main = "Коэффициенты SVM-модели",
         ylab = "<--- Негативные комм. --- Позитивные комм.--->", 
         xlab = "Общее количество появлений", 
         xlim = c(1,500))
    text(colSums(dfmat_train),beta.svm, colnames(dfmat_train), pos = 4, cex = .9)
  })
}


####################################
# Create the shiny app             #
####################################
shinyApp(ui = ui, server = server)

我已经尝试过的是改变

height
plot()
中的
plotOutput()
参数。它没有帮助。 所以,问题是:如何使地块高度可调或至少更大?

r plot shiny height
© www.soinside.com 2019 - 2024. All rights reserved.