multiple plots in the same page

33 views
Skip to first unread message

Pramod Sinha

unread,
Feb 26, 2015, 6:31:26 AM2/26/15
to shiny-...@googlegroups.com
Kindly bear with me, if my question sounds too basic for you all - as am just few hours old for shiny. I am trying creating multiple plots (2 X 3) in the same page, but am not able to do so after repeated attempts.
ui.R
shinyUI(fluidPage(
    mainPanel(
        plotOutput("distPlot")
        plotOutput("simpPlot")
    )
))

server.R
shinyServer(function(input,output) {
    x <- round(yoy.monthly(tsdb("in.iip") ), 2)
    output$distPlot <- renderPlot({
        plot(x, col = "darkblue", xlab = "", ylab = "Y-o-Y Change (Per cent)", main = "IIP", lwd = 3)
        grid()
    })
    output$simpPlot <- renderPlot({
        y <- round(yoy.monthly(tsdb("in.cpi.iw")), 2)
        plot(y, col = "darkgreen", xlab = "", ylab = "Y-o-Y Change (Per cent)", main = "CPI-IW", lwd = 3)
        grid()
    })
})

Treat x and y as typical numeric vector.

So, this is how i want the plots to be generated:

Plot 1             Plot 2            Plot 3





Plot 4             Plot 5            Plot 6


                      


Joe Cheng

unread,
Feb 26, 2015, 2:13:33 PM2/26/15
to Pramod Sinha, shiny-...@googlegroups.com
If you remove the grid() calls, do you at least see two plots being created?

--
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/e8a891cc-6d56-4e7c-9c6f-b05ab4850202%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages