pub struct GeomTextRepel {
pub size: f64,
pub color: (u8, u8, u8),
pub alpha: f64,
pub fontface: FontFace,
pub repel: RepelParams,
}Expand description
Text labels repelled away from each other and from their points
(ggrepel::geom_text_repel). Requires x, y, label; an empty / NA
label is not drawn but its point is still avoided (as in ggrepel).
Fields§
§size: f64§color: (u8, u8, u8)§alpha: f64§fontface: FontFace§repel: RepelParamsImplementations§
Source§impl GeomTextRepel
impl GeomTextRepel
Sourcepub fn box_padding(self, px: f64) -> Self
pub fn box_padding(self, px: f64) -> Self
Padding (px) around label boxes when testing overlaps.
Sourcepub fn point_padding(self, px: f64) -> Self
pub fn point_padding(self, px: f64) -> Self
Padding (px) around the labelled points.
Sourcepub fn point_size(self, px: f64) -> Self
pub fn point_size(self, px: f64) -> Self
Radius (px) of the points to avoid.
Sourcepub fn force_pull(self, force: f64) -> Self
pub fn force_pull(self, force: f64) -> Self
Spring strength back to the point.
Sourcepub fn max_overlaps(self, n: usize) -> Self
pub fn max_overlaps(self, n: usize) -> Self
Drop labels overlapping more than n labels/points.
Sourcepub fn min_segment_length(self, px: f64) -> Self
pub fn min_segment_length(self, px: f64) -> Self
Minimum label–point distance (px) that gets a segment.
Sourcepub fn direction(self, d: RepelDirection) -> Self
pub fn direction(self, d: RepelDirection) -> Self
Restrict movement to one axis.
Sourcepub fn justify(self, hjust: f64, vjust: f64) -> Self
pub fn justify(self, hjust: f64, vjust: f64) -> Self
Where the box starts relative to its point (GeomText’s
hjust / vjust; 0.5 = centred).
Sourcepub fn halo(self, colour: (u8, u8, u8), r: f64) -> Self
pub fn halo(self, colour: (u8, u8, u8), r: f64) -> Self
A halo of colour and radius r px around the text.
Sourcepub fn max_labels(self, n: usize) -> Self
pub fn max_labels(self, n: usize) -> Self
Label-count cap of the force layout.
Sourcepub fn avoid_abline(self, slope: f64, intercept: f64) -> Self
pub fn avoid_abline(self, slope: f64, intercept: f64) -> Self
Keep labels clear of the line y = intercept + slope * x
(scale space, like geom_abline).
Sourcepub fn segment_color(self, color: (u8, u8, u8)) -> Self
pub fn segment_color(self, color: (u8, u8, u8)) -> Self
Segment colour.
Trait Implementations§
Source§impl Default for GeomTextRepel
impl Default for GeomTextRepel
Source§impl Geom for GeomTextRepel
impl Geom for GeomTextRepel
Source§fn draw(
&self,
data: &DataFrame,
coord: &dyn Coord,
scales: &ScaleSet,
theme: &Theme,
backend: &mut dyn DrawBackend,
) -> Result<(), RenderError>
fn draw( &self, data: &DataFrame, coord: &dyn Coord, scales: &ScaleSet, theme: &Theme, backend: &mut dyn DrawBackend, ) -> Result<(), RenderError>
Source§fn required_aes(&self) -> Vec<Aesthetic>
fn required_aes(&self) -> Vec<Aesthetic>
Source§fn default_stat(&self) -> Box<dyn Stat>
fn default_stat(&self) -> Box<dyn Stat>
Source§fn default_position(&self) -> Box<dyn Position>
fn default_position(&self) -> Box<dyn Position>
Source§fn default_params(&self) -> GeomParams
fn default_params(&self) -> GeomParams
Source§fn apply_element_geom(&mut self, el: &ElementGeom)
fn apply_element_geom(&mut self, el: &ElementGeom)
element_geom), called once per
layer before set_series_color — and only
when the layer was not configured explicitly (geom_*_with(...);
the build pipeline gates the call on the same explicit_style flag
set_series_color’s brand-colour application is gated on). That
gate, not a field-value comparison, is what keeps an explicit colour
untouched: a geom that honours this replaces a field still at its
own hard-coded default (black/(50, 50, 50) → ink, white →
paper) by comparing its value, which cannot by itself tell an
explicitly-set colour that happens to equal that default (e.g.
GeomPoint { color: (0, 0, 0), .. } under geom_point_with) apart
from one that was simply never touched — only skipping the call
entirely for an explicitly-configured layer closes that gap (review
PR#141 finding 4). Default no-op; None fields of ElementGeom
change nothing, so the default theme (no ink/paper/accent set)
stays byte-identical.Source§fn figure_band_height(&self, _width: f64, _theme: &Theme) -> Option<f64>
fn figure_band_height(&self, _width: f64, _theme: &Theme) -> Option<f64>
width, when it draws once
there instead of in every panel (e.g. GeomAttribution::figure).
Default None (drawn per panel).Source§fn set_series_color(&mut self, _color: (u8, u8, u8))
fn set_series_color(&mut self, _color: (u8, u8, u8))
color or fill). The build pipeline calls this only when the layer has
no color/fill aesthetic mapped, so an explicit mapping always wins. The
default is a no-op; series geoms override it.Source§fn include_zero_baseline(&self) -> bool
fn include_zero_baseline(&self) -> bool
y is explicitly mapped (bars/columns/area/histograms — as
in ggplot2). Default false.Source§fn allows_infinite(&self) -> bool
fn allows_infinite(&self) -> bool
-Inf/Inf position values are meaningful for this geom
(ggplot2: “extend to the panel edge”). Rows with infinite positions are
otherwise dropped with a warning before stats run. NaN is always
dropped — unless Geom::keeps_na_as_break says otherwise. Default
false; geom_rect returns true.Source§fn keeps_na_as_break(&self) -> bool
fn keeps_na_as_break(&self) -> bool
GeomPath/GeomLine NA handling): the row still
counts toward the “removed N rows” warning, but it is not deleted
from the built DataFrame, so the geom’s own per-group point list
still contains it — as a non-finite pixel position after the scale
and coordinate transform, which crate::render::backend::DrawBackend::draw_line
splits on into separate polylines (ggplot2’s NA-break semantics)
instead of silently joining the finite points across the gap.
Default false (the row is dropped, as for every other geom);
line/path/step return true.Source§fn consumes_tooltips(&self) -> bool
fn consumes_tooltips(&self) -> bool
set_row_extras] (so it reads
Aes::tooltip and
Aes::data_attr, and a
GGPlot::tooltip template on it has
a visible effect). Default false; the build pipeline warns when a
tooltip() template is set on a layer whose geom returns false
here (review PR#141 finding 6, LOW: a template silently did nothing
on e.g. geom_area/geom_boxplot/geom_ribbon). Point, segment,
curve, path, line, hex, polygon, sf, rect/tile and col/bar/
histogram return true.Source§fn key_glyph(&self) -> Option<KeyGlyph>
fn key_glyph(&self) -> Option<KeyGlyph>
draw_key, #410).
None = the plain per-aesthetic swatch (fill square, point shape,
line type …), which is also what a key falls back to for a geom not
listed here. Overridable per layer with
GGPlot::key_glyph.Source§fn key_fill(&self) -> Option<((u8, u8, u8), f64)>
fn key_fill(&self) -> Option<((u8, u8, u8), f64)>
fill and alpha (its parameters, not mapped
aesthetics), which its legend key is drawn with where the legend
doesn’t map them — ggplot2’s draw_key_polygon reads the layer’s
fill / alpha params the same way (#473). None: the key glyph’s
own defaults (grey35, opaque).Source§fn setup_data(&self, _data: &mut DataFrame, _warnings: &mut Vec<String>)
fn setup_data(&self, _data: &mut DataFrame, _warnings: &mut Vec<String>)
GeomX$setup_data) — e.g. a tile adds
its xmin/xmax/ymin/ymax extents so continuous scales train on
them. warnings is the layer’s own build-warnings sink (B3-5: added
so GeomBoxplot can warn on an unparsable outlier value here, the
same channel every other build warning uses — never eprintln!).
Default: no-op.Source§fn inherit_aes(&self) -> bool
fn inherit_aes(&self) -> bool
inherit.aes). Reference-line geoms return false, as in ggplot2, so a
plot-level color/x/y mapping does not leak into a geom_hline.
Default true.Source§fn mapped_only_columns(&self) -> &'static [&'static str]
fn mapped_only_columns(&self) -> &'static [&'static str]
lower). build_layer drops any of these columns
right after resolve_mappings unless the aesthetic was mapped.
Default empty; GeomBoxplot returns ["lower", "middle", "upper", "outliers"].Source§fn validate_layer(
&self,
_pre_stat_columns: &[String],
_stat_name: &str,
) -> Result<(), String>
fn validate_layer( &self, _pre_stat_columns: &[String], _stat_name: &str, ) -> Result<(), String>
required_aes
(B3-5): called once per layer with the resolved (pre-stat, post-D3-drop)
column names and the layer’s stat name, before the stat runs. Default
no-op. GeomBoxplot requires lower/middle/upper to be mapped
under stat="identity", else y.Auto Trait Implementations§
impl Forget for GeomTextRepel
impl Freeze for GeomTextRepel
impl Move for GeomTextRepel
impl RefUnwindSafe for GeomTextRepel
impl Send for GeomTextRepelwhere
RawVecInner: Send,
impl Sync for GeomTextRepelwhere
RawVecInner: Sync,
impl Unpin for GeomTextRepel
impl UnsafeUnpin for GeomTextRepel
impl UnwindSafe for GeomTextRepelwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more