Reputation: 49
I want to display a plotly plot using R-shiny, but with no mode bar. I am trying to use the config option but it is not working. Here is the code:
library(shiny)
library(plotly)
ui <- fluidPage(
plotlyOutput("plot")
)
server <- function(input, output, session) {
output$plot <- renderPlotly({
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)
config(p, displayModeBar = FALSE)
p
})
}
shinyApp(ui, server)
This code displays the plot correctly but ignores the configuration. The mode bar still appears. I also tried different configuration options, like displaylogo = FALSE, collaborate = FALSE to hide the logo and collaboration option, respectively, and they are ignored as well.
Does anybody have any idea of why it's not working? my plotly version is 4.8.0
I would really appreciate any insight on this.
Upvotes: 0
Views: 511
Reputation: 497
Another solution is defining your p as:
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length) %>%
config(p, displayModeBar = FALSE)
or just running:
plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length) %>%
config(p, displayModeBar = FALSE)
Upvotes: 1