Expand description
Terminal plotting with Unicode Braille characters.
ploot is a Braille-rendered drop-in replacement for Rust’s
gnuplot crate. It preserves the gnuplot crate’s
public API (Figure, Axes2D, option enums) while swapping the
gnuplot process-spawning backend for a Unicode Braille character renderer
(U+2800–U+28FF, 2×4 sub-pixel resolution per terminal cell).
§Features
- Line, scatter, bar, lines+points, and fill-between plot types
- Y and X error bars / error lines
- Box-and-whisker plots
- Grid and minor grid with configurable dash patterns
- Legend with placement control
- Logarithmic axis scaling
- Secondary (x2/y2) axes
- Multiplot (subplot grid) layout
- LTTB auto-downsampling for large datasets
- Annotations and arrows
- Custom tick positions and labels
§Quick start
use ploot::{Figure, PlotOption};
let mut fig = Figure::new();
fig.set_terminal_size(60, 15);
{
let ax = fig.axes2d();
ax.set_title("Sine wave");
let xs: Vec<f64> = (0..=60).map(|i| i as f64 / 10.0).collect();
let ys: Vec<f64> = xs.iter().map(|x| x.sin()).collect();
ax.lines(
xs.iter().copied(),
ys.iter().copied(),
&[PlotOption::Caption("sin(x)".into())],
);
}
let output = fig.render();
assert!(!output.is_empty());For one-off plots without the full builder API, use quick_plot:
let xs: Vec<f64> = (0..=20).map(|i| i as f64).collect();
let ys: Vec<f64> = xs.iter().map(|x| x * x).collect();
let output = ploot::quick_plot(&xs, &ys, Some("x²"), Some("x"), Some("y"), 60, 15);
assert!(output.contains("x²"));Re-exports§
pub use api::AlignType;pub use api::AutoOption;pub use api::Axes2D;pub use api::Axes3D;pub use api::AxisPair;pub use api::Coordinate;pub use api::DashType;pub use api::Figure;pub use api::GridData;pub use api::LabelOption;pub use api::LegendOption;pub use api::Placement;pub use api::PlotOption;pub use api::PointSymbol;pub use api::SeriesData;pub use api::SurfaceStyle;pub use api::TickOption;pub use canvas::colormap::ColorMapType;
Modules§
- api
- Public API types —
Figure,Axes2D, and all option enums. - canvas
- Braille canvas and color primitives.
- layout
- Layout engine — tick generation, text grid, and frame rendering.
- render
- Rendering pipeline — dispatches
Figuredata to canvas. - terminal
- Terminal size detection.
- transform
- Coordinate transforms — mapping, clipping, and downsampling.
Functions§
- quick_
contour - Quick one-shot contour plot. Returns the rendered string.
- quick_
heatmap - Quick one-shot heatmap. Returns the rendered string.
- quick_
plot - Quick one-shot plot of a line series. Returns the rendered string.
- quick_
plot_ multi - Quick one-shot plot of multiple line series. Returns the rendered string.
- quick_
surface - Quick one-shot 3D surface plot. Returns the rendered string.