Skip to contents

[toegankelijkheid]

Usage

ro_ply_disable_toolbar(fig)

Arguments

fig

A plotly object (from plotly::plot_ly() or plotly::ggplotly()).

Value

A plotly object without the modebar and with improved legend accessibility.

Details

Removes the plotly modebar (toolbar) for a cleaner look and disables the pop-up for the legend, which improves accessibility for keyboard users.

Examples

if (FALSE) { # \dontrun{
data <- tidyr::tibble(
  expand.grid(`Age group` = c("A", "B", "C", "D", "E"), `Sex` = c("Man", "Vrouw")),
  `Number of Cases` = sample(1:50, 10, TRUE)
)
library(ggplot2)
library(plotly)
p <- ggplot(data, aes(
  x = `Number of Cases`,
  y = `Age group`,
  fill = Sex,
  text = paste0(
    "Leeftijdsgroep: <b>", `Age group`, "</b><br>",
    "Geslacht: <b>", Sex, "</b><br>",
    "Aantal cases: <b>", `Number of Cases`, "</b>"
  )
)) +
  geom_col(position = "dodge") +
  labs(
    x = "Aantal cases",
    y = "Leeftijdsgroep",
    fill = "Geslacht"
  )
fig <- ggplotly(p, tooltip = "text")
fig <- ro_ply_keyboard_nav_barchart(fig)
fig <- ro_ply_keyboard_nav_legend(fig)
fig <- ro_ply_disable_toolbar(fig)
fig
} # }