| Title: | Utilities for Rijksoverheid-Styled Data Visualizations |
|---|---|
| Description: | Provides shared utilities for the ROvis suite, including Rijksoverheid color palettes, palette validation, and font-availability checks, so that themes across the ROvis packages stay consistent with official Rijksoverheid design guidelines. |
| Authors: | ROvis team [cre, aut] |
| Maintainer: | ROvis team <[email protected]> |
| License: | EUPL (>= 1.2) |
| Version: | 0.1.0 |
| Built: | 2026-10-21 12:17:05 UTC |
| Source: | https://github.com/rivm-syso/ROvis.utils |
Used by ro_gg_theme and ro_e_theme to resolve the font family before
building a chart. When the RijksoverheidSansWebText font is requested but
not installed, the function tries "Verdana", then "Arial", and only
uses one that is actually installed. If neither is available either (for
example on Linux/CI images that ship none of them), the function informs
the user and falls back to the first font it can find on the system. When
any other font is requested but not installed, the function aborts with
an actionable error message.
ro_check_if_font_available( target_font_family, arg = caller_arg(target_font_family), call = caller_env() )ro_check_if_font_available( target_font_family, arg = caller_arg(target_font_family), call = caller_env() )
target_font_family |
Character. Font family name to check. No
default: this is a validation function, so a sensible default (e.g.
|
arg, call
|
Passed on to |
The resolved font family name: target_font_family itself if
installed; otherwise, for the RO font, the first available font among
"Verdana" and "Arial", or (if neither is installed) the first font
found on the system. Aborts for any other unavailable font.
Other ggplot2:
get_color_palette(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_color_validate(),
ro_get_color_palette(),
ro_gg_create_palette(),
ro_show_colors(),
ro_show_colors_get_df()
Other ggplotly:
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
Other plotly:
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
Other echarts4r:
ro_color(),
ro_color_categorical(),
ro_color_seq(),
ro_color_seq_named()
Returns hex code(s) of color_name. All 18 RIVM colors and their
lighter shades can be accessed with this function. The names of
RIVM colors are listed at the rijkshuisstijl website, or, can be viewed by
running another function, ro_show_colors.
To access a vector of hex color codes of the categorical palette, use the ROvis
function ro_color_categorical.
ro_color(color_name = "hemelblauw")ro_color(color_name = "hemelblauw")
color_name |
Character or vector of characters. Default="hemelblauw". Can be one of:
|
returns the (array of) hex color code(s)
Other ggplot2:
get_color_palette(),
ro_check_if_font_available(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_color_validate(),
ro_get_color_palette(),
ro_gg_create_palette(),
ro_show_colors(),
ro_show_colors_get_df()
Other ggplotly:
ro_check_if_font_available(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
Other plotly:
ro_check_if_font_available(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
Other echarts4r:
ro_check_if_font_available(),
ro_color_categorical(),
ro_color_seq(),
ro_color_seq_named()
ro_color() ro_color("robijnrood") ro_color("donkergeel_tint75") ro_color("grijs_3") ro_color(c("lintblauw", "robijnrood", "mintgroen_tint30"))ro_color() ro_color("robijnrood") ro_color("donkergeel_tint75") ro_color("grijs_3") ro_color(c("lintblauw", "robijnrood", "mintgroen_tint30"))
Returns a vector of hex color codes of the categorical RIVM color palette.
This is especially useful when you don't need to assign a specific color to
a specific category. If you do, for example for male/female, we recommend to
assign the colors explicitly using the ro_color function.
ro_color_categorical()ro_color_categorical()
Returns a character vector of hex color codes of the categorical palette.
Other ggplotly:
ro_check_if_font_available(),
ro_color(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
Other plotly:
ro_check_if_font_available(),
ro_color(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
Other echarts4r:
ro_check_if_font_available(),
ro_color(),
ro_color_seq(),
ro_color_seq_named()
Other ggplot2:
get_color_palette(),
ro_check_if_font_available(),
ro_color(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_color_validate(),
ro_get_color_palette(),
ro_gg_create_palette(),
ro_show_colors(),
ro_show_colors_get_df()
ro_color_categorical()ro_color_categorical()
ro_color_palette(palette_name)ro_color_palette(palette_name)
palette_name |
one of:
|
named vector with hex color codes
Other ggplot2:
get_color_palette(),
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_seq(),
ro_color_seq_named(),
ro_color_validate(),
ro_get_color_palette(),
ro_gg_create_palette(),
ro_show_colors(),
ro_show_colors_get_df()
Other ggplotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
Other plotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_seq(),
ro_color_seq_named(),
ro_get_color_palette()
ro_color_palette("categorical")ro_color_palette("categorical")
Useful to visualize ordered categorical data, for example regions on a map.
The function takes two hex color codes and returns a color sequence of the desired
length where these colors gradually fade into one another.
This could be a transition from a light to a dark shade, or one color to a different color,
see examples. Uses pal_seq_gradient() from the scales package under the hood.
To access the hex color code of a specific color, use the ro_color function.
ro_color_seq(low, high, n)ro_color_seq(low, high, n)
low |
Character. The hexadecimal code (#RRGGBB) of the color for 'low' values. This color will be the first hex code of the sequence. |
high |
Character. The hexadecimal code (#RRGGBB) of the color for 'high' values. This color will be the last hex code of the sequence. |
n |
Integer. Desired amount of colors in the sequence (including the specified colors). |
sequence of hex color codes sorted from the 'low' to the 'high' color.
Other ggplotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq_named(),
ro_get_color_palette()
Other plotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq_named(),
ro_get_color_palette()
Other echarts4r:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_seq_named()
Other ggplot2:
get_color_palette(),
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq_named(),
ro_color_validate(),
ro_get_color_palette(),
ro_gg_create_palette(),
ro_show_colors(),
ro_show_colors_get_df()
ro_color_seq("#F7D9E7", "#CA005D", 5) ro_color_seq(ro_color("robijnrood_tint15"), ro_color("robijnrood"), 7) ro_color_seq(ro_color("hemelblauw_tint30"), ro_color("hemelblauw"), 4) ro_color_seq(ro_color("hemelblauw"), ro_color("robijnrood"), 8)ro_color_seq("#F7D9E7", "#CA005D", 5) ro_color_seq(ro_color("robijnrood_tint15"), ro_color("robijnrood"), 7) ro_color_seq(ro_color("hemelblauw_tint30"), ro_color("hemelblauw"), 4) ro_color_seq(ro_color("hemelblauw"), ro_color("robijnrood"), 8)
A wrapper function that maps RIVM colors to specific levels/classes to use
in scale_color_manual for maps or other visualizations.
Note that this function is dependent on the functions ro_color() and ro_color_seq().
ro_color_seq_named( cat_names, low_col = "robijnrood", high_col = "robijnrood_tint15", NA_cat_name = "NA", NA_cat_col = "grijs_5" )ro_color_seq_named( cat_names, low_col = "robijnrood", high_col = "robijnrood_tint15", NA_cat_name = "NA", NA_cat_col = "grijs_5" )
cat_names |
Character. Vector that holds categories. |
low_col |
Character. The hexadecimal code (#RRGGBB) of the color for 'low' values. This color will be the first hex code of the sequence. Default: "robijnrood". |
high_col |
Character. The hexadecimal code (#RRGGBB) of the color for 'high' values. This color will be the last hex code of the sequence. Default: "robijnrood_tint15". |
NA_cat_name |
Character, specified 'no-record' category to search for. Default: "Geen meldingen". |
NA_cat_col |
Character: sets the hexadecimal code (#RRGGBB) for the 'no_record' category. Default: "grijs_5". |
Other ggplotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_get_color_palette()
Other plotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_get_color_palette()
Other echarts4r:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_seq()
Other ggplot2:
get_color_palette(),
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_validate(),
ro_get_color_palette(),
ro_gg_create_palette(),
ro_show_colors(),
ro_show_colors_get_df()
ro_color_seq_named( cat_names = c("<=99", "100 t/m 399", "400+", "Geen meldingen"), NA_cat_name = "Geen meldingen" ) ro_color_seq_named( cat_names = c("<10", "10-15", "16+", "NA"), low_col = "lichtblauw", high_col = "hemelblauw", NA_cat_col = "rood" )ro_color_seq_named( cat_names = c("<=99", "100 t/m 399", "400+", "Geen meldingen"), NA_cat_name = "Geen meldingen" ) ro_color_seq_named( cat_names = c("<10", "10-15", "16+", "NA"), low_col = "lichtblauw", high_col = "hemelblauw", NA_cat_col = "rood" )
ro_get_color_palette(palette_name)ro_get_color_palette(palette_name)
palette_name |
one of:
|
named vector with hex color codes
Other ggplot2:
get_color_palette(),
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_color_validate(),
ro_gg_create_palette(),
ro_show_colors(),
ro_show_colors_get_df()
Other ggplotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named()
Other plotly:
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named()
ROvis.utils::ro_get_color_palette("categorical")ROvis.utils::ro_get_color_palette("categorical")
Generates Rd markup for badge(s) indicating which plotting/output
backend(s) (ggplot2, echarts4r, plotly, gt, or DT) a function belongs to.
Mirrors the mechanism used by badge: the HTML help page
shows an SVG badge from man/figures/, while non-HTML help (e.g. the
console) falls back to bracketed text. It is a documentation-time helper
(not exported), used via `r ro_group_badge("ggplot2")` inside roxygen
comments.
ro_group_badge(group)ro_group_badge(group)
group |
Character vector with one or more of |
A string containing Rd markup. Ends with \cr so any text
following it in the same roxygen paragraph starts on a new line.
Plots the full RIVM color palette, a specified RIVM color palette, or a custom color palette.
Hoover over the palette to view the hex color codes.
ro_show_colors(palette_name = "full", custom_colors = NULL)ro_show_colors(palette_name = "full", custom_colors = NULL)
palette_name |
Character. Default="full". Can be one of:
|
custom_colors |
Character or vector of characters. Should be hexadecimal code(s) (#RRGGBB). It is advised to use the other ROvis color functions. To access the hex color code of a specific color, use the ro_color function. To access a vector of hex color codes of the categorical palette, use the ROvis function ro_color_categorical. |
Color palette in the Viewer pane.
Other ggplot2:
get_color_palette(),
ro_check_if_font_available(),
ro_color(),
ro_color_categorical(),
ro_color_palette(),
ro_color_seq(),
ro_color_seq_named(),
ro_color_validate(),
ro_get_color_palette(),
ro_gg_create_palette(),
ro_show_colors_get_df()
## Not run: ro_show_colors() ro_show_colors("categorical") ro_show_colors("custom", c(ro_color("donkergeel"), ro_color("paars_tint90"), ro_color("mosgroen"))) ro_show_colors("custom", "#76d2b6") ro_show_colors("custom", c( donkergeel = ro_color("donkergeel"), paars_tint90 = ro_color("paars_tint90"), mosgroen = ro_color("mosgroen") )) ro_show_colors("custom", ro_color_seq(ro_color("hemelblauw_tint15"), ro_color("hemelblauw"), 5)) ro_show_colors("custom", ro_color_seq(ro_color("robijnrood_tint15"), ro_color("robijnrood"), 12)) ## End(Not run)## Not run: ro_show_colors() ro_show_colors("categorical") ro_show_colors("custom", c(ro_color("donkergeel"), ro_color("paars_tint90"), ro_color("mosgroen"))) ro_show_colors("custom", "#76d2b6") ro_show_colors("custom", c( donkergeel = ro_color("donkergeel"), paars_tint90 = ro_color("paars_tint90"), mosgroen = ro_color("mosgroen") )) ro_show_colors("custom", ro_color_seq(ro_color("hemelblauw_tint15"), ro_color("hemelblauw"), 5)) ro_show_colors("custom", ro_color_seq(ro_color("robijnrood_tint15"), ro_color("robijnrood"), 12)) ## End(Not run)