How to insert a picture into Shiny?

11,433 views
Skip to first unread message

Oliver Wang

unread,
Apr 25, 2013, 1:58:41 PM4/25/13
to shiny-...@googlegroups.com
Hi guys,
Do you know how to insert a picture into Shiny?
I want to display a logo in the headerPanel section.

Best wishes,
Oliver

Travis Hinkelman

unread,
Apr 29, 2013, 7:56:36 PM4/29/13
to shiny-...@googlegroups.com
You can insert HTML in a Shiny app like this (not tested):

      HTML('<p><img src="Logo.png"/></p>')

The logo image needs to be in a folder called 'www', located in your app's directory.

gregd...@gmail.com

unread,
May 7, 2013, 3:07:38 PM5/7/13
to shiny-...@googlegroups.com
How would one include this in the headerPanel section?
Thanks

Travis Hinkelman

unread,
May 7, 2013, 3:32:55 PM5/7/13
to shiny-...@googlegroups.com
headerPanel(

   HTML('<p><img src="Logo.png"/></p>')
)

Joe Cheng

unread,
May 7, 2013, 6:24:35 PM5/7/13
to shiny-...@googlegroups.com
If you also want to include text in the headerPanel you can combine them:

headerPanel(
  list(HTML('<img src="Logo.png"/>'), "My Title"),
  windowTitle="My Title"
)

You probably don't want to stick a <p> in there, as the title will be rendered inside an <h1> (which can't legally contain <p>).

The second argument is the title of the document that the web browser will use (for example, to show as the title of the browser tab).


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Message has been deleted

Nelly Gidaszewski

unread,
Dec 17, 2014, 8:28:00 AM12/17/14
to shiny-...@googlegroups.com
Thanks for the discussion!

I have a related question: Joe Cheng showed how to give a title to the browser tab opened by Shiny, using windowTitle.
Is it possible to use an icon/image instead of a title in character?

I am also trying to figure out if the icon of my application could appear instead of  the firefox/Chrome symbol of the browser, in the bottom toolbar (but I am not sure if that is possible).

Thanks!
Nelly
Reply all
Reply to author
Forward
0 new messages