#[non_exhaustive]pub struct Plot<G: GraphicsArea> { /* private fields */ }Expand description
Implementations§
Source§impl<G: GraphicsArea> Plot<G>
impl<G: GraphicsArea> Plot<G>
Sourcepub const DEFAULT_MARGIN: u16 = 3
pub const DEFAULT_MARGIN: u16 = 3
Default left margin (in characters) between the terminal edge and labels.
Sourcepub const DEFAULT_PADDING: u16 = 1
pub const DEFAULT_PADDING: u16 = 1
Default padding (in characters) between labels and the plot border.
Sourcepub fn new(graphics: G) -> Self
pub fn new(graphics: G) -> Self
Creates a new plot wrapping the given graphics area with default settings.
Sourcepub fn annotate_left(
&mut self,
row: usize,
text: impl Into<String>,
color: Option<TermColor>,
)
pub fn annotate_left( &mut self, row: usize, text: impl Into<String>, color: Option<TermColor>, )
Adds or replaces a labeled annotation on the left side of the plot body.
Pass None for color to use the terminal’s default foreground color.
Sourcepub fn annotate_right(
&mut self,
row: usize,
text: impl Into<String>,
color: Option<TermColor>,
)
pub fn annotate_right( &mut self, row: usize, text: impl Into<String>, color: Option<TermColor>, )
Adds or replaces a labeled annotation on the right side of the plot body.
Pass None for color to use the terminal’s default foreground color.
Sourcepub fn set_decoration(
&mut self,
position: DecorationPosition,
text: impl Into<String>,
)
pub fn set_decoration( &mut self, position: DecorationPosition, text: impl Into<String>, )
Sets edge decoration text at one of the six border positions.
Sourcepub fn next_color(&mut self) -> NamedColor
pub fn next_color(&mut self) -> NamedColor
Returns the next color from the auto-series palette and advances the index.
Sourcepub const fn annotations(&self) -> &PlotAnnotations
pub const fn annotations(&self) -> &PlotAnnotations
Returns all annotations attached to this plot.
Sourcepub fn graphics_mut(&mut self) -> &mut G
pub fn graphics_mut(&mut self) -> &mut G
Returns a mutable reference to the underlying graphics area.
Sourcepub fn ylabel(&self) -> Option<&str>
pub fn ylabel(&self) -> Option<&str>
The y-axis label, rendered vertically along the left margin.
Sourcepub const fn border(&self) -> BorderType
pub const fn border(&self) -> BorderType
The border style for this plot.
Sourcepub const fn show_labels(&self) -> bool
pub const fn show_labels(&self) -> bool
Whether left/right row labels are rendered.
Sourcepub const fn auto_color_index(&self) -> u8
pub const fn auto_color_index(&self) -> u8
The current auto-color palette index (wraps at 6).
Sourcepub fn render(&self, writer: &mut impl Write, color: bool) -> IoResult<()>
pub fn render(&self, writer: &mut impl Write, color: bool) -> IoResult<()>
Render this plot into the provided writer.
§Errors
Returns any I/O error produced by writing to writer.