pub struct ScaleFillBinned { /* private fields */ }Expand description
Binned fill/colour scale: n classes from n + 1 increasing edges,
each with its own colour. See the module docs for how it
relates to scale_fill_steps/::CLASSES.
Implementations§
Source§impl ScaleFillBinned
impl ScaleFillBinned
Sourcepub fn new(
aesthetic: Aesthetic,
breaks: Vec<f64>,
colors: Vec<(u8, u8, u8)>,
) -> Self
pub fn new( aesthetic: Aesthetic, breaks: Vec<f64>, colors: Vec<(u8, u8, u8)>, ) -> Self
n + 1 increasing breaks with an explicit colour per bin
(colors.len() should be breaks.len() - 1; a mismatch falls back
to the default two-colour ramp and is reported by
validate).
Sourcepub fn two(
aesthetic: Aesthetic,
breaks: Vec<f64>,
low: (u8, u8, u8),
high: (u8, u8, u8),
) -> Self
pub fn two( aesthetic: Aesthetic, breaks: Vec<f64>, low: (u8, u8, u8), high: (u8, u8, u8), ) -> Self
n + 1 increasing breaks, coloured by interpolating low→high
across the n bins (R’s scale_fill_steps(breaks = ...)).
Sourcepub fn na_color(self, color: (u8, u8, u8)) -> Self
pub fn na_color(self, color: (u8, u8, u8)) -> Self
Colour for Value::Na and the legend’s “no data” key (ggplot2’s
na.value). Default grey50 (127, 127, 127). Overridden for
drawing (not for the legend count) by na_pattern
when that’s also set.
Sourcepub fn na_pattern(self, pattern: FillPattern) -> Self
pub fn na_pattern(self, pattern: FillPattern) -> Self
A pattern fill for Value::Na and the legend’s “no data” key,
drawn instead of the flat na_color — a classed
choropleth’s no-data cells read as “no reading”, not a muted
value (#206). FillPattern::stripe(fg, bg) is a reasonable
default hatch; bg is what a pattern-less backend (plotters)
falls back to.
Trait Implementations§
Source§impl Clone for ScaleFillBinned
impl Clone for ScaleFillBinned
Source§impl Debug for ScaleFillBinned
impl Debug for ScaleFillBinned
Source§impl Scale for ScaleFillBinned
impl Scale for ScaleFillBinned
Source§fn map(&self, _value: &Value) -> f64
fn map(&self, _value: &Value) -> f64
Not used for position — like super::steps::ScaleColorSteps, the
legend looks a value’s colour up by its break label instead.
Source§fn na_fill_pattern(&self) -> Option<FillPattern>
fn na_fill_pattern(&self) -> Option<FillPattern>
This scale’s configured na_pattern, if any — the caller (a
geom’s fill resolution, or the legend’s “no data” key) only
consults this for a row/key that’s already otherwise headed for
the flat na_color (Value::Na, or the “no data” legend-key
label itself); every ordinary bin colour is unaffected (#206).
Source§fn is_discrete(&self) -> bool
fn is_discrete(&self) -> bool
Source§fn map_to_color(&self, value: &Value) -> Option<(u8, u8, u8)>
fn map_to_color(&self, value: &Value) -> Option<(u8, u8, u8)>
Source§fn domain(&self) -> Option<(f64, f64)>
fn domain(&self) -> Option<(f64, f64)>
Source§fn is_na_break(&self, label: &str) -> bool
fn is_na_break(&self, label: &str) -> bool
label (a breaks label) is this scale’s
“no data” legend key, so the legend draws that one key with
na_fill_pattern instead of its ordinary
flat swatch colour. Default false (no scale without an na key
needs this). ScaleFillBinned overrides it.Source§fn validate(&self, warnings: &mut Vec<String>)
fn validate(&self, warnings: &mut Vec<String>)
map/map_to_size run per mark at draw time and have no such
access, so a scale-level problem must be reported here instead.
Default: no-op.Source§fn reset_training(&mut self)
fn reset_training(&mut self)
Source§fn map_to_shape(&self, _value: &Value) -> Option<PointShape>
fn map_to_shape(&self, _value: &Value) -> Option<PointShape>
Source§fn map_to_linetype(&self, _value: &Value) -> Option<Linetype>
fn map_to_linetype(&self, _value: &Value) -> Option<Linetype>
Source§fn map_to_size(&self, _value: &Value) -> Option<f64>
fn map_to_size(&self, _value: &Value) -> Option<f64>
Source§fn map_to_alpha(&self, _value: &Value) -> Option<f64>
fn map_to_alpha(&self, _value: &Value) -> Option<f64>
Source§fn set_default_locale(&mut self, _locale: &Locale)
fn set_default_locale(&mut self, _locale: &Locale)
Locale for the
default break labels (number marks, month names, date formats), unless
the scale already has its own. Called by the plot builder when
GGPlot::locale is set. Default: ignored
(scales without numeric/date labels).Source§fn locale(&self) -> Option<&Locale>
fn locale(&self) -> Option<&Locale>
Source§fn format_value(&self, _value: &Value) -> Option<String>
fn format_value(&self, _value: &Value) -> Option<String>
value for a
per-mark attribute (data-fvalue/data-fx, B2-4) or a tooltip
template placeholder — e.g. a de-DE currency string, or a datetime
x’s ISO/locale date, independent of how the axis itself abbreviates
its break labels. None for a missing/non-finite value, or a scale
with nothing meaningful to format (default: every scale except
continuous position/size/linewidth and datetime/colour-continuous,
which override this).Source§fn set_limits(&mut self, _min: f64, _max: f64)
fn set_limits(&mut self, _min: f64, _max: f64)
Source§fn filter_limits(&self) -> Option<(f64, f64)>
fn filter_limits(&self) -> Option<(f64, f64)>
Source§fn expanded_domain(&self) -> Option<(f64, f64)>
fn expanded_domain(&self) -> Option<(f64, f64)>
None for discrete / untrained / non-position scales.Source§fn axis_position_opposite(&self) -> bool
fn axis_position_opposite(&self) -> bool
Source§fn set_expand(&mut self, _mult: f64, _add: f64)
fn set_expand(&mut self, _mult: f64, _add: f64)
expand = c(mult, add)), applied symmetrically to both ends. Used by
CoordSf::train_scales (expand(false) passes (0.0, 0.0)) to pin
an explicit xlim/ylim to the panel exactly. Default: no-op
(discrete / non-position scales have no expansion to set).Source§fn map_fraction_to_size(&self, _fraction: f64) -> Option<f64>
fn map_fraction_to_size(&self, _fraction: f64) -> Option<f64>
[0, 1] scale fraction (as returned
alongside each label by breaks) directly to an
output size, bypassing the round trip through map — a
discrete-style legend key only has the break’s rendered label, not
its original data value, so a continuous scale can’t recover the
fraction by re-mapping the label text. Default: None.Source§fn map_fraction_to_alpha(&self, _fraction: f64) -> Option<f64>
fn map_fraction_to_alpha(&self, _fraction: f64) -> Option<f64>
[0, 1] scale fraction directly to an output
alpha (opacity), the map_fraction_to_size
equivalent for a continuous alpha scale’s discrete-style legend keys —
see that method’s doc for why the fraction, not the label, is the
input. Default: None.Auto Trait Implementations§
impl Freeze for ScaleFillBinned
impl RefUnwindSafe for ScaleFillBinned
impl Send for ScaleFillBinned
impl Sync for ScaleFillBinned
impl Unpin for ScaleFillBinned
impl UnsafeUnpin for ScaleFillBinned
impl UnwindSafe for ScaleFillBinned
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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