gpt4 book ai didi

r - 在 Shiny 应用页面的标题栏中显示图标

转载 作者:行者123 更新时间:2023-12-05 06:35:46 25 4
gpt4 key购买 nike

我正在寻找某种方法在我的 Shiny App ('My App') 名称之前的标题栏中显示一些 Snap,如下所示:

library(shiny)

ui = shinyUI(
fluidPage(title = "My App",
selectInput(inputId = "Pick", label = "Chose", choices = c('A', 'B', 'C'), selected = NULL, multiple = FALSE, selectize = TRUE, size = NULL, width = 300))
)

server = function(input, output, session) {
}

shinyApp(ui = ui, server = server)

我试过在 title 参数中使用 HTML 标签,但它没有显示任何内容。

library(shiny)

ui = shinyUI(
fluidPage(title = div(img(src = 'https://guidetoiceland.is/image/389003/x/0/the-beautiful-waterfalls-of-south-iceland-seljalandsfoss-skogafoss-amp-gljufrabui-1.jpg', "My App")),
selectInput(inputId = "Pick", label = "Chose", choices = c('A', 'B', 'C'), selected = NULL, multiple = FALSE, selectize = TRUE, size = NULL, width = 300))
)

server = function(input, output, session) {
}

shinyApp(ui = ui, server = server)

如果有人指导我朝着正确的方向前进,我将不胜感激。

谢谢,

最佳答案

应该这样做:

library(shiny)

ui = shinyUI(fluidPage(
# Application title
titlePanel(
title =
tags$link(rel = "icon", type = "image/gif", href = "https://guidetoiceland.is/image/389003/x/0/the-beautiful-waterfalls-of-south-iceland-seljalandsfoss-skogafoss-amp-gljufrabui-1.jpg"),
"My App"
),
selectInput(
inputId = "Pick",
label = "Chose",
choices = c('A', 'B', 'C'),
selected = NULL,
multiple = FALSE,
selectize = TRUE,
size = NULL,
width = 300
))
)

server = function(input, output, session) {
}

shinyApp(ui = ui, server = server)

除非我误解了你的问题,否则这里是输出。您必须在浏览器中打开它才能看到它: enter image description here

关于r - 在 Shiny 应用页面的标题栏中显示图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49498574/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com