I have a plot that I am rendering in shiny
using plotly
and ggplot2
. However, I do not want the option bar that appears on hover to appear. Is there a way to use ggplotly(p)
and remove the option bar?
Asked
Active
Viewed 7,513 times
25

Climbs_lika_Spyder
- 6,004
- 3
- 39
- 53
1 Answers
32
There is a great answer on community plotly the short version:
library(plotly)
set.seed(100)
d <- diamonds[sample(nrow(diamonds), 1000), ]
Using ggplotly
:
p <- ggplot(d, aes(carat, price)) + geom_point()
ggplotly(p) %>% config(displayModeBar = F)
If you are not using ggplotly
you can do:
plot_ly(d, x = carat, y = price, text = paste("Clarity: ", clarity),
mode = "markers", color = carat, size = carat) %>% config(displayModeBar = F)

Climbs_lika_Spyder
- 6,004
- 3
- 39
- 53
-
3is there any way of doing this more permanently? for instance if I save this as a webpage, the toolbar is back – Bastiaan Quast Sep 28 '17 at 10:41
-
I wish I could upvote this answer everytime I come back for it (which is a lot) – Nate Jun 15 '21 at 12:14
-
@BastiaanQuast did you solve the issue of toolbar appearing on webpage? – StackEdd Jul 07 '21 at 15:34