library(rtemis.draw)
Attaching package: 'rtemis.draw'
The following object is masked from 'package:graphics':
Axis
Attaching package: 'rtemis.draw'
The following object is masked from 'package:graphics':
Axis
Theming is uniform across all three backends: theme is an argument to every draw_*() function and to the draw() generic itself, and it takes the same four kinds of value everywhere.
theme |
Behavior |
|---|---|
NULL (default) |
Auto-detect. The widget carries both themes and the browser picks by the active color scheme. |
theme_light() / theme_dark() |
Force one theme. |
A Theme object or a plain named list |
Use exactly this theme. |
NA |
No theme — the backend’s own defaults. |
With theme = NULL, a light and a dark theme are both serialized into the widget payload and the binding selects one at render time. That is why a chart in an IDE follows the editor’s color scheme without being told, and why charts on this page re-theme with the light/dark toggle in the navbar — Quarto’s toggle only rewrites body classes and fires no event, so the binding watches for the change itself.
2026-11-18 17:29:48 Removed 2 NA values from x [distribution_samples]
2026-11-18 17:29:48 Removed 2 NA values from x [distribution_samples]
theme = NA disables theming entirely, leaving raw ECharts defaults — for a page that registers its own ECharts theme.
theme_light() and theme_dark() take the same arguments and return a Theme. Most adjustments need only base_font_size, from which the title, axis, legend, and tooltip sizes are derived (title at 1.2×, everything else at 1×) unless set explicitly:
The full set of arguments:
base_font_size, title_font_size, subtitle_font_size, axis_label_font_size, legend_font_size, tooltip_font_size, font_family.color (the categorical palette), bg_color, fg_color, title_color, subtitle_color, legend_color, axis_color, grid_color.tooltip_bg, tooltip_border_color, tooltip_color.font_family takes a family name or a CSS font stack. Unless the stack ends in a generic family such as sans-serif, the system UI font follows it as the fallback. Its default is the rtemis.font_family option, which sets the font of every rtemis plot, for example in .Rprofile:
A widget shows the font where the viewer’s system has it installed or the page loads it. SVG export of diagrams measures labels in the font when it is installed and the ‘systemfonts’ package is available.
Set a palette on the theme and every chart drawn with it inherits it:
Theme classtheme_light() and theme_dark() are constructors over the Theme S7 class, which mirrors the object ECharts accepts as the second argument to echarts.init(). Build one directly for per-component control:
custom <- Theme(
color = rtemis_colors[c("teal", "orange", "magenta")],
background_color = "transparent",
text_style = TextStyle(font_family = "Helvetica", font_size = 13),
title = list(textStyle = list(fontSize = 20, fontWeight = "normal")),
value_axis = list(splitLine = list(lineStyle = list(color = "#E7E5E4")))
)
draw_line(
power_generation$month,
power_generation$gwh,
group = power_generation$source,
ylab = "Generation (GWh)",
title = "Monthly generation by source",
theme = custom
)Its properties: color, background_color, text_style, title, legend, tooltip, line, bar, pie, scatter, category_axis, value_axis, log_axis, time_axis. The component entries take plain named lists in ECharts’ own camelCase, since they are pass-through overrides.
rtemis_colors is the package’s named categorical palette, re-exported from rtemis.core so every rtemis package resolves the same color to the same name:
teal orange magenta light_blue green light_orange
"#6CA3A0" "#F08904" "#BE2E5F" "#B3CFE8" "#0F6A66" "#FDB808"
red blue juniper pink dark_magenta dark_blue
"#EA384A" "#466D96" "#526551" "#F384FF" "#7D0830" "#375D86"
light_mauve purple terracotta sunset_gold
"#B1A7B3" "#7364F2" "#895140" "#C5A267"
A swatch: one bar per color, drawn in its own color:
palette overrides the theme’s palette for one chart. It takes a single color or a vector, applied to series (or groups) in order:
2026-11-18 17:29:49 Removed 4 NA values from data [boxplot_option]
Charts that encode a quantity in color take colormap rather than palette, since what they need is a continuous ramp and not a categorical sequence:
| Function | Argument | Accepts |
|---|---|---|
draw_heatmap() |
colormap |
Vector of 2+ colors; defaults to a diverging blue–background–orange scale when the data spans zero, and to the blue or orange half when it does not, so a hue always means the same sign |
draw_spectrogram() |
colormap |
A viridisLite name ("magma", "inferno", "plasma", "viridis", "cividis", "mako", "rocket", "turbo"), "diverging", or a vector of 2+ colors |
draw_choropleth() |
colormap |
One of "blues", "viridis", "ylorrd", "greens", "magma", "rdbu", "rdylgn", "spectral", "brbg" |
draw_network() is the mixed case: palette colors detected communities, while node_color, positive_color, and negative_color set the ungrouped node color and the two edge-sign colors.