Skip to main content

HeatmapArtist

Struct HeatmapArtist 

Source
pub struct HeatmapArtist {
    pub data: Vec<Vec<f64>>,
    pub x_labels: Option<Vec<String>>,
    pub y_labels: Option<Vec<String>>,
    pub cmap: Colormap,
    pub vmin: Option<f64>,
    pub vmax: Option<f64>,
    pub show_values: bool,
    pub color: Color,
    pub label: Option<String>,
    pub show_colorbar: bool,
}
Expand description

A heatmap showing a 2D grid of values mapped to colors via a colormap.

Each cell in the grid is filled with a color determined by mapping its value through the configured Colormap. Optional text annotations can display the numeric value inside each cell.

Fields§

§data: Vec<Vec<f64>>

Row-major grid of values. data[row][col].

§x_labels: Option<Vec<String>>

Optional column labels for the x-axis.

§y_labels: Option<Vec<String>>

Optional row labels for the y-axis.

§cmap: Colormap

Colormap used to map cell values to colors.

§vmin: Option<f64>

Minimum value for colormap normalisation. None means auto.

§vmax: Option<f64>

Maximum value for colormap normalisation. None means auto.

§show_values: bool

Whether to draw cell values as text.

§color: Color

Primary color (used for legend swatch).

§label: Option<String>

Optional legend label.

§show_colorbar: bool

Whether to auto-attach a colorbar when this heatmap is drawn.

Implementations§

Source§

impl HeatmapArtist

Source

pub fn data_bounds(&self) -> (f64, f64, f64, f64)

Computes the data-space bounding box (xmin, xmax, ymin, ymax).

The grid spans from (0, 0) to (ncols, nrows). Returns (0.0, 1.0, 0.0, 1.0) when the data is empty.

Source§

impl HeatmapArtist

Source

pub fn colormap(&mut self, cmap: Colormap) -> &mut Self

Sets the colormap used to map cell values to colors.

Source

pub fn vmin(&mut self, min: f64) -> &mut Self

Sets the minimum value for colormap normalisation.

Source

pub fn vmax(&mut self, max: f64) -> &mut Self

Sets the maximum value for colormap normalisation.

Source

pub fn show_values(&mut self, show: bool) -> &mut Self

Enables or disables drawing cell values as text in each cell.

Source

pub fn colorbar(&mut self, show: bool) -> &mut Self

Enables or disables auto-attaching a colorbar when this heatmap is drawn.

When true, the parent axes will automatically add a colorbar showing the color-to-value mapping used by this heatmap.

Source

pub fn label(&mut self, label: &str) -> &mut Self

Sets the legend label.

Source

pub fn x_labels(&mut self, labels: Vec<String>) -> &mut Self

Sets the x-axis labels for the heatmap columns.

Source

pub fn y_labels(&mut self, labels: Vec<String>) -> &mut Self

Sets the y-axis labels for the heatmap rows.

Source

pub fn effective_vmin(&self) -> f64

Returns the effective minimum value for colormap normalisation.

Source

pub fn effective_vmax(&self) -> f64

Returns the effective maximum value for colormap normalisation.

Trait Implementations§

Source§

impl Clone for HeatmapArtist

Source§

fn clone(&self) -> HeatmapArtist

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HeatmapArtist

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.