如何自定义或显示modebar? [英] How to custom or display modebar in plotly?

查看:260
本文介绍了如何自定义或显示modebar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定制模式栏(右上角),以便保持缩放,平移,框选,放大和缩小。如果这是不可能的,我宁愿显示模式栏。

I would like to custom the modebar (on top right) so as to keep just "zoom","pan","box select","zoom in" and "zoom out". If it's not possible, I prefer display the modebar.

这里的图表和代码:

Here graph and code :

x <- c(1:15)
y <- c(1:15)
xy <- as.data.frame(cbind(x,y))
example <- ggplot(data = xy,aes(x = x,y = y))+geom_line()
ggplotly(example)

感谢您的帮助

Thank you for help

推荐答案

使用您的示例:

Using your example:

x <- c(1:15)
y <- c(1:15)
xy <- as.data.frame(cbind(x,y))
example <- ggplot(data = xy,aes(x = x,y = y))+geom_line()

ggplotly(example) %>% config(displaylogo = FALSE,
modeBarButtonsToRemove = list(
    'sendDataToCloud',
    'toImage',
    'autoScale2d',
    'resetScale2d',
    'hoverClosestCartesian',
    'hoverCompareCartesian'
))

输出示例

其他选项包括:'zoom2d','pan2d',' select2d','lasso2d','zoomIn2d'和'zoomOut2d'

Other options include: 'zoom2d','pan2d','select2d','lasso2d','zoomIn2d', and 'zoomOut2d'

这篇关于如何自定义或显示modebar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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