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
Every plot is an htmlwidget: print it at the console and it opens in the IDE viewer; include it in a Quarto document or a Shiny app and it renders inline.
rtemis.draw renders each plot type with the most capable JavaScript library for the job. Which library is used is an implementation detail of the plot type, not something you select:
| Backend | Plot types | High-level | Low-level |
|---|---|---|---|
| ECharts | scatter, line, bar, boxplot, histogram, density, pie, heatmap, sankey, spectrogram, gantt | draw_*() |
EChartsOption |
| Sigma.js | network graphs | draw_network() |
SigmaOption |
| MapLibre GL | choropleth maps | draw_choropleth() |
MapLibreOption |
The package exposes the same capability at three levels. They are layers of one system, not alternatives: each is built out of the one below it.
draw_*() functionsData-first functions for common plots — this is what most code should use. They take vectors, data frames, or matrices, choose sensible defaults, and return a widget.
2026-08-18 16:38:06 Removed 2 NA values from data [boxplot_option]
Every draw_*() function shares the same trailing arguments: title, theme, width, height, element_id, and filename.
EChartsOption, SigmaOption, and MapLibreOption are validated S7 render specs — the complete description of what to render, with type-checked properties. Build one and hand it to the single draw() generic, which dispatches on the option’s class to select the backend:
draw(EChartsOption(
title = Title(text = "Body mass"),
x_axis = Axis(type = "value", scale = TRUE),
y_axis = Axis(type = "value"),
series = LineSeries(
data = local({
d <- stats::density(na.omit(penguins$body_mass))
mapply(c, d$x, d$y, SIMPLIFY = FALSE)
}),
show_symbol = FALSE,
area_style = AreaStyle(opacity = 0.25)
)
))This is the tier to reach for when a draw_*() argument does not exist for what you want: dual axes, per-point styling, mark areas, custom tooltips.
A ChartConfig describes a chart as a document: which columns it binds, its semantics, its appearance — with no data inside it. It serializes to JSON, validates against a published schema, and renders through the same draw() generic:
This is the tier that lets a chart be defined in one place and rendered in another — an IDE pane, a web app, a report.
theme is an argument to every drawing function. Left at its default NULL, the widget carries both a light and a dark theme and picks the one that matches the page or system setting at render time:
See Themes for palettes, fonts, and full theme construction.
Pass filename to any drawing function, or call save_drawing() on a widget, to write a static file:
draw_*() chart type.