【发布时间】:2017-03-06 12:27:59
【问题描述】:
我有一个使用plotly 和ggplot2 在shiny 中渲染的情节。但是,我不希望出现悬停时出现的选项栏。有没有办法使用ggplotly(p) 去掉选项栏?
【问题讨论】:
标签: r ggplot2 shiny plotly shinydashboard
我有一个使用plotly 和ggplot2 在shiny 中渲染的情节。但是,我不希望出现悬停时出现的选项栏。有没有办法使用ggplotly(p) 去掉选项栏?
【问题讨论】:
标签: r ggplot2 shiny plotly shinydashboard
community plotly 短版上有一个很好的答案:
library(plotly)
set.seed(100)
d <- diamonds[sample(nrow(diamonds), 1000), ]
使用ggplotly:
p <- ggplot(d, aes(carat, price)) + geom_point()
ggplotly(p) %>% config(displayModeBar = F)
如果你不使用ggplotly,你可以这样做:
plot_ly(d, x = carat, y = price, text = paste("Clarity: ", clarity),
mode = "markers", color = carat, size = carat) %>% config(displayModeBar = F)
【讨论】: