Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Display ggplotly chart without toolbar

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading