Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to custom or display modebar in plotly?

Tags:

r

ggplot2

plotly

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 : enter image description here

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

like image 770
Estelle Duval Avatar asked May 25 '16 12:05

Estelle Duval


1 Answers

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'
))

Example output

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

like image 82
scogra77 Avatar answered Sep 19 '22 12:09

scogra77