【问题标题】:R Shiny Application moving graph locationR Shiny Application 移动图位置
【发布时间】:2021-09-24 19:22:54
【问题描述】:

我目前正在 R-Shiny 中构建一个应用程序,但由于我在应用程序中添加了选项卡,因此在图形位置方面遇到了问题。我想将图表从第一个选项卡从输入下方移动到它们的右侧。我目前收到来自 R 的以下消息。

bootstrapPage(position =) 自闪亮的 0.10.2.2 起已弃用。 'position' 参数不再与最新版本的 Bootstrap 一起使用。 tabsetPanel(position = "right", tabPanel("Drawdown Plot", plotOutput("line"), : 参数丢失,没有默认值

任何帮助将不胜感激!代码如下

ui <- fluidPage(
  titlePanel("Drawdown Calculator"),
  theme = bs_theme(version = 4, bootswatch = "minty"),
  sidebarPanel(
    numericInput(inputId = "pot",
                 label = "Pension Pot",
                 value = 500000, min = 0, max = 2000000, step = 10000),
    numericInput(inputId = "with",
                 label = "Withdrawal Amount",
                 value = 40000, min = 0, max = 200000, step = 1000),
    numericInput(inputId = "age",
                 label = "Age", value = 65, max = 90, min = 40),
    sliderInput(inputId = "int",
                label = "Interest",
                value = 4, max = 15, min = 0, step = 0.1)),
  mainPanel(
    tabsetPanel(position = "right",
      tabPanel("Drawdown Plot", plotOutput("line"),
               p("This drawdown calculator calculates a potential drawdown outcome")),
      tabPanel ("Breakdown of Drawdown Withdrawals",
     tableOutput("View")),
))
)

【问题讨论】:

    标签: r shiny shinyapps rshiny


    【解决方案1】:

    试试这个代码 -

    library(shiny)
    library(bslib)
    
    ui <- fluidPage(
      titlePanel("Drawdown Calculator"),
      theme = bs_theme(version = 4, bootswatch = "minty"),
      sidebarPanel(
        numericInput(inputId = "pot",
                     label = "Pension Pot",
                     value = 500000, min = 0, max = 2000000, step = 10000),
        numericInput(inputId = "with",
                     label = "Withdrawal Amount",
                     value = 40000, min = 0, max = 200000, step = 1000),
        numericInput(inputId = "age",
                     label = "Age", value = 65, max = 90, min = 40),
        sliderInput(inputId = "int",
                    label = "Interest",
                    value = 4, max = 15, min = 0, step = 0.1)),
      mainPanel(
        tabsetPanel(
          tabPanel("Drawdown Plot", 
                             p("This drawdown calculator calculates a potential drawdown outcome"), 
                   tableOutput("View")),
                    tabPanel("Breakdown of Drawdown Withdrawals",
                              plotOutput("line"))
    ))
    )
    
    server <- function(input, output) {}
    
    shinyApp(ui, server)
    

    【讨论】:

    • 嗨,Ronak,这似乎没有奏效,图表和表格仍然位于我的输入下方。当我删除主题“minty”时,图形和表格都移回侧栏的右侧。也许这就是问题所在?
    • 啊..我明白了。我想我之前误解了这个问题。是的,这里的主题似乎与 mainPanel 冲突。
    猜你喜欢
    • 2021-11-17
    • 2017-09-22
    • 2018-07-10
    • 2021-03-29
    • 1970-01-01
    • 1970-01-01
    • 2014-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多