resize ggplots to suit shiny dashboard tab box

4,117 views
Skip to first unread message

P G Magesh

unread,
Sep 14, 2015, 9:04:31 AM9/14/15
to Shiny - Web Framework for R

I migrated my charts from shiny to shiny dashboard.  In the dashboard I have created tabs.  The charts that got rendered freely in shiny, is not getting properly resized according to the tab panel size.  I am attaching a screen shot of the dashboard.  How do i resize the plots to suit the size of the tab panel?  Most of my charts are made in ggplot2 and the size of the tab box is 250px

Magesh.
dashboard.tiff

P G Magesh

unread,
Sep 14, 2015, 10:32:52 AM9/14/15
to Shiny - Web Framework for R
I have got this sorted by adding the height argument within renderPlot function..my earlier code was like this:

plotOutput("tweetday")

which I have changed to 

plotOutput("tweetday", height = "250px")), 

this is apart from setting the tabBox height to "250px".

Magesh.

Aline Deschamps

unread,
Sep 15, 2015, 5:22:18 AM9/15/15
to Shiny - Web Framework for R
Hi,

I think that setting the "height" parameter to the "right" size could help, but how to proceed to make the shinyapp suitable for any kind of browser/device ?
In fact, the tabBox size depends of the browser size but since the app is responsive, it adjusts well, BUT the size of the (ggplot2 for instance) graph won't adjust if you change browser or just reduce the windows' size.

May be my question goes a little bit further than the initial one but if mine has a proper answer, then it will solve the initial question too.

Thank you !

Best regards.

Joe Cheng

unread,
Sep 16, 2015, 12:14:48 AM9/16/15
to Aline Deschamps, Shiny - Web Framework for R
Setting the plotOutput height to "100%" should work. This only works when the plotOutput is contained in an element that has its own notion of height (rather than just being big enough to hold its children), which it seems like tabBox does.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/481d084f-cfa9-4df5-ad28-28b5020164e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rajkumar

unread,
Jun 24, 2017, 9:55:20 AM6/24/17
to Shiny - Web Framework for R
i need to give time as radiobutton like 1day, 1week , 1 month etc . i'm not able to get output can u provide code for that.


On Monday, September 14, 2015 at 6:34:31 PM UTC+5:30, P G Magesh wrote:

pavan prakash

unread,
Sep 29, 2017, 11:57:52 AM9/29/17
to Shiny - Web Framework for R


On Monday, 14 September 2015 18:34:31 UTC+5:30, P G Magesh wrote:

I migrated my charts from shiny to shiny dashboard.  In the dashboard I have created tabs.  The charts that got rendered freely in shiny, is not getting properly resized according to the tab panel size.  I am attaching a screen shot of the dashboard.  How do i resize the plots to suit the size of the tab panel?  Most of my charts are made in ggplot2 and the size of the tab box is 250px

Magesh.

Hello Guys,
  I am working on similar dashbaard like the one shown in image by Magesh but i am facing difficulty with how to plots graph when user click submit button. i want to plot four graphs based on user input and when they click submit . i will read input and plot the graph. Thanks in Advance
Reply all
Reply to author
Forward
0 new messages