Skip to content
save_layers

save_layers

Mojo function 🡭

save_layers

fn def save_layers(plots: List[AnyChart], path: String, dpi: Float64 = 72, tight: Bool = False)

save()’s render_layers()/render_layers_svg() counterpart. The format comes from plots[0]’s theme when the path’s extension doesn’t decide it. Raises on an empty plots.

dpi and tight mean what they do for save() (#701): dpi sets a raster export’s pixels per inch, scaling every layer’s size and Theme.scale together so the text and strokes stay the same fraction of the page, and the vector formats ignore it; tight crops every format to the figure’s ink, measured from the drawing.

SVG output writes accessible markup automatically from plots[0]’s .labels(), the same one whose title/subtitle render_layers() itself draws (only the first layer’s labels apply to a layered chart); see save()’s own docstring.

Args:

  • plots (List[AnyChart])
  • path (String)
  • dpi (Float64)
  • tight (Bool)

Raises:

fn def save_layers[*Cs: ChartLike](*charts: *Cs.values, *, path: String, dpi: Float64 = 72, tight: Bool = False)

save_layers(plots, path) for charts named one by one: save_layers(bars, line, path="combo.svg").

Parameters:

  • *Cs (ChartLike)

Args:

  • *charts (*Cs.values)
  • path (String)
  • dpi (Float64)
  • tight (Bool)

Raises: