问题
Is there a way to remove/hide the 'Edit Chart' link that appears in the bottom right half of your graph in the R version of Plotly?
回答1:
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.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/33499917/removing-the-edit-chart-link-from-an-r-plotly-graph