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 when you use 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-08-18 16:38:29 Removed 2 NA values from x [density_option]
2026-08-18 16:38:29 Removed 2 NA values from x [density_option]
theme = NA disables theming entirely, leaving raw ECharts defaults — useful when you intend to register your own ECharts theme on the page.
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.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 when you need 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(
sort(unique(penguins$year)),
as.integer(table(penguins$year)),
title = "Penguins observed per year",
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
"#B1A7B3" "#7364F2" "#895140"
A quick 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-08-18 16:38:29 Removed 2 NA values [FUN]
2026-08-18 16:38:29 Removed 2 NA values [FUN]
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 teal–background–orange scale when the data spans zero, sequential otherwise |
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.