Skip to main content

CoordCartesian

Struct CoordCartesian 

Source
pub struct CoordCartesian { /* private fields */ }
Expand description

Standard Cartesian coordinate system, with optional zoom limits.

Unlike xlim()/ylim() on scales, zoom limits do NOT filter data — they only clip the viewport. Data outside the limits is still computed by stats and positions, just not visible.

Implementations§

Source§

impl CoordCartesian

Source

pub fn new() -> Self

Source

pub fn expand(self, top: bool, right: bool, bottom: bool, left: bool) -> Self

ggplot2’s coord_cartesian(expand = c(top, right, bottom, left)) (#411): false on a side drops the continuous scale’s padding there, so the data (or the zoom limit) meets that panel edge. Sides are as drawn, so they follow reverse. expand(false, false, false, false) is expand = FALSE.

Source

pub fn reverse(self, x: bool, y: bool) -> Self

Reverse the x and / or y direction at draw time (ggplot2 4.0’s coord_cartesian(reverse = "x" | "y" | "xy")) — the scales and stats are unchanged, the panel is mirrored.

Source

pub fn xlim(self, min: f64, max: f64) -> Self

Set x-axis zoom limits (data coordinates).

Source

pub fn ylim(self, min: f64, max: f64) -> Self

Set y-axis zoom limits (data coordinates).

Source

pub fn get_xlim(&self) -> Option<(f64, f64)>

Get x zoom limits for use by the renderer.

Source

pub fn get_ylim(&self) -> Option<(f64, f64)>

Get y zoom limits for use by the renderer.

Trait Implementations§

Source§

impl Coord for CoordCartesian

Source§

fn transform(&self, point: (f64, f64), plot_area: &Rect) -> (f64, f64)

Transform normalized (0..1, 0..1) coordinates to pixel coordinates.
Source§

fn zoom_x(&self) -> Option<(f64, f64)>

Zoom limits for x-axis (data coordinates). Clips viewport without filtering data.
Source§

fn zoom_y(&self) -> Option<(f64, f64)>

Zoom limits for y-axis (data coordinates). Clips viewport without filtering data.
Source§

fn train_scales(&mut self, scales: &mut ScaleSet)

Inspect / adjust the trained scales once training is complete (e.g. coord_radar anchors the radius at 0 and counts its spokes). Default: no-op.
Source§

fn fixed_aspect(&self) -> Option<f64>

The panel aspect (height / width) this coord letterboxes to, if any. facet_wrap sizes its panels to it (so every map panel is filled instead of letterboxed in an equal, arbitrary cell). Default None.
Source§

fn data_rect(&self, _plot_area: &Rect) -> Option<Rect>

The rect inside plot_area the normalized data window maps onto, for a coord that letterboxes (coord_sf); None when it is the whole plot area or not a rectangle. Default None.
Source§

fn gridlines(&self) -> bool

Whether to draw grid lines.
Source§

fn is_flipped(&self) -> bool

Whether this coordinate system flips X and Y.
Source§

fn is_polar(&self) -> bool

Whether this is a non-linear polar system (bars become radial sectors, so geoms that draw rectangles must tessellate their edges into an arc).
Source§

fn polar_theta_is_x(&self) -> bool

For a polar system, whether the x aesthetic maps to angle (theta="x"). When false (theta="y", pies), the y aesthetic is the angle, so sector tessellation must sweep the y edge instead of the x edge.
Source§

fn polar_guide(&self, _plot_area: &Rect) -> Option<PolarGuide>

A polar coord’s guide geometry (#411): None for every other coord.
Source§

fn set_domains(&mut self, _x: Option<AxisSpan>, _y: Option<AxisSpan>)

Supply the trained x/y axis spans after scale training. Coordinate systems that warp the axis (e.g. coord_trans) need this to map a normalized position back to a data value. Default is a no-op.
Source§

fn is_radar(&self) -> bool

Radar coordinates: straight segments between spokes, closed paths, and ring/spoke guides instead of cartesian axes. Default false.
Source§

fn discrete_expand(&self) -> bool

Whether bars on a discrete axis keep the band padding (10 % of the panel split across the ends). coord_polar().expand(false) turns it off so a full-width pie closes at the centre. Default true.
Source§

fn supports_axis_reserve(&self) -> bool

Whether Theme::axis_text_x_fit’s Reserve mode may grow the panel margin for this coordinate system (B3-1). transform isn’t a simple linear per-axis map for polar/radar (angle) or sf (letterboxed, non-degree units), so reserving a left/right margin from a label bbox would be meaningless there; those coords still get the draw-time Shift fallback in draw_x_axis. Default true.
Source§

impl Default for CoordCartesian

Source§

fn default() -> Self

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

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