Symbol generator for categorical point marks.
Provides various symbol shapes commonly used in scatter plots and legends to distinguish categories.
Examples
symbol = Visualize.Shape.Symbol.new()
|> Visualize.Shape.Symbol.type(:circle)
|> Visualize.Shape.Symbol.size(64)
path_data = Visualize.Shape.Symbol.generate(symbol)
Summary
Functions
Generates the SVG path data string.
Generates a Path struct
Creates a new symbol generator
Sets the symbol size in square pixels.
Sets the symbol type
Returns all available symbol types
Types
@type symbol_type() ::
:circle | :cross | :diamond | :square | :star | :triangle | :wye
@type t() :: %Visualize.Shape.Symbol{ size: number() | (any() -> number()), type: symbol_type() | (any() -> symbol_type()) }
Functions
Generates the SVG path data string.
Note: For backend-agnostic usage, prefer generate_path/2
and render with your chosen backend.
@spec generate_path(t(), any()) :: Visualize.IR.Path.t()
Generates a Path struct
@spec new() :: t()
Creates a new symbol generator
Sets the symbol size in square pixels.
For a circle, this is the area. For other symbols, the bounding box area is approximately this size.
@spec type(t(), symbol_type() | (any() -> symbol_type())) :: t()
Sets the symbol type
@spec types() :: [symbol_type()]
Returns all available symbol types