1

I've written a shiny application that functions properly with no errors, but every time I run the program, the ggplot() gets plotted in RStudio's Viewer Panel, but I want it to show up in the mainpanel. How do I get it to switch and plot in my mainPanel of my shiny application?

In my code, my mainPanel isn't inside my sidebarPanel, and my plotOutput gets called correctly.

mainPanel(plotOutput("plot1"))

Here's the server call to plot1. All my dataframe manipulation and my ggplot() code is within data1()

output$plot1 <- renderPlot({data1()})  
  • 2
    RStudio may be defaulting to showing your shiny app (which only contains a `ggplot`) in the Viewer. You can change the default settings to open your shiny app in your browser. See this thread: https://stackoverflow.com/questions/35311318/opening-shiny-app-directly-in-the-default-browser – Hallie Swan Mar 28 '18 at 18:26
  • could you try to turn off all Panels and leave dashboardBody and see what happens dashboardHeader(disable = TRUE), dashboardSidebar(disable = TRUE), dashboardBody(plotOutput("plot1") ) – ngamita Mar 28 '18 at 18:28
  • The sidebar panel pops up in the window/browser correctly, but the plot still shows up in the RStudio Viewer, even when I change the default viewer to browser. –  Mar 28 '18 at 18:44
  • 1
    you need to show more in the code what you are doing. if you are using `data1()` a reactive object that has the ggplot output need to look at the complete code. I am sure it is a simple fix, you need to provide a reproducible example. – user5249203 Mar 28 '18 at 18:51
  • @user5249203 the post has been edited to show all the code –  Mar 28 '18 at 19:21
  • @NotAMathMan, what is the data format? Can you paste the `head(df) ` of the dataframe you are plotting? or upload your excel sheet somewhere – user5249203 Mar 29 '18 at 14:58
  • from what I see in your code. You need to output the ggplot on `output$plot1 <- ggplot( ....` – user5249203 Mar 29 '18 at 15:16

1 Answers1

0

Instead of

plotOutput() and renderPlot()

use:

ggiraphOutput() and renderggiraph()

chasemc
  • 849
  • 6
  • 12