Skip to content

render

Mojo function 🡭

render

fn def render[C: ChartLike](plot: C) -> Canvas

Render plot into a fresh Canvas sized plot.canvas_width() x plot.canvas_height() and return it, supersampled by plot._settings.theme.raster_supersample (default automatic, resolved per mark by _auto_supersample()): the drawing is recorded once at logical coordinates and replayed into the canvas one output band at a time, each band rendered at that many times the size and averaged down. The enlarged buffer never exists whole.

Supersampling uses the canvas transform; Theme.scale independently controls layout density.

plot is a plain borrow: copying instead of mutating in place means render(scatter(x, y)) and save(scatter(x, y), path) both compile inline, with no need to bind a temporary to a variable first.

Parameters:

  • C (ChartLike)

Args:

  • plot (C)

Returns:

Canvas

Raises:

fn def render(figure: Figure) -> Canvas

Render a composite Figure to a raster Canvas; render(plot)’s counterpart, over render_grid() (#697).

Args:

  • figure (Figure): The composite chart.

Returns:

Canvas: The rendered figure.

Raises:

Error: Whatever render_grid() raises for its layout.