在最右侧 navbarPage 闪亮的插入图像

lui*_*zgg 3 r shiny

我有以下代码用于生成 navbarPage 的闪亮应用程序

library(shiny)
library(shinythemes)

ui <- navbarPage(
  title = "Report", theme = shinytheme("cerulean"),
  tabPanel("About"),
  tabPanel(
    "Plots",
    fluidPage(
      tabsetPanel(
        type = "pills",
        tabPanel("A"),
        tabPanel(
          "B",
          sidebarLayout(
            sidebarPanel(h4("Checkbox"),
              checkboxInput("total", label = "total"),
              uiOutput("conditionalInput"),
              width = 3
            ),
            mainPanel(
              tabsetPanel(
                tabPanel("a"),
                tabPanel("b"),
                tabPanel("c"),
                tabPanel("d"),
                tabPanel("e")
              )
            )
          )
        )
      )
    )
  )
)



server <- function(input, output) {
  output$conditionalInput <- renderUI({
    if (input$total == FALSE) {
      checkboxGroupInput("verticais",
        label = "",
        choices = list(
          "1.1" = 1,
          "1.2" = 2,
          "1.3" = 3,
          "1.4" = 4,
          "1.5" = 5,
          "1.6" = 6,
          "1.7" = 7,
          "1.8" = 8
        ),
        selected = c(1:8), inline = FALSE
      )
    }
  })
}

# Run the application
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)

产生这个输出

但是,出于布局目的,我想在窗口的最右侧(靠近发布按钮的位置)放置一个徽标。我尝试了这个问题中描述的内容,但没有成功。

因此,我想知道是否有另一种解决方法来解决我的问题。

请注意,我在正确的 www 文件夹中有图像文件

lui*_*zgg 6

我通过将navbarPage代码段更改为以下解决方法:

navbarPage(title = div("Report", img(src = "myimage.png", height = "10px", style = "position: relative; top: -3px; right: -1000px;")), theme = shinytheme("cerulean")

它仍然不是最好的,因为图像没有附加到导航栏,并且还在标题和标签集之间创建了一个不必要的空白空间