knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The highdir framework defines four categories of specifications used to construct plots. Each category serves a distinct role in data definition, visual configuration, and geom‑level customization.
hd_spec()Defines the data specifications that apply universally across all geom types. These specifications describe the input data structure and mappings required by the plotting system.
hd_opts()Specifies presentation options that control chart appearance. These options are shared across multiple geoms and include settings related to layout, style, and display behavior.
Parameters that a given geom must provide for successful rendering. These vary by geom and represent the minimum information needed for the geom to function.
Additional parameters that may be supplied depending on the selected geom. These extend or refine the behavior of a geom but are not mandatory.
To see the required and optionals arguments:
geom_args("line") #args in geom line geom_args("arearange") # or highdir:::.get_geom("ranked_bar")$optional_args highdir:::.get_geom("arearange")$required_args
# Set package-wide defaults for the session hd_set_theme( hc_theme = "helsedirektoratet", colors = c("#025169", "#7C145C", "#C68803"), font = "Source Sans Pro" ) # All subsequent hd_make() calls use these settings automatically hd_make(spec, "column")
fig <- hd_make(spec, "column") # Inline JS fig <- hd_add_js(fig, code = "console.log('chart loaded');") # From a .js file fig <- hd_add_js(fig, file = "path/to/my-plugin.js") # From a bundled plugin (inst/js/<name>.js) fig <- hd_add_js(fig, plugin = "my-plugin")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.