Skip to content

vellumplot 0.5.0

Choose a tag to compare

@schochastics schochastics released this 16 Jul 20:44
· 197 commits to main since this release
  • Rich md() legend titles no longer clip. A legend built from a rich title
    (scale_color_continuous(name = md("Power (hp m^2^)")), labs(color = md(...)))
    measured the title as zero width, so the legend reserved no room for it and the
    drawn title spilled off the page. Titles are now measured through vellum's rich
    text path (vl_strwidth()), reserving the space they actually occupy.

  • Secondary axes. Continuous position scales gain a sec.axis argument fed by
    the new sec_axis() / dup_axis(): a second set of ticks and labels on the
    opposite edge (top for x, right for y), computed as a 1:1 monotonic
    transform of the primary axis — e.g.
    scale_x_continuous(sec.axis = sec_axis(~ . * 1.8 + 32, name = "°F")) for a
    unit conversion, or dup_axis() to duplicate an axis on a wide plot. The
    transform is a formula, function, or scales::transform_*() object. Scoped to
    the default Cartesian system with shared facet scales; combining it with
    coord_flip() / coord_polar() / coord_trans(), free facet scales, or
    add_marginal() raises a clear error, and it is not drawn inside a plot
    composition. A plot without a sec.axis is byte-for-byte unchanged.

  • Datashading now covers dense lines and large-graph edges. mark_line(),
    mark_step(), mark_segment(), and mark_edges() gain an auto = TRUE
    switch (parallel to mark_point(auto = TRUE)): past a row threshold the layer
    rasterises into a line- / segment-density field via vellum::datashade_lines()
    / vellum::datashade_segments() instead of emitting one vector per element, so
    overplotted timeseries stacks and graph "hairballs" render fast and honestly.
    The fallback is skipped under a warped coordinate system (coord_polar() /
    coord_trans()), which keeps the vector path. (Area / ribbon datashading is not
    yet available, pending area-fill support in vellum.)

  • mark_datashade(spread = ) exposes vellum's post-aggregation spreading:
    NULL (default, raw output), a positive integer for a fixed pixel radius
    (vellum::spread()), or "auto" for density-adaptive dilation
    (vellum::dynspread()). Datashaded lines and segments default to "auto" so
    single-pixel marks stay visible.

  • Continuous and binned colour scales now interpolate perceptually (Oklab) by
    default.
    A colour ramp built from a plain colour vector (e.g.
    scale_color_gradient(low, high) or scale_color_continuous(palette = c(...)))
    is blended in the perceptually-uniform Oklab space instead of sRGB, so it no
    longer passes through muddy, over-dark midtones or drifts in hue — the ramp and
    its legend colourbar read evenly. Designed perceptual palettes (the batlow
    default, hcl.colors() names) are already uniform and are unchanged. Set
    options(vellumplot.color.interpolation = "srgb") (or "lab") to restore the
    old behaviour. Gradient fills opt in per gradient with
    linear_gradient(..., interpolation = "oklab") (passed through to vellum).

  • Error bars and line ranges are now interactive. mark_errorbar() and
    mark_linerange() thread a declared data_id/tooltip/hover_group through to
    their drawn segments, so each bar is keyed to its datum — it appears in
    scene_model() and plot_provenance() and carries a data-key in the SVG,
    ready for hover/click/select in a widget (a bar's cap segments share the bar's
    key). mark_boxplot() already keyed each box by its category; this completes the
    statistical marks. A mark with no interactivity declared is unchanged.

  • Two more shapes in scale_shape(). The shape aesthetic's default palette
    now extends to "triangle_down" (a downward triangle) and "star" (a
    five-pointed star) after the original six, so a mapped shape covers up to eight
    levels without an explicit scale, and both are accepted as scale_shape(values=).
    Requires the accompanying vellum dev version. (A constant shape = "star" on a
    mark already worked once vellum gained the shape.)