如何将图像放在R闪亮的标题中 [英] How to place an image in an R Shiny title
本文介绍了如何将图像放在R闪亮的标题中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我使用的是R SHINY,我想在标题中文本的右侧放置一个图像。我似乎可以将图像放在应用程序中的任何位置(标题旁边除外)。您可以不在titlePanel()
函数中放置图像吗?以下是我使用的代码片段:
library(shiny)
# Define UI for random distribution application
shinyUI(fluidPage(#theme="bootstrap.css",
# Application title
titlePanel("My Title",img(src = "picture.jpg", height = 50, width = 100)),
sidebarLayout(
sidebarPanel(
因此,当我使用上面的代码时,我似乎无法在应用程序中的任何地方看到我的图像.
推荐答案
一种方法是按照此帖子中的说明操作:How can I insert an image into the navbar on a shiny navbarPage()(SO猎犬会将其攻击为副本)。
在工作目录中创建名为"www"的文件夹,并将"picture.jpg"放入其中,如下所示:
| shinyApp/
| ui.R
| server.R
| www/
| picture.png
使用div将您的图片包含在title Panel中:
ui.r
library(shiny)
# Define UI for random distribution application
shinyUI(fluidPage(#theme="bootstrap.css",
# Application title
titlePanel(title=div(img(src="picture.jpg"), "My Title")),
sidebarLayout(
sidebarPanel(
)
)
)
)
这篇关于如何将图像放在R闪亮的标题中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文