2  Moving from rtemis plotting

library(rtemis.draw)

Attaching package: 'rtemis.draw'
The following object is masked from 'package:graphics':

    Axis

rtemis.draw separates data preparation, portable display configuration, and rendering. Its high-level functions cover the statistical chart families from rtemis’s Plotly interface, with redesigned argument names and explicit inputs for model predictions and comparisons. The rtemis model methods (plot_*() and present()) use rtemis.draw. The standalone Plotly rtemis::draw_*() functions remain available. Use rtemis.draw::draw_scatter() for the ECharts renderer and rtemis::plot_varimp() for a fitted model.

2.1 Find the drawing function

rtemis Plotly function rtemis.draw entry point Details
draw_3Dscatter() draw_scatter3d(), draw_add_surface() Points, paths, prediction grids
draw_bar() draw_bar() Bars
draw_box() draw_boxplot() Boxes, violins, paired observations
draw_calibration() draw_calibration() Calibration
draw_confusion() draw_confusion() Confusion matrices
draw_dist() draw_histogram(), draw_density() Distributions
draw_fit() draw_fit(), draw_add_fit() Fits and diagnostics
draw_heatmap() draw_heatmap() Heatmaps and annotations
draw_pie() draw_pie() Pie and rose charts
draw_protein() draw_protein(), draw_a3() Sequence annotations
draw_pvals() draw_pvals() P-value bars
draw_roc() draw_roc() ROC curves
draw_scatter() draw_scatter(), draw_line() Points, lines, fits, rugs
draw_spectrogram() draw_spectrogram() Spectrograms
draw_survfit() draw_survfit(), draw_survival() Survival curves
draw_ts() draw_ts() Rolling time series
draw_varimp() draw_varimp(); rtemis::plot_varimp() for models Importance
draw_volcano() draw_volcano() Significance and display groups
draw_xt() draw_xt() Zeitgeber and secondary series

Table rendering is outside rtemis.draw’s scope. Graph, map, and tree functions from other legacy backends have separate contracts; this table does not imply that all their interactions or layouts are equivalent.

2.2 Prepare derived values explicitly

Estimate arbitrary models and clusters before drawing. This keeps the figure’s inputs inspectable and allows another language to render the same values. For example, cluster standardized penguin measurements, then color their original coordinates by the supplied cluster labels:

birds <- penguins[complete.cases(penguins[c("bill_len", "bill_dep")]), ]
measurements <- birds[c("bill_len", "bill_dep")]
set.seed(17)
clusters <- kmeans(scale(measurements), centers = 3, nstart = 20)
draw_scatter(birds$bill_len, birds$bill_dep,
  group = paste("Cluster", clusters$cluster),
  xlab = "Bill length (mm)", ylab = "Bill depth (mm)")

These are exploratory clusters of two measurements, not inferred species labels. The same pattern accepts a clustering result from rtemis: pass its cluster assignments as group instead of passing a clustering_config to the drawing function.

Built-in GLM/GAM fitting remains available for common scatter workflows. For other estimators, draw_add_fit() accepts predicted curves and optional intervals. draw_add_surface() accepts a rectangular prediction grid; it does not infer an unstructured mesh from observations. Statistical comparison labels are supplied explicitly, so the figure does not silently choose a hypothesis test. Rolling time-series transforms use named operations or values computed before drawing, rather than stored R callbacks.

2.3 Map display controls

Use title for a legacy main label and a draw theme for shared typography and backgrounds. High-level legend controls use legend_position and legend_placement; legends fit the available canvas and retain their entries in SVG. Plotly paper coordinates, title anchors, mode-bar settings, trace types, and pixel offsets are not portable high-level arguments. The low-level API exposes ECharts components when a figure needs explicit backend layout. Custom coordinates and text can use draw_annotate().

For confusion plots, use correct_color, incorrect_color, font_size, xlab, ylab, and title. Square cells and aligned marginal statistics use responsive layout. Balanced accuracy is mean class recall; undefined class rates remain missing rather than becoming zero.

ROC settings include digits, diagonal, diagonal_color, line_width, palette, and the shared legend controls. ROC axes represent the full probability interval; arbitrary legacy axis limits and a separate legend title are replaced by explicit curve identities, AUC labels, and the standard layout. Curves remain unsmoothed empirical ROC curves.

Significance plots color by threshold and direction unless group supplies another display classification. annotate_n = 0 disables automatic labels; other annotations and reference lines can be added with draw_annotate(). Use the named p-value transformations instead of arbitrary callbacks.

For importance, choose rank_by, decreasing, and absent according to the meaning of the supplied measure. A column name alone cannot establish whether larger values are better or whether an omitted score means zero. Model adapters recognize documented sparse CART and LightGBM measures; other omitted scores remain missing unless the caller explicitly selects zero-fill. Explicit NA and unavailable folds stay missing. Legacy narrow line-style importance uses native bars with bar_width; fold distributions use type = "boxplot".

2.4 Save and compose

Use save_drawing() with explicit dimensions for a reproducible SVG, and draw_panels() for supported compositions. SVG preserves vector marks and text; 3D export uses the configured camera rather than a later browser rotation. Legacy file_scale and browser screenshot settings do not control this vector output. See Export for the backend-specific requirements and limits.

© 2026 E.D. Gennatas