我一直在研究一款闪亮的应用,并希望在应用的右上角添加一个徽标。如何使用闪亮和r?
轻松嵌入图像谢谢! ķ
答案 0 :(得分:65)
我找到了另一个看起来很适合这个应用的选项,所以我正在为那些想要在主面板中想要图片的人分享。
mainPanel(
img(src='myImage.png', align = "right"),
### the rest of your code
)
将文件保存在shinyApp目录中的www目录中:
| shinyApp/
| ui.R
| server.R
| www/
| myImage.png
答案 1 :(得分:20)
使用ui.R
中的自定义标头功能引用app.css
目录中的www/
文件:
customHeaderPanel <- function(title,windowTitle=title){
tagList(
tags$head(
tags$title(windowTitle),
tags$link(rel="stylesheet", type="text/css",
href="app.css"),
tags$h1(a(href="www.someURLlogoLinksto.com"))
)
)
}
在app.css
中引用也位于www/
文件夹中的徽标文件:
h1 {
text-decoration:none;
border:0;
width : 550px;
height : 50px;
margin : 0;
padding : 0;
left: 25px;
top: 5px;
position: relative;
background : url(logo.png) no-repeat 0 0;
}