如何从ggplotly阴谋删除选项栏? [英] How to remove option bar from ggplotly plot?

查看:125
本文介绍了如何从ggplotly阴谋删除选项栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 plotly ggplot2 来渲染 shiny / code>。但是,我不希望悬停时出现的选项栏出现。有没有办法使用 ggplotly(p)并删除选项栏?

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?

推荐答案



There is a great answer on community plotly the short version:

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 ,您可以这样做:

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)

这篇关于如何从ggplotly阴谋删除选项栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆