pub struct Array2dPlot { /* private fields */ }Expand description
A structure representing a 2D array plot.
The Array2dPlot struct allows for visualizing 2D arrays of RGB color values as images or heatmaps.
Each element in the 2D array corresponds to a pixel, with its color defined by an [u8; 3] RGB triplet.
This struct supports customizable titles, axis labels, and axis configurations for better presentation.
§Arguments
data- A 2D vector of RGB triplets (&[Vec<[u8; 3]>]) representing pixel colors for the plot.plot_title- An optionalTextstruct specifying the title of the plot.x_title- An optionalTextstruct specifying the title of the x-axis.y_title- An optionalTextstruct specifying the title of the y-axis.x_axis- An optional reference to anAxisstruct for customizing the x-axis.y_axis- An optional reference to anAxisstruct for customizing the y-axis.
§Example
§Basic 2D Array Plot
use plotlars::{Array2dPlot, Plot, Text};
let data = vec![
vec![[255, 0, 0], [0, 255, 0], [0, 0, 255]],
vec![[0, 0, 255], [255, 0, 0], [0, 255, 0]],
vec![[0, 255, 0], [0, 0, 255], [255, 0, 0]],
];
Array2dPlot::builder()
.data(&data)
.plot_title(
Text::from("Array2D Plot")
.font("Arial")
.size(18)
)
.build()
.plot();
Implementations§
Source§impl Array2dPlot
impl Array2dPlot
Sourcepub fn builder<'f1, 'f2, 'f3>() -> Array2dPlotBuilder<'f1, 'f2, 'f3>
pub fn builder<'f1, 'f2, 'f3>() -> Array2dPlotBuilder<'f1, 'f2, 'f3>
Examples found in repository?
examples/array2dplot.rs (line 10)
3fn main() {
4 let data = vec![
5 vec![[255, 0, 0], [0, 255, 0], [0, 0, 255]],
6 vec![[0, 0, 255], [255, 0, 0], [0, 255, 0]],
7 vec![[0, 255, 0], [0, 0, 255], [255, 0, 0]],
8 ];
9
10 Array2dPlot::builder()
11 .data(&data)
12 .plot_title(Text::from("Array 2D Plot").font("Arial").size(18))
13 .build()
14 .plot();
15}Trait Implementations§
Source§impl Clone for Array2dPlot
impl Clone for Array2dPlot
Source§fn clone(&self) -> Array2dPlot
fn clone(&self) -> Array2dPlot
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Array2dPlot
impl !RefUnwindSafe for Array2dPlot
impl !Send for Array2dPlot
impl !Sync for Array2dPlot
impl Unpin for Array2dPlot
impl !UnwindSafe for Array2dPlot
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
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 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> ⓘ
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