Repository navigation
v0.20.0 — arrows, linewidth, hex binning in data units, interactive aesthetics
Minor bump: new public API (arrows, linewidth, hex binning in data units,
interactive aesthetics). LineStyle gains a lineend field, and
GeomSegment/GeomCurve/GeomPath/GeomLine gain arrow/lineend fields,
so struct literals without ..Default::default() need them added.
StatBinHex's fields and output columns are not back-compat with 0.19.0's.
Default output is otherwise unchanged, except hexbin cell geometry and curve
rendering (a native quadratic Bézier <path> instead of a flattened
polyline).
Added
LineEnd { Butt, Round, Square }andLineStyle::lineend;DrawBackend
gains a defaultdraw_quadratic(p0, ctrl, p1, style), overridden by the
SVG backend to emit a native<path d="M.. Q..">.src/geom/arrow.rs:Arrow(grid'sarrow():angle,length,ends,
kind, plus theposition/length_per_linewidthextensions) via the
arrow()builder.GeomSegment/GeomCurve/GeomPath/GeomLinegain
arrow/lineendfields and.arrow() .lineend() .linewidth()builders
(curve also.curvature() .ncp()); segment and curve honour per-row
mappedlinetypeandalpha(previously ignored).Aesthetic::Linewidth("linewidth") withAes::linewidth()/
Aes::after_stat_linewidth();src/scale/linewidth.rs's
ScaleLinewidthContinuous(range, limits/squish, transform, breaks,
labels, locale);GGPlot::scale_linewidth(); a legend key drawn as a
horizontal line of the mapped width. Segment/curve read it per row;
path/line per point, drawing segment-by-segment when it varies within a
group.StatBinHexrewritten onto a fixed pointy-top hex lattice
(src/stat/binhex::HexLattice; cube-rounded point assignment,locate(),
deterministicbinwidth/originrules) instead of floor-binned
staggered rectangles anchored at the data minimum. New output columns:
count, density, ncount, ndensity, width, height, n, q, r(fill
stays ascount, back-compat).GeomHexdraws each hexagon's vertices
in data space (fromwidth/height, falling back to the data's
resolution) and projects each individually — correct under any coord,
includingcoord_sf.src/scale/identity.rs:ScaleColorIdentityreads#RRGGBB/#RGBhex
strings directly, with no legend;GGPlot::scale_colour_identity()/
scale_color_identity()/scale_fill_identity().- Interactive aesthetics:
Aesthetic::Tooltip(Aes::tooltip(col), a
custom<title>) andAesthetic::DataAttr(Aes::data_attr(name, col),
a customdata-<name>attribute;namemust match[a-z0-9][a-z0-9-]*).
DrawBackend::set_mark_attrs/set_mark_part(the latter also used by
arrowheads:data-part="arrow" aria-hidden="true", no<title>). A user
attr replaces a built-in of the same name rather than duplicating it. CoordSf::xlim/ylim(zoom, no filtering) andexpand(bool), via a new
defaultScale::set_expand(mult, add);GGPlot::coord_sf_with(CoordSf)
andsvg_root_data(bool)(defaulttrue; off omitsdata-plot/
data-domain/etc from the root<svg>) — for a consumer overlaying a
rendered fragment on its own basemap.
Changed
- Hexbin cell geometry:
StatBinHexno longer floor-bins staggered
rectangles anchored at the data minimum, so cell positions differ from
0.19.0 (deterministic, but not reproducible against old output). See
"Added" above. geom_curvedraws a native quadratic Bézier<path d="M.. Q..">
instead of a flattened<polyline>;ncpis now ignored by SVG
(documented) since a single control point fully determines the curve.
Breaking
LineStylegainslineend: LineEnd;GeomSegment,GeomCurve,
GeomPath,GeomLinegainarrow: Option<Arrow>and
lineend: LineEnd;StatBinHex's fields and output columns are not
back-compat with 0.19.0. Struct literals need..Default::default().AestheticgainsLinewidth,TooltipandDataAttr(String)
variants — an exhaustive match onAestheticneeds a catch-all or the
new arms.Aesgains a privatewarningsfield (build warnings from
Aes::data_attr, e.g. an invalid or reserved name). A struct literal
that names every field explicitly —Aes { mappings, after_scale },
without..Default::default()— no longer compiles (E0451, "field
warningsof structAesis private"); add..Default::default().ggplot_rs::aes::{resolve_mappings, apply_after_stat}(public
re-exports ofaes::mapping's functions) gain a&mut Vec<String>
warnings parameter:resolve_mappings(data, mapping)→
resolve_mappings(data, mapping, warnings), same for
apply_after_stat. Needed so adata_attr/tooltipmapping that
turns out invalid or reserved at this stage (not just at
Aes::data_attrbuild time — e.g. one constructed by pushing
directly intoAes.mappings) can still report a warning instead of
resolving silently.