简体   繁体   中英

Removing the Edit Chart link from an R plotly graph

有没有办法删除/隐藏出现在R版Plotly中图表右下半部分的“编辑图表”链接?

From the documentation, use config :

Plotly object p

p %>%
config(showLink = F)

You can see .js config options in action here .

Note: the "save and edit plot in cloud" button in the Mode Bar at the top still exists. You can turn off the Mode Bar with

config(displayModeBar = F)

There is a request on GitHub to edit specific Mode Bar buttons.

Just to add to Sam's fix (thanks!), there is a typo, I had to use ...

 tags$head(
    tags$style(HTML('a[data-title="Save and edit plot in cloud"]{display:none;}'))
) 

Note the capital "S" on "Save.

It can be done using CSS. Here an an example of it being done in a shiny application.

library(shiny)
library(plotly)
ui <- fluidPage( 
  tags$head(
    tags$style(HTML('a[data-title="save and edit plot in cloud"]{display:none;}'))
 ),
  plotlyOutput(outputId = "plot")
)

server <- function(input, output){
  output$plot <- renderPlotly({

plot_ly(type = "scatter",
        x = rnorm(10),
        y = rnorm(10),
        mode = "markers")
  })
}

shinyApp(ui, server)

I'm not sure how to remove it elsewhere or if there's an argument to turn it off, but this is how I do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM