Home > Software design >  Display ggplotly chart without toolbar
Display ggplotly chart without toolbar

Time:11-11

I am trying to hide the plotly toolbar when displaying a reactive ggplot chart within a Shiny app. Currently my code looks like this:

renderPlotly( ggplot(users_activated(), aes(x = month, y = n))  
geom_bar(stat = "identity"))

I have tried config(displayModeBar = F) to no avail.

CodePudding user response:

You need to convert your ggplot object to a plotly object before you can render it as one, or use plotly functions on it. ggplotly does that. Below, is an example using mpg dataset.

ggplotly(ggplot(mpg, aes(class, displ, color = manufacturer))  
  geom_point()
  ) %>% 
  config(displayModeBar = F)

  • Related