pub struct PlotGrid { /* private fields */ }Expand description
A patchwork-style arrangement of plots rendered into one SVG on the plotters-free native path.
- cells fill row-major (or column-major with
byrow(false)) acrossncol/nrow(default: a near-square grid;a | bis one row,a / bone column); widths/heightsset relative column widths / row heights;title/subtitle/captionannotate the whole grid;tag_levelstags panelsa, b, …(A,1, roman, custom) in reading order, through nested grids;collect_legendsremoves the sub-plots’ legends and draws each distinct legend once beside the grid (identical legends are de-duplicated).
Nested grids keep their own layout and annotations; tagging and legend collection are controlled by the outermost grid.
Implementations§
Source§impl PlotGrid
impl PlotGrid
pub fn new() -> Self
Sourcepub fn add(self, cell: impl Into<GridCell>) -> Self
pub fn add(self, cell: impl Into<GridCell>) -> Self
Append a plot (or a nested grid) as the next cell.
Sourcepub fn add_all(self, plots: impl IntoIterator<Item = GGPlot>) -> Self
pub fn add_all(self, plots: impl IntoIterator<Item = GGPlot>) -> Self
Append several plots.
Sourcepub fn add_spacer(self) -> Self
pub fn add_spacer(self) -> Self
Append an empty cell (patchwork’s plot_spacer()).
Sourcepub fn widths(self, widths: &[f64]) -> Self
pub fn widths(self, widths: &[f64]) -> Self
Relative column widths (recycled; non-positive / non-finite = 1).
Sourcepub fn heights(self, heights: &[f64]) -> Self
pub fn heights(self, heights: &[f64]) -> Self
Relative row heights (recycled; non-positive / non-finite = 1).
Sourcepub fn tag_levels(self, levels: TagLevels) -> Self
pub fn tag_levels(self, levels: TagLevels) -> Self
Tag the panels (labs(tag) of each sub-plot is replaced).
Sourcepub fn tag_affixes(self, prefix: &str, suffix: &str) -> Self
pub fn tag_affixes(self, prefix: &str, suffix: &str) -> Self
Text around each tag, e.g. ("(", ")") for (a).
Sourcepub fn collect_legends(self, collect: bool) -> Self
pub fn collect_legends(self, collect: bool) -> Self
Collect the sub-plots’ legends into one strip (identical legends are drawn once). Sub-plots with an inside or hidden legend keep it.
Sourcepub fn legend_position(self, pos: GridLegendPosition) -> Self
pub fn legend_position(self, pos: GridLegendPosition) -> Self
Where collected legends go.
Sourcepub fn theme(self, theme: Theme) -> Self
pub fn theme(self, theme: Theme) -> Self
Theme for the grid’s own title/subtitle/caption and the collected legends’ text.
Sourcepub fn render_svg_native(self) -> Result<String, GGError>
pub fn render_svg_native(self) -> Result<String, GGError>
Render at 800×600.
Sourcepub fn render_svg_native_with_size(
self,
w: u32,
h: u32,
) -> Result<String, GGError>
pub fn render_svg_native_with_size( self, w: u32, h: u32, ) -> Result<String, GGError>
Render the grid to one standalone SVG document of w×h px. The root
carries data-grid="<rows> <cols>" (and no data-plot: each sub-<svg>
has its own).
Sourcepub fn render_svg_native_with_warnings(
self,
w: u32,
h: u32,
) -> Result<(String, Vec<String>), GGError>
pub fn render_svg_native_with_warnings( self, w: u32, h: u32, ) -> Result<(String, Vec<String>), GGError>
Like render_svg_native_with_size,
also returning every sub-plot’s warnings, prefixed panel <tag>: .
Sourcepub fn render_svg_native_at(
self,
x: f64,
y: f64,
w: u32,
h: u32,
) -> Result<String, GGError>
pub fn render_svg_native_at( self, x: f64, y: f64, w: u32, h: u32, ) -> Result<String, GGError>
Render as a nested <svg> fragment positioned at (x, y) — for
composing the grid into a larger SVG (cf. GGPlot::render_svg_native_at).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PlotGrid
impl !UnwindSafe for PlotGrid
impl Freeze for PlotGrid
impl Send for PlotGrid
impl Sync for PlotGrid
impl Unpin for PlotGrid
impl UnsafeUnpin for PlotGrid
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
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> ⓘ
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> ⓘ
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