Skip to main content

StatBinHex

Struct StatBinHex 

Source
pub struct StatBinHex {
    pub bins_x: usize,
    pub bins_y: usize,
    pub binwidth: Option<(f64, f64)>,
    pub origin: Option<(f64, f64)>,
}
Expand description

Hexagonal binning on a fixed hex lattice (data units), unlike the floor-binned staggered rectangles this replaces (see the 0.20.0 CHANGELOG). Output: x, y (hex centres), count, density, ncount, ndensity, width, height, fill (= count, back-compat), n (unweighted point count), q, r.

Fields§

§bins_x: usize§bins_y: usize§binwidth: Option<(f64, f64)>§origin: Option<(f64, f64)>

Implementations§

Source§

impl StatBinHex

Source

pub fn new() -> Self

Source

pub fn bins(self, n: usize) -> Self

Same bin count on both axes.

Source

pub fn bins_xy(self, x: usize, y: usize) -> Self

Source

pub fn binwidth(self, w: f64, h: f64) -> Self

Fix the bin width/height in data units (overrides bins).

Source

pub fn origin(self, x: f64, y: f64) -> Self

Fix the lattice origin in data units.

Source

pub fn lattice(&self, xs: &[f64], ys: &[f64]) -> HexLattice

Build the HexLattice this stat would use for (xs, ys), following the origin rules:

  • binwidth and origin both given: the lattice is fixed exactly.
  • binwidth only: anchored at (0, 0).
  • neither: w, h from the range and bin counts, anchored at the data minimum (ggplot2) — or at origin, if given without binwidth.
Source

pub fn locate(x: f64, y: f64, lattice: &HexLattice) -> (i64, i64)

The cell (q, r) nearest (x, y) on lattice.

Trait Implementations§

Source§

impl Default for StatBinHex

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Stat for StatBinHex

Source§

fn compute_group(&self, data: &DataFrame, _scales: &ScaleSet) -> DataFrame

Transform data for a single group.
Source§

fn required_aes(&self) -> Vec<Aesthetic>

Required aesthetics this stat needs.
Source§

fn name(&self) -> &str

Name for debug/display.
Source§

fn validate(&self, warnings: &mut Vec<String>)

Validate the stat’s own fixed configuration (not the data) and push a human-readable warning for each problem found — e.g. StatBinHex::binwidth being NaN, zero or negative. Called once per layer, before compute_group runs (which has no warnings channel of its own: the per-group call only sees &DataFrame and &ScaleSet, not the plot’s warnings sink). Default: no-op.
Source§

fn default_aes(&self) -> Aes

Default aesthetic mappings this stat produces.
Source§

fn panelwise(&self) -> bool

If true, the stat receives every row of a panel at once (grouped only by facet variables) instead of once per aesthetic group. Needed for cross-group comparisons such as stat_compare_means, which must see all groups together. Defaults to per-group behaviour.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V