Skip to contents

Parameters to add and customize the locale as used by roboplotr.

Usage

set_locale(locale = "fi-FI")

Arguments

locale

Character. Currently supports on only "en-GB", "en-US", "sv-SE", or "fi-FI" (the default).

Value

A list of class roboplot.set_locale

Examples

# You might want to display dates or numbers with some another default format
# for decimal marks or thousand marks.

set_roboplot_options(
  locale = set_locale("en-GB"),
  caption_template = "Source: {text}."
  )

d <- energiantuonti |>
  dplyr::filter(Alue == "USA", Suunta == "Tuonti") |>
  dplyr::mutate(value = value * 1000000, Alue = "Canada")

d |>
  roboplot(color = Alue,
           title = "Energy import",
           subtitle = "Mil. \u20AC",
           caption = "Statistics Finland")
#> Error in map(split_d, function(g) {    tracetype <- unique(g$roboplot.plot.type)    trace_labels <- roboplotr_trace_labels(tracetype, labels,         names(d))    hoverlab <- case_when(tracetype == "pie" ~ "label", any(c("horizontal",         "horizontalfill", "horizontalstack") %in% g$roboplot.plot.type) &         is.null(pattern) & quo_name(color) != ticktypes$y ~ "text",         TRUE ~ "customdata")    hovertemplate <- roboplotr_hovertemplate(hovertext, lab = hoverlab,         ticktypes)    if (any(unique(pull(g, !!color)) %in% secondary_yaxis)) {        legend_rank <- mean(g$roboplot.legend.rank) + max(d$roboplot.legend.rank)    }    else {        legend_rank <- mean(g$roboplot.legend.rank)    }    .fontsize <- getOption("roboplot.font.main")$size    g <- mutate(g, roboplot.bg.color = roboplotr_alter_color(.data$roboplot.trace.color,         "dark"), roboplot.tx.color = roboplotr_text_color_picker(.data$roboplot.bg.color,         .fontsize))    text_inside <- any(tracetype == "pie" & trace_labels$style !=         "none", tracetype == "bar" & trace_labels$style %in%         c("mini", "auto", "inside"))    if (text_inside) {        if (trace_labels$style == "mini") {            g <- mutate(g, roboplot.in.tx.color = "#FFFFFF00")        }        else {            g <- mutate(g, roboplot.in.tx.color = roboplotr_text_color_picker(.data$roboplot.trace.color,                 getOption("roboplot.font.caption")$size))        }    }    if (!is.null(attributes(g)$roboplot.confidence.area)) {        show.legend <- attributes(g)$roboplot.confidence.area$show_legend        g <- mutate(g, roboplot.confidence.label = str_c(.data$roboplot.plot.text,             "\n", .data[[attributes(g)$roboplot.confidence.area$col]]),             roboplot.plot.text = .data[[attributes(g)$roboplot.confidence.area$col]],             )        if (!is.character(g[[attributes(g)$roboplot.confidence.area$col]])) {            legend_rank <- legend_rank + 10 + as.numeric(unique(g[[attributes(g)$roboplot.confidence.area$col]]))        }        else {            legend_rank <- legend_rank + 10 + 1        }    }    else {        if (is.null(highlight)) {            if (!is.null(pattern_showlegend) & trace_showlegend) {                show.legend <- pattern_showlegend[as.character(unique(g[[as_name(pattern)]]))]            }            else {                show.legend <- trace_showlegend            }        }        else {            show.legend <- roboplotr_highlight_legend(highlight,                 g)        }    }    .legendgrouptitle <- NULL    if ("pie" %in% plot_type) {        .legendgroup <- "pie"    }    else {        .legendgroup <- as.character(unique(pull(g, {            {                color            }        })))    }    if (!is.null(secondary_yaxis)) {        if (as.character(unique(pull(g, {            {                color            }        }))) %in% secondary_yaxis) {            .legendgrouptitle <- ticktypes$y2legend            .legendgroup <- "R"        }        else {            .legendgrouptitle <- ticktypes$ylegend            .legendgroup <- "L"        }    }    error_x <- NULL    error_y <- NULL    if (!is.null(confidence$type)) {        if (confidence$type == "bars") {            if (!quo_is_null(confidence$error_x)) {                error_x <- list(array = confidence$error_x, color = confidence$xcolor)            }            if (!quo_is_null(confidence$error_y)) {                error_y <- list(array = g[["roboplot.errorbar.max"]],                   arrayminus = g[["roboplot.errorbar.min"]],                   color = confidence$ycolor)            }        }    }    if (is.null(updatemenu)) {        trace_visible <- T    }    else {        trace_visible <- unique(g$roboplot.update.menu) == updatemenu$selected    }    plotting_params <- list(color = color, constraintext = ifelse(!is.null(trace_labels$size),         "none", "both"), customdata = if (!is.null(attributes(g)$roboplot.confidence.area)) {        ~roboplot.confidence.label    } else if (!quo_is_null(hovertext$col)) {        as.formula(str_c("~", as_label(hovertext$col)))    } else if (any(c("horizontal", "horizontalfill", "horizontalstack") %in%         g$roboplot.plot.mode)) {        ~roboplot.horizontal.label    } else {        ~roboplot.plot.text    }, data = g, direction = "clockwise", error_x = error_x,         error_y = error_y, fill = unlist(ifelse(!is.null(attributes(g)$roboplot.confidence.area),             list("toself"), list(NULL))), fillcolor ~ color,         hoverlabel = list(bgcolor = ~roboplot.bg.color, bordercolor = first(unlist(unique(getOption("roboplot.grid")[c("xcolor",             "ycolor")]))), font = ~append(getOption("roboplot.font.main")[c("family",             "size")], list(color = roboplot.tx.color))), hoveron = "points+fills",         hovertemplate = hovertemplate, insidetextfont = list(family = getOption("roboplot.font.main")$family,             size = trace_labels$size %||% getOption("roboplot.font.main")$size,             color = ~roboplot.in.tx.color), labels = color, legendgroup = .legendgroup,         legendgrouptitle = list(text = .legendgrouptitle, font = getOption("roboplot.font.main")[c("color",             "family", "size")]), legendrank = legend_rank, line = ~list(width = roboplot.linewidth,             dash = roboplot.dash, smoothing = attributes(g)$roboplot.confidence.area$smoothing %||%                 0.5, shape = case_when(!is.null(attributes(g)$roboplot.confidence.area) ~                 "spline", roboplot.plot.mode == "step" ~ "hv",                 roboplot.plot.mode == "smooth" ~ "spline", TRUE ~                   "linear")), marker = list(colors = ~roboplot.trace.color,             line = getOption("roboplot.trace.border"), symbol = markers$symbol,             size = markers$size, pattern = ~list(shape = roboplot.pattern)),         mode = {            .mode <- str_replace_all(unique(g$roboplot.plot.mode),                 c(`^smooth$` = "lines", `^line$` = "lines", `^step$` = "lines",                   `^scatter$` = "markers", `scatter\\+line` = "markers+lines"))            if (tracetype == "scatter" & trace_labels$style !=                 "none") {                .mode <- str_c(.mode, "+text")            }            .mode        }, name = ~if (!is.null(legend$maxwidth)) {            str_trunc(as.character(roboplot.plot.text), legend$maxwidth)        } else {            roboplot.plot.text        }, offset = if ("horizontalfill" %in% g$roboplot.plot.mode) {            ~roboplot.bar.offset        } else {            NULL        }, offsetgroup = ~str_c(roboplot.pattern, roboplot.trace.color),         opacity = attributes(g)$roboplot.confidence.area$opacity,         orientation = ifelse(any(c("horizontal", "horizontalfill",             "horizontalstack") %in% g$roboplot.plot.mode) & "bar" %in%             g$roboplot.plot.type, "h", "v"), rotation = rotation,         showlegend = show.legend, sort = F, text = if (any(c("horizontal",             "horizontalfill", "horizontalstack") %in% g$roboplot.plot.mode)) {            ~roboplot.horizontal.label        } else {            ~roboplot.plot.text        }, textfont = list(color = ~trace_labels$color %||% roboplot.trace.color,             size = ~trace_labels$size %||% getOption("roboplot.font.main")$size),         textinfo = "percent", textposition = {            if (tracetype == "scatter" & trace_labels$style ==                 "auto") {                .y <- round(g[[ticktypes$y]], max(hovertext$rounding -                   2, 0))                str_replace_all(as.character(tidyr::fill(tibble(value = na_if(c(ifelse(.y[1] >=                   .y[2], 1, -1), sign(diff(.y))), 0)), value)$value),                   c(`-1` = "bottom center", `1` = "top center"))            } else {                case_when(trace_labels$style == "none" ~ "none",                   tracetype == "bar" & trace_labels$style ==                     "mini" ~ "auto", tracetype == "bar" ~ trace_labels$style,                   tracetype == "scatter" & trace_labels$style ==                     "last" ~ "middle right", tracetype == "scatter" &                     trace_labels$style == "auto" ~ "top center",                   tracetype == "pie" ~ "inside", TRUE ~ "none")            }        }, texttemplate = if (!quo_is_null(trace_labels$text_col)) {            if (trace_labels$style == "last") {                .y <- g[[as_label(trace_labels$text_col)]]                .y[-length(.y)] <- ""                .y            } else {                as.formula(str_c("~", as_label(trace_labels$text_col)))            }        } else if (tracetype == "pie") {            NULL        } else if (any(c("horizontal", "horizontalfill", "horizontalstack") %in%             g$roboplot.plot.mode)) {            "%{x:,.1f}"        } else if (tracetype == "scatter" & trace_labels$style ==             "auto") {            .y <- round(g[[ticktypes$y]], max(hovertext$rounding -                 2, 0))            .p <- tidyr::fill(tibble(value = na_if(c(ifelse(.y[1] >=                 .y[2], 1, -1), sign(diff(.y))), 0)), value)$value            .y <- pull(mutate(tidyr::fill(tibble(check = na_if(c(ifelse(sign(.y[2] -                 .y[1]) < 0, -1, 1), sign(diff(.y))), 0)), check),                 check = slider::slide_dbl(check, ~.x[[1]] !=                   .x[[2]], .after = 1, .complete = T)), check)            .y[c(1, length(.y))] <- 1            .y <- roboplotr_format_robotable_numeric(ifelse(.y,                 g[[ticktypes$y]], NA), rounding = max(hovertext$rounding -                 1, 0), na_value = "")            ifelse(.p > 0, str_c(.y, "\n"), str_c("\n", .y))        } else if (trace_labels$style == "last") {            .y <- g[[ticktypes$y]]            .y[-length(.y)] <- ""            .y        } else {            "%{y:,.1f}"        }, type = ~tracetype, values = as.formula(str_c("~",             ticktypes$y)), visible = trace_visible, width = if ("horizontalfill" %in%             g$roboplot.plot.mode) {            ~roboplot.bar.width        } else {            NULL        }, x = as.formula(str_c("~", ticktypes$x)), xhoverformat = ifelse(ticktypes$xticktype ==             "date", ticktypes$dateformat, ""), y = as.formula(str_c("~",             ifelse(!is.null(legend$maxwidth) & ticktypes$y !=                 "value", "roboplot.trunc", ticktypes$y))))    shared_params <- c("customdata", "data", "error_x", "error_y",         "hoverlabel", "hovertemplate", "legendgroup", "legendgrouptitle",         "legendrank", "showlegend", "text", "textposition", "texttemplate",         "type", "visible")    if (!is.null(attributes(g)$roboplot.confidence.area)) {        shared_params <- c(shared_params, "fill", "fillcolor",             "opacity", "hoveron")    }    if (text_inside) {        shared_params <- c(shared_params, "insidetextfont")    }    if (!is.null(trace_labels$color) | !is.null(trace_labels$size)) {        shared_params <- c(shared_params, "textfont")    }    if (!is.null(trace_labels$size) & tracetype == "bar") {        shared_params <- c(shared_params, "constraintext")    }    if (tracetype %in% "scatter" & any(c("line", "step", "smooth") %in%         g$roboplot.plot.mode)) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "line", "mode", "name", "color", "xhoverformat")]    }    else if (tracetype == "scatter" & "scatter+line" %in% g$roboplot.plot.mode) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "line", "mode", "name", "marker", "color", "xhoverformat")]    }    else if (tracetype == "scatter" & "scatter" %in% g$roboplot.plot.mode) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "mode", "name", "color", "marker", "xhoverformat")]    }    else if (tracetype == "bar" & any(c("horizontal", "horizontalfill",         "horizontalstack") %in% g$roboplot.plot.mode)) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "offsetgroup", "orientation", "offset", "width",             "color", "name", "marker")]    }    else if (tracetype == "bar") {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "offsetgroup", "name", "color", "marker", "xhoverformat")]    }    else if (tracetype == "pie") {        plotting_params <- plotting_params[c(shared_params, "labels",             "textinfo", "direction", "rotation", "sort", "marker",             "values")]    }    if (!is.null(secondary_yaxis)) {        if (as.character(unique(pull(g, {            {                color            }        }))) %in% secondary_yaxis) {            plotting_params$yaxis <- "y2"        }    }    plotting_params}):  In index: 1.
#> Caused by error in `na_if()`:
#> ! could not find function "na_if"

# This works on dates, too, if you need to show an exact date. In this
# example you wouldn't, and it only matters on the hoverlabel here, but let's
# force roboplotr() to display dates at by-day accuracy for the sake of example
# by using data frequency of "Daily".

attr(d, "frequency") <- "Daily"

d |> roboplot(color = Alue,
              title = "Energy import",
              subtitle = "Mil. \u20AC",
              caption = "Statistics Finland")
#> Error in map(split_d, function(g) {    tracetype <- unique(g$roboplot.plot.type)    trace_labels <- roboplotr_trace_labels(tracetype, labels,         names(d))    hoverlab <- case_when(tracetype == "pie" ~ "label", any(c("horizontal",         "horizontalfill", "horizontalstack") %in% g$roboplot.plot.type) &         is.null(pattern) & quo_name(color) != ticktypes$y ~ "text",         TRUE ~ "customdata")    hovertemplate <- roboplotr_hovertemplate(hovertext, lab = hoverlab,         ticktypes)    if (any(unique(pull(g, !!color)) %in% secondary_yaxis)) {        legend_rank <- mean(g$roboplot.legend.rank) + max(d$roboplot.legend.rank)    }    else {        legend_rank <- mean(g$roboplot.legend.rank)    }    .fontsize <- getOption("roboplot.font.main")$size    g <- mutate(g, roboplot.bg.color = roboplotr_alter_color(.data$roboplot.trace.color,         "dark"), roboplot.tx.color = roboplotr_text_color_picker(.data$roboplot.bg.color,         .fontsize))    text_inside <- any(tracetype == "pie" & trace_labels$style !=         "none", tracetype == "bar" & trace_labels$style %in%         c("mini", "auto", "inside"))    if (text_inside) {        if (trace_labels$style == "mini") {            g <- mutate(g, roboplot.in.tx.color = "#FFFFFF00")        }        else {            g <- mutate(g, roboplot.in.tx.color = roboplotr_text_color_picker(.data$roboplot.trace.color,                 getOption("roboplot.font.caption")$size))        }    }    if (!is.null(attributes(g)$roboplot.confidence.area)) {        show.legend <- attributes(g)$roboplot.confidence.area$show_legend        g <- mutate(g, roboplot.confidence.label = str_c(.data$roboplot.plot.text,             "\n", .data[[attributes(g)$roboplot.confidence.area$col]]),             roboplot.plot.text = .data[[attributes(g)$roboplot.confidence.area$col]],             )        if (!is.character(g[[attributes(g)$roboplot.confidence.area$col]])) {            legend_rank <- legend_rank + 10 + as.numeric(unique(g[[attributes(g)$roboplot.confidence.area$col]]))        }        else {            legend_rank <- legend_rank + 10 + 1        }    }    else {        if (is.null(highlight)) {            if (!is.null(pattern_showlegend) & trace_showlegend) {                show.legend <- pattern_showlegend[as.character(unique(g[[as_name(pattern)]]))]            }            else {                show.legend <- trace_showlegend            }        }        else {            show.legend <- roboplotr_highlight_legend(highlight,                 g)        }    }    .legendgrouptitle <- NULL    if ("pie" %in% plot_type) {        .legendgroup <- "pie"    }    else {        .legendgroup <- as.character(unique(pull(g, {            {                color            }        })))    }    if (!is.null(secondary_yaxis)) {        if (as.character(unique(pull(g, {            {                color            }        }))) %in% secondary_yaxis) {            .legendgrouptitle <- ticktypes$y2legend            .legendgroup <- "R"        }        else {            .legendgrouptitle <- ticktypes$ylegend            .legendgroup <- "L"        }    }    error_x <- NULL    error_y <- NULL    if (!is.null(confidence$type)) {        if (confidence$type == "bars") {            if (!quo_is_null(confidence$error_x)) {                error_x <- list(array = confidence$error_x, color = confidence$xcolor)            }            if (!quo_is_null(confidence$error_y)) {                error_y <- list(array = g[["roboplot.errorbar.max"]],                   arrayminus = g[["roboplot.errorbar.min"]],                   color = confidence$ycolor)            }        }    }    if (is.null(updatemenu)) {        trace_visible <- T    }    else {        trace_visible <- unique(g$roboplot.update.menu) == updatemenu$selected    }    plotting_params <- list(color = color, constraintext = ifelse(!is.null(trace_labels$size),         "none", "both"), customdata = if (!is.null(attributes(g)$roboplot.confidence.area)) {        ~roboplot.confidence.label    } else if (!quo_is_null(hovertext$col)) {        as.formula(str_c("~", as_label(hovertext$col)))    } else if (any(c("horizontal", "horizontalfill", "horizontalstack") %in%         g$roboplot.plot.mode)) {        ~roboplot.horizontal.label    } else {        ~roboplot.plot.text    }, data = g, direction = "clockwise", error_x = error_x,         error_y = error_y, fill = unlist(ifelse(!is.null(attributes(g)$roboplot.confidence.area),             list("toself"), list(NULL))), fillcolor ~ color,         hoverlabel = list(bgcolor = ~roboplot.bg.color, bordercolor = first(unlist(unique(getOption("roboplot.grid")[c("xcolor",             "ycolor")]))), font = ~append(getOption("roboplot.font.main")[c("family",             "size")], list(color = roboplot.tx.color))), hoveron = "points+fills",         hovertemplate = hovertemplate, insidetextfont = list(family = getOption("roboplot.font.main")$family,             size = trace_labels$size %||% getOption("roboplot.font.main")$size,             color = ~roboplot.in.tx.color), labels = color, legendgroup = .legendgroup,         legendgrouptitle = list(text = .legendgrouptitle, font = getOption("roboplot.font.main")[c("color",             "family", "size")]), legendrank = legend_rank, line = ~list(width = roboplot.linewidth,             dash = roboplot.dash, smoothing = attributes(g)$roboplot.confidence.area$smoothing %||%                 0.5, shape = case_when(!is.null(attributes(g)$roboplot.confidence.area) ~                 "spline", roboplot.plot.mode == "step" ~ "hv",                 roboplot.plot.mode == "smooth" ~ "spline", TRUE ~                   "linear")), marker = list(colors = ~roboplot.trace.color,             line = getOption("roboplot.trace.border"), symbol = markers$symbol,             size = markers$size, pattern = ~list(shape = roboplot.pattern)),         mode = {            .mode <- str_replace_all(unique(g$roboplot.plot.mode),                 c(`^smooth$` = "lines", `^line$` = "lines", `^step$` = "lines",                   `^scatter$` = "markers", `scatter\\+line` = "markers+lines"))            if (tracetype == "scatter" & trace_labels$style !=                 "none") {                .mode <- str_c(.mode, "+text")            }            .mode        }, name = ~if (!is.null(legend$maxwidth)) {            str_trunc(as.character(roboplot.plot.text), legend$maxwidth)        } else {            roboplot.plot.text        }, offset = if ("horizontalfill" %in% g$roboplot.plot.mode) {            ~roboplot.bar.offset        } else {            NULL        }, offsetgroup = ~str_c(roboplot.pattern, roboplot.trace.color),         opacity = attributes(g)$roboplot.confidence.area$opacity,         orientation = ifelse(any(c("horizontal", "horizontalfill",             "horizontalstack") %in% g$roboplot.plot.mode) & "bar" %in%             g$roboplot.plot.type, "h", "v"), rotation = rotation,         showlegend = show.legend, sort = F, text = if (any(c("horizontal",             "horizontalfill", "horizontalstack") %in% g$roboplot.plot.mode)) {            ~roboplot.horizontal.label        } else {            ~roboplot.plot.text        }, textfont = list(color = ~trace_labels$color %||% roboplot.trace.color,             size = ~trace_labels$size %||% getOption("roboplot.font.main")$size),         textinfo = "percent", textposition = {            if (tracetype == "scatter" & trace_labels$style ==                 "auto") {                .y <- round(g[[ticktypes$y]], max(hovertext$rounding -                   2, 0))                str_replace_all(as.character(tidyr::fill(tibble(value = na_if(c(ifelse(.y[1] >=                   .y[2], 1, -1), sign(diff(.y))), 0)), value)$value),                   c(`-1` = "bottom center", `1` = "top center"))            } else {                case_when(trace_labels$style == "none" ~ "none",                   tracetype == "bar" & trace_labels$style ==                     "mini" ~ "auto", tracetype == "bar" ~ trace_labels$style,                   tracetype == "scatter" & trace_labels$style ==                     "last" ~ "middle right", tracetype == "scatter" &                     trace_labels$style == "auto" ~ "top center",                   tracetype == "pie" ~ "inside", TRUE ~ "none")            }        }, texttemplate = if (!quo_is_null(trace_labels$text_col)) {            if (trace_labels$style == "last") {                .y <- g[[as_label(trace_labels$text_col)]]                .y[-length(.y)] <- ""                .y            } else {                as.formula(str_c("~", as_label(trace_labels$text_col)))            }        } else if (tracetype == "pie") {            NULL        } else if (any(c("horizontal", "horizontalfill", "horizontalstack") %in%             g$roboplot.plot.mode)) {            "%{x:,.1f}"        } else if (tracetype == "scatter" & trace_labels$style ==             "auto") {            .y <- round(g[[ticktypes$y]], max(hovertext$rounding -                 2, 0))            .p <- tidyr::fill(tibble(value = na_if(c(ifelse(.y[1] >=                 .y[2], 1, -1), sign(diff(.y))), 0)), value)$value            .y <- pull(mutate(tidyr::fill(tibble(check = na_if(c(ifelse(sign(.y[2] -                 .y[1]) < 0, -1, 1), sign(diff(.y))), 0)), check),                 check = slider::slide_dbl(check, ~.x[[1]] !=                   .x[[2]], .after = 1, .complete = T)), check)            .y[c(1, length(.y))] <- 1            .y <- roboplotr_format_robotable_numeric(ifelse(.y,                 g[[ticktypes$y]], NA), rounding = max(hovertext$rounding -                 1, 0), na_value = "")            ifelse(.p > 0, str_c(.y, "\n"), str_c("\n", .y))        } else if (trace_labels$style == "last") {            .y <- g[[ticktypes$y]]            .y[-length(.y)] <- ""            .y        } else {            "%{y:,.1f}"        }, type = ~tracetype, values = as.formula(str_c("~",             ticktypes$y)), visible = trace_visible, width = if ("horizontalfill" %in%             g$roboplot.plot.mode) {            ~roboplot.bar.width        } else {            NULL        }, x = as.formula(str_c("~", ticktypes$x)), xhoverformat = ifelse(ticktypes$xticktype ==             "date", ticktypes$dateformat, ""), y = as.formula(str_c("~",             ifelse(!is.null(legend$maxwidth) & ticktypes$y !=                 "value", "roboplot.trunc", ticktypes$y))))    shared_params <- c("customdata", "data", "error_x", "error_y",         "hoverlabel", "hovertemplate", "legendgroup", "legendgrouptitle",         "legendrank", "showlegend", "text", "textposition", "texttemplate",         "type", "visible")    if (!is.null(attributes(g)$roboplot.confidence.area)) {        shared_params <- c(shared_params, "fill", "fillcolor",             "opacity", "hoveron")    }    if (text_inside) {        shared_params <- c(shared_params, "insidetextfont")    }    if (!is.null(trace_labels$color) | !is.null(trace_labels$size)) {        shared_params <- c(shared_params, "textfont")    }    if (!is.null(trace_labels$size) & tracetype == "bar") {        shared_params <- c(shared_params, "constraintext")    }    if (tracetype %in% "scatter" & any(c("line", "step", "smooth") %in%         g$roboplot.plot.mode)) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "line", "mode", "name", "color", "xhoverformat")]    }    else if (tracetype == "scatter" & "scatter+line" %in% g$roboplot.plot.mode) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "line", "mode", "name", "marker", "color", "xhoverformat")]    }    else if (tracetype == "scatter" & "scatter" %in% g$roboplot.plot.mode) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "mode", "name", "color", "marker", "xhoverformat")]    }    else if (tracetype == "bar" & any(c("horizontal", "horizontalfill",         "horizontalstack") %in% g$roboplot.plot.mode)) {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "offsetgroup", "orientation", "offset", "width",             "color", "name", "marker")]    }    else if (tracetype == "bar") {        plotting_params <- plotting_params[c(shared_params, "x",             "y", "offsetgroup", "name", "color", "marker", "xhoverformat")]    }    else if (tracetype == "pie") {        plotting_params <- plotting_params[c(shared_params, "labels",             "textinfo", "direction", "rotation", "sort", "marker",             "values")]    }    if (!is.null(secondary_yaxis)) {        if (as.character(unique(pull(g, {            {                color            }        }))) %in% secondary_yaxis) {            plotting_params$yaxis <- "y2"        }    }    plotting_params}):  In index: 1.
#> Caused by error in `na_if()`:
#> ! could not find function "na_if"

# Revert to defaults:
set_roboplot_options(reset = TRUE)