pub struct DensityPlot;Expand description
Density plot implementation
Creates a 2D density plot from (x, y) coordinate pairs by binning data points into pixels and coloring by density.
§Example
use flow_plots::plots::density::DensityPlot;
use flow_plots::plots::traits::Plot;
use flow_plots::options::{DensityPlotOptions, BasePlotOptions};
use flow_plots::render::RenderConfig;
let plot = DensityPlot::new();
let options = DensityPlotOptions::new()
.base(BasePlotOptions::new().width(800u32).height(600u32).build()?)
.build()?;
let data: Vec<(f32, f32)> = vec![(100.0, 200.0), (150.0, 250.0)];
let mut render_config = RenderConfig::default();
let bytes = plot.render(data, &options, &mut render_config)?;Implementations§
Source§impl DensityPlot
impl DensityPlot
Sourcepub fn render_batch(
&self,
requests: &[(Vec<(f32, f32)>, DensityPlotOptions)],
render_config: &mut RenderConfig,
) -> Result<Vec<PlotBytes>>
pub fn render_batch( &self, requests: &[(Vec<(f32, f32)>, DensityPlotOptions)], render_config: &mut RenderConfig, ) -> Result<Vec<PlotBytes>>
Render multiple density plots in batch
High-level convenience method that handles both density calculation
and rendering. For apps that want to orchestrate rendering themselves,
use calculate_density_per_pixel_batch instead.
§Arguments
requests- Vector of (data, options) tuplesrender_config- Rendering configuration (shared across all plots)
§Returns
Vector of plot bytes, one per request
Trait Implementations§
Source§impl Plot for DensityPlot
impl Plot for DensityPlot
Source§type Options = DensityPlotOptions
type Options = DensityPlotOptions
The options type for this plot
Auto Trait Implementations§
impl Freeze for DensityPlot
impl RefUnwindSafe for DensityPlot
impl Send for DensityPlot
impl Sync for DensityPlot
impl Unpin for DensityPlot
impl UnsafeUnpin for DensityPlot
impl UnwindSafe for DensityPlot
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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