### Basic Bar Chart Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Demonstrates the creation of a simple vertical bar chart with basic x-axis configuration. ```typst #lq.diagram( xaxis: (subticks: none), lq.bar( (1, 2, 3, 4, 5, 6), (1, 2, 3, 2, 5, 3) ) ) ``` -------------------------------- ### Variable Bar Widths Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Illustrates how to create a bar chart where each bar has a different width, specified as an array. ```typst #lq.diagram( lq.bar( (1, 2, 3, 4, 5), (1, 2, 3, 2, 5), width: (1, 0.5, 1, 0.5, 1), fill: orange ) ) ``` -------------------------------- ### Usage Example for X-Axis Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Demonstrates how to include an x-axis in a diagram using the `xaxis` function with label and position options. ```typst #lq.diagram( ..., lq.xaxis(label: $x$, position: top) ) ``` -------------------------------- ### Use zip function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Example of using the zip function to combine two arrays into an array of tuples. ```typst #let x = (1, 2, 3) #let y = (4, 5, 6) #let points = x.zip(y) // ((1, 4), (2, 5), (3, 6)) ``` -------------------------------- ### Configure Diagram with Axis Labels Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md This example demonstrates setting both x and y-axis labels with custom content and positioning for a diagram. ```typst #lq.diagram( xlabel: $x$ [position], ylabel: [Measurement Value], ... ) ``` -------------------------------- ### Use logspace function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Example of using the logspace function to create an array of logarithmically spaced values. ```typst #let x = lq.logspace(0, 3) // 50 values from 1 to 1000 (10^0 to 10^3) ``` -------------------------------- ### Diagram Usage Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/01-DIAGRAM.md Demonstrates how to create a diagram with a title, axis labels, and two plots (sine and cosine functions). ```typst #import "@preview/lilaq:0.6.0" as lq #lq.diagram( title: [Trigonometric Functions], xlabel: $x$, ylabel: $y$, width: 8cm, height: 5cm, lq.plot(lq.linspace(0, 10), calc.sin), lq.plot(lq.linspace(0, 10), x => calc.cos(x) / 2) ) ``` -------------------------------- ### Usage Example for Y-Axis Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Demonstrates how to include a y-axis in a diagram using the `yaxis` function with label and position options. ```typst #lq.diagram( ..., lq.yaxis(label: $y$, position: right) ) ``` -------------------------------- ### Scale Object Structure Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md An example of the structure for a scale object, including its name, transformation function, tick locating functions, and other scale-specific properties. ```typst ( name: "scale-name", transform: x => calc.log(x, base: 10), locate-ticks: locate-ticks-log, locate-subticks: locate-subticks-log, base: 10, threshold: 1, linscale: 1, ) ``` -------------------------------- ### Horizontal Bar Chart Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Demonstrates the creation of a horizontal bar chart using the hbar function with basic y-axis configuration. ```typst #lq.diagram( yaxis: (subticks: none), lq.hbar( (5, 3, 4, 2, 1), (1, 2, 3, 4, 5) ) ) ``` -------------------------------- ### Use range function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Examples demonstrating the use of the built-in Typst range function to generate integer sequences with different parameters. ```typst #let numbers = range(10) // 0 to 9 #let numbers = range(2, 10) // 2 to 9 #let numbers = range(0, 10, 2) // 0, 2, 4, 6, 8 ``` -------------------------------- ### Typst Examples for Axis Limits Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Demonstrates various ways to set axis limits using 'auto' for automatic computation or fixed numerical values. ```typst xlim: (0, 10) // Fixed limits xlim: (auto, 100) // Auto min, fixed max xlim: (0, auto) // Fixed min, auto max xlim: auto // Both auto ``` -------------------------------- ### Example Plot Data Structure Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md An example of the internal data structure returned by a plot function, including specific data points and rendering configurations. ```typst ( x: (1, 2, 3), y: (4, 5, 6), xerr: none, yerr: none, label: [Data], mark: (mark: o, fill: auto, size: auto, every: none), style: (stroke: auto, color: auto, step: none, smooth: false, tip: none, toe: none), plot: render-plot, xlimits: () => (1, 3), ylimits: () => (4, 6), datetime: (:), legend: true, ignores-cycle: false, clip: true, z-index: 2, ) ``` -------------------------------- ### Diagram with Color Array Cycle Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Example of using a color array as a style cycle for a diagram and its plots. ```typst #lq.diagram( cycle: (red, blue, green, orange), lq.plot(...), // Uses red lq.plot(...), // Uses blue lq.plot(...), // Uses green ) ``` -------------------------------- ### Diagram with Custom Mixed Style Cycle Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Example of using a custom style cycle with mixed dictionary definitions for a diagram. ```typst #lq.diagram( cycle: ( (color: red, mark: "o"), (color: blue, mark: "s"), (color: green, stroke: 2pt + dash("dotted")), ), ... ) ``` -------------------------------- ### Diagram with Color Cycle Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Example of configuring a diagram to use a specific color cycle. The `cycle` parameter accepts a color map from `lq.color.map`. ```typst #lq.diagram( cycle: lq.color.map.Set1 ) ``` -------------------------------- ### Use linspace function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Examples of using the linspace function to create arrays of linearly spaced values with default and specified counts. ```typst #let x = lq.linspace(0, 10) // 50 points from 0 to 10 #let x = lq.linspace(0, 10, count: 100) ``` -------------------------------- ### Stem Plot Usage Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Demonstrates how to use the stem function to create a stem plot with custom marks and mark sizes. Requires the lq.diagram and lq.stem functions. ```typst #lq.diagram( lq.stem( (0, 1, 2, 3, 4), (1, 3, 2, 4, 2), mark: "s", mark-size: 4pt ) ) ``` -------------------------------- ### Define Paint Types Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Typst supports color, gradient, and tiling for fill and stroke paints. Examples show basic color definitions and linear/radial gradients. ```typst red, rgb("#FF0000"), lch(50%, 100, 30deg) ``` ```typst gradient.linear(red, blue) ``` ```typst gradient.radial(red, blue, center: (50%, 50%), radius: 50%) ``` -------------------------------- ### Multiple Bar Series Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Shows how to plot two series of bars side-by-side by adjusting width and offset. Each series can have a distinct fill color and legend label. ```typst #lq.diagram( xaxis: (subticks: none), lq.bar( (1, 2, 3, 4, 5), (5, 3, 4, 2, 1), width: 0.35, fill: blue, label: "Series A" ), lq.bar( (1, 2, 3, 4, 5), (3, 2, 5, 4, 2), width: 0.35, fill: red, offset: 0.35, label: "Series B" ) ) ``` -------------------------------- ### Box Plot Usage Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Illustrates the usage of the boxplot function to generate box plots for multiple datasets at specified positions. Requires lq.diagram and lq.boxplot. ```typst #lq.diagram( lq.boxplot( ( (1, 2, 2, 3, 3, 3, 4, 4, 5), (1, 1, 2, 3, 4, 5, 5, 6, 6), ), positions: (1, 2), width: 0.5 ) ) ``` -------------------------------- ### Mark Interval Control Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Plots marks at specified intervals using the `every` parameter. This example plots every 4th mark. ```typst #lq.diagram( lq.plot( range(20), range(20).map(x => x * x), every: 4 // plot every 4th mark ) ) ``` -------------------------------- ### Progressive Plot Reveal Animation Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Animate the appearance of plots one by one using the `reveal` parameter set to a number. This example reveals plots sequentially. ```typst #lq.diagram( reveal: 1, // Show only first plot lq.plot(..., label: "First"), lq.plot(..., label: "Second"), lq.plot(..., label: "Third"), ) ``` -------------------------------- ### Creating a Plot Grid Layout Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Combine multiple plots within a single diagram to form a grid. This example shows two plots side-by-side, demonstrating basic layout capabilities. ```typst #lq.diagram( title: [Main Title], lq.plot( lq.linspace(0, 10), x => calc.sin(x), label: "sin(x)" ), lq.plot( lq.linspace(0, 10), x => calc.cos(x), label: "cos(x)" ) ) ``` -------------------------------- ### Define logspace function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Defines a function to generate logarithmically spaced values. It takes start, end, count, and an optional base. ```typst #let logspace(start, end, count: 50, base: 10) = { } ``` -------------------------------- ### Get Available Layout Size Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Retrieves the available width and height for relative dimensioning within a layout context. Used internally for iterative layout calculations. ```typst #layout(size => { // size.width and size.height are available }) ``` -------------------------------- ### Hide X-Axis, Show Y-Axis Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Control the visibility of axes within a diagram. This example hides the x-axis while ensuring the y-axis is displayed. ```typst #lq.diagram( xaxis: none, yaxis: (hidden: false), lq.plot(...) ) ``` -------------------------------- ### Stacked Bar Chart Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Create a stacked bar chart where segments of bars represent different series. Use the 'base' parameter to define the starting point for subsequent series. ```typst #lq.diagram( xaxis: (subticks: none), lq.bar( (1, 2, 3, 4), (3, 4, 2, 5), fill: blue, label: "Series 1" ), lq.bar( (1, 2, 3, 4), (2, 3, 4, 2), fill: orange, base: (3, 4, 2, 5), label: "Series 2" ) ) ``` -------------------------------- ### Default Grid Configuration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Use `grid: auto` to apply the default grid settings. ```typst // Default grid #lq.diagram(grid: auto, ...) ``` -------------------------------- ### place() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Places arbitrary content at a specific data coordinate. It accepts x, y coordinates, the content to place (body), and optional alignment and clipping parameters. ```APIDOC ## place() ### Description Place arbitrary content at a data coordinate. ### Signature ```typst #let place( x, y, body, align: top + left, clip: true, ) = { } ``` ``` -------------------------------- ### Set Default Diagram Configuration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/INDEX.md Configure default settings for diagram width, height, and axis label offsets. Apply these settings globally using the '#show' directive. ```typst #show: lq.set-diagram(width: 8cm, height: 5cm) #show: lq.set-xlabel(offset: 10pt) #show: lq.set-ylabel(offset: 10pt) ``` -------------------------------- ### Fill Between Areas Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Shade the area between two functions. This example fills the region between y=x and y=x^2 with a semi-transparent red color. ```typst #lq.diagram( title: [Fill Between], lq.fill-between( lq.linspace(0, 10), y1: x => x, y2: x => x * x, fill: rgb("#FF000022") ) ) ``` -------------------------------- ### Dual-Axis Plot Example Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Create a plot with two independent y-axes. Useful for comparing data with different scales or units. ```typst #lq.diagram( title: [Dual Axis Example], xlim: (0, 10), ylim: (0, 10), // Primary y-axis lq.plot( lq.linspace(0, 10), x => calc.sin(x), label: "sin(x)" ), // Secondary y-axis lq.yaxis( kind: "y", position: right, label: "Temperature (°C)", functions: ( y => y * 100, // Forward: data to secondary axis y => y / 100 // Inverse: secondary axis to data ), ) ) ``` -------------------------------- ### Basic Axis Configuration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Configure basic x and y axes with labels for a diagram. ```typst #lq.diagram( xaxis: (label: $x$), yaxis: (label: $y$), lq.plot((1, 2, 3), (1, 2, 3)) ) ``` -------------------------------- ### Import Lilaq Package Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/README.md This snippet shows how to import all Lilaq functions using the provided package alias. Ensure you are using Typst version 0.13.0 or later. ```typst #import "@preview/lilaq:0.6.0" as lq ``` -------------------------------- ### Define linspace function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Defines a function to generate linearly spaced values. It takes start, end, and an optional count. ```typst #let linspace(start, end, count: 50) = { } ``` -------------------------------- ### Run Lilaq Tests Locally Source: https://github.com/lilaq-project/lilaq/blob/main/CONTRIBUTING.md Execute this command at the root of the Lilaq repository to run the project's test suite. Ensure all tests pass before submitting a pull request. ```sh tt run ``` -------------------------------- ### Set Default Diagram Configuration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Applies default styling to all diagram elements within its scope. Configure width, height, grid, and margin. ```typst #show: lq.set-diagram( width: 8cm, height: 5cm, grid: 0.5pt, margin: 5%, ) ``` -------------------------------- ### Contour Plot Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Generate a contour plot to visualize a 3D surface. This example shows contours of the function z = x^2 + y^2. ```typst #lq.diagram( title: [Contour Plot], width: 6cm, height: 6cm, aspect-ratio: 1, lq.contour( x: lq.linspace(-2, 2), y: lq.linspace(-2, 2), z: (x, y) => x*x + y*y, levels: 10 ) ) ``` -------------------------------- ### Access built-in color maps Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Demonstrates accessing various built-in color maps provided by the library, such as viridis, plasma, and Set1. ```typst #lq.color.map.viridis // Viridis colormap #lq.color.map.plasma // Plasma colormap #lq.color.map.inferno // Inferno colormap #lq.color.map.magma // Magma colormap #lq.color.map.coolwarm // Cool-warm diverging #lq.color.map.Set1 // Qualitative set 1 ``` -------------------------------- ### Plotting with Custom Styled Marks Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Shows how to create and apply a custom mark object with specific styling (e.g., square shape) using 'lq.mark'. ```typst #lq.plot((1, 2, 3), (1, 2, 3), mark: lq.mark("s")) ``` -------------------------------- ### Import Lilaq Library Source: https://github.com/lilaq-project/lilaq/blob/main/README.md Import Lilaq into your Typst document using the canonical abbreviation 'lq'. Ensure you are using the correct version. ```typ #import "@preview/lilaq:0.6.0" as lq ``` -------------------------------- ### Styled Marks Plot Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Customize the appearance of marks on a plot, including shape and color. This example uses red circles for data points. ```typst #lq.diagram( #show: lq.style(color: red, mark: "s") lq.plot( range(10), range(10).map(x => x * x), mark-size: 6pt ) ) ``` -------------------------------- ### Simple Bar Chart Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Create a basic bar chart with categories on the x-axis and values for each category. ```typst #lq.diagram( xaxis: (subticks: none), lq.bar( ("A", "B", "C", "D", "E"), (3, 7, 4, 6, 2) ) ) ``` -------------------------------- ### Set Bar Width with Duration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Specify the width of bars in a plot using a duration literal. This example sets the bar width to 10 days. ```typst #lq.bar( dates, values, width: 10day // Bar width in days ) ``` -------------------------------- ### Set Default Title Styling Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Applies default styling to all title elements within its scope. Configure title anchor point. ```typst #show: lq.set-title( anchor: center, ) ``` -------------------------------- ### Apply Stroke to Plot Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Apply custom stroke styling to a plot's line. This example uses a red dashed line with a thickness of 2 points. ```typst #lq.plot( x, y, stroke: (paint: red, thickness: 2pt, dash: "dashed") ) ``` -------------------------------- ### Define X-Axis Convenience Function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Use `xaxis` for creating an x-axis. This is a shorthand for `axis.with(kind: "x")`. ```typst #let xaxis = axis.with(kind: "x") ``` -------------------------------- ### Construct Datetime Object Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Create a specific point in time using the datetime constructor. All components (year, month, day, hour, minute, second) are optional and default to 1 or 0. ```typst #let date = datetime( year: 2024, month: 6, day: 18, hour: 14, minute: 30, second: 0, ) ``` -------------------------------- ### Setting Diagram Styles Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Applies global style settings for diagrams, including width, height, and label offsets, ensuring consistent appearance. ```typst #show: lq.set-diagram(width: 8cm, height: 5cm) #show: lq.set-xlabel(offset: 10pt) #show: lq.set-ylabel(offset: 10pt) // All diagrams now use consistent sizes and label positioning ``` -------------------------------- ### Conditional Plot Reveal Animation Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Control plot animation using a function with the `reveal` parameter. This example reveals plots based on a condition, showing the first two. ```typst #lq.diagram( reveal: i => i < 2, // Show first two plots lq.plot(...), lq.plot(...), lq.plot(...), ) ``` -------------------------------- ### Scatter Plot with Color Mapping Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Example of using a scatter plot with color mapping and a specified color map. The `map` parameter accepts a color map from `lq.color.map`. ```typst #lq.scatter( x, y, color: values, map: lq.color.map.plasma ) ``` -------------------------------- ### Set Default Label Styling Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Applies default styling to all label elements within its scope. Configure label offsets. ```typst #show: lq.set-label( offset: (0pt, 10pt), ) ``` -------------------------------- ### Find Minimum and Maximum Values Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Calculates the minimum and maximum values from a list of numbers. ```typst #let (min, max) = lq.minmax((3, 1, 4, 1, 5, 9, 2, 6)) // Returns: (1, 9) ``` -------------------------------- ### colormesh() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Creates a heatmap visualization using a color mesh. It requires grid coordinates for x and y, and a 2D array of values for z. Users can specify the color map, value range for mapping, and normalization method. ```APIDOC ## colormesh() ### Description Heatmap (color mesh) visualization. ### Parameters - `x`, `y`: Grid coordinates - `z`: 2D array of values - `map`: Color map - `min`, `max`: Value range for color mapping - `norm`: Normalization method ``` -------------------------------- ### Create a New Git Branch Source: https://github.com/lilaq-project/lilaq/blob/main/CONTRIBUTING.md Use this command to create a new branch for your feature or bugfix. Ensure the branch name is descriptive. ```sh git checkout -b feature/your-feature-name ``` -------------------------------- ### Configure Datetime Scale Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Automatically applies a datetime scale when data coordinates are datetimes. The scale formats ticks appropriately as dates and times. ```typst #lq.diagram(xscale: "datetime", ...) ``` -------------------------------- ### Diagram with Simple Title Content Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Configures a diagram with a basic title using plain text content. The title is automatically placed by the 'lq.diagram' function. ```typst #lq.diagram( title: [My Title], // Simple content ... ) ``` -------------------------------- ### violin() / hviolin() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Generates violin plots to visualize the full data distribution shapes. These functions are available in the `src/plot/violin.typ` and `src/plot/hviolin.typ` modules respectively. ```APIDOC ## violin() / hviolin() Violin plots showing full data distribution shapes. **Module**: `src/plot/violin.typ`, `src/plot/hviolin.typ` ### Parameters - `data`: Array of arrays (one per violin) - `positions`: Auto or array of x positions - `width`: Width of violins - `fill`: Fill color (single or per-violin) - `stroke`: Stroke style - Various distribution estimation parameters ``` -------------------------------- ### Plotting with Built-in Marks Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Demonstrates how to use string identifiers to apply pre-defined marks like circles to plot data points. Requires the 'lq.plot' function. ```typst #lq.plot((1, 2, 3), (1, 2, 3), mark: "o") ``` -------------------------------- ### Assert Dictionary Keys Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Verify that a dictionary contains all required keys and optionally check for allowed optional keys. Useful for validating configuration or input data structures. ```typst assertations.assert-dict-keys( dict, mandatory: ("key1", "key2"), optional: ("opt1", "opt2") ) ``` -------------------------------- ### Simple Line Plot Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Generates a basic line plot of the sine function. Requires importing the lilaq library. ```typst #import "@preview/lilaq:0.6.0" as lq #lq.diagram( title: [Simple Plot], xlabel: $x$, ylabel: $y$, lq.plot( lq.linspace(0, 2*calc.pi), x => calc.sin(x) ) ) ``` -------------------------------- ### hbar() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Creates horizontal bar charts. It's similar to `bar` but with x and y roles reversed, and uses `height` instead of `width`. ```APIDOC ## hbar() ### Description Creates horizontal bar charts with customizable appearance. ### Signature ```typst #let hbar( x, y, fill: auto, stroke: none, align: center, height: 80%, offset: 0, base: 0, label: none, clip: true, z-index: 2, ) = { } ``` ### Parameters #### x - Type: array | function - Description: Bar positions along y-axis (reversed role from `bar`). #### y - Type: array - Description: Bar lengths along x-axis (reversed role from `bar`). #### fill - Type: none | color | gradient | tiling | array - Default: auto - Description: Bar fill. Single value for all bars or array of per-bar fills. #### stroke - Type: auto | none | stroke | dictionary - Default: none - Description: Bar stroke. Dictionary allows per-side styling. #### align - Type: "left" | "center" | "right" - Default: center - Description: Bar alignment at x positions. #### height - Type: ratio | int | float | duration | array - Default: 80% - Description: Bar height. `ratio` (e.g., 80%) relative to spacing. Numeric for data units. `duration` for datetime. Array for per-bar heights. #### offset - Type: int | float | duration | array - Default: 0 - Description: Offset applied to all y values. Array for per-bar offsets. #### base - Type: int | float | array - Default: 0 - Description: X coordinate of bar baseline. Array for per-bar bases. #### label - Type: content - Default: none - Description: Legend label. #### clip - Type: bool - Default: true - Description: Clip to data area. #### z-index - Type: int | float - Default: 2 - Description: Rendering order. ### Usage Examples #### Horizontal Bar Chart ```typst #lq.diagram( yaxis: (subticks: none), lq.hbar( (5, 3, 4, 2, 1), (1, 2, 3, 4, 5) ) ) ``` ``` -------------------------------- ### path() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Creates a custom path element for drawing arbitrary shapes. ```APIDOC ## path() ### Description Custom path element for arbitrary shapes. ### Module `src/plot/path.typ` ``` -------------------------------- ### Global Diagram Styling Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Set global styles for all subsequent diagrams using '#show: lq.set-diagram()'. This includes dimensions, grid, and margins. Individual diagram settings can override these global defaults. ```typst #show: lq.set-diagram( width: 8cm, height: 5cm, grid: 0.5pt, margin: 5% ) #show: lq.set-xlabel(offset: 10pt) #show: lq.set-ylabel(offset: 10pt) // All subsequent diagrams use these settings ``` -------------------------------- ### layout() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Retrieves the available size for relative dimensions within a layout context. This is typically used internally for iterative layout calculations. ```APIDOC ## layout() ### Description Gets the available size (width and height) for relative dimensions within a layout context. Used internally for iterative layout with relative dimensions. ### Parameters * `callback`: A function that receives the available size as an argument. ``` -------------------------------- ### Configure Logarithmic Scale Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Sets the x-axis to use a logarithmic scale (base 10 by default). Data values must be positive. ```typst #lq.diagram(xscale: "log", ...) ``` -------------------------------- ### Sample Colors Function Signature Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md The signature for the `sample-colors` function, which is used to sample colors from a gradient or color array based on normalized data values. ```typst #let sample-colors( values, // Array of numeric values map, // Gradient or color array norm, // Normalization function min: auto, // Min value for normalization max: auto, // Max value for normalization ) = { // Returns (colors, color-info) } ``` -------------------------------- ### Set Default Grid Styling Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Applies default styling to all grid elements within its scope. Configure grid stroke. ```typst #show: lq.set-grid( stroke: 0.5pt, ) ``` -------------------------------- ### Datetime Axis Configuration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/03-AXIS-SCALES.md Utilize a datetime scale for the x-axis, plotting data against specific dates and times. Requires datetime values for data points. ```typst #let dates = ( datetime(year: 2024, month: 1, day: 1), datetime(year: 2024, month: 2, day: 1), datetime(year: 2024, month: 3, day: 1), ) #lq.diagram( xscale: "datetime", lq.plot(dates, (10, 15, 12)) ) ``` -------------------------------- ### Diagram with Configured Title Object Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Applies a custom title configuration to a diagram using the 'lq.title' object, allowing for adjustments like offset. Requires importing or defining 'lq.title'. ```typst #lq.diagram( title: lq.title( [My Title], offset: (0pt, 10pt) ), ... ) ``` -------------------------------- ### Fixed Size Diagram Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Set a diagram to a fixed width and height using absolute units like centimeters. ```typst #lq.diagram( width: 8cm, height: 6cm, lq.plot(...) ) ``` -------------------------------- ### Set Default Axis Configuration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Applies default styling to all axis elements within its scope. Configure label offsets. ```typst #show: lq.set-axis( label: (offset: 8pt), ) ``` -------------------------------- ### minmax() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Finds the minimum and maximum values within a list of numbers. ```APIDOC ## minmax() ### Description Finds the minimum and maximum values in a list. ### Parameters * `values`: A list of numbers. ### Returns A tuple containing the minimum and maximum values. ``` -------------------------------- ### Heatmap (Colormesh) Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Create a heatmap to visualize matrix data. The color intensity represents the value of z at each (x, y) coordinate. ```typst #let x = lq.linspace(0, 10) #let y = lq.linspace(0, 10) #let z = x.map(xi => y.map(yi => calc.sin(xi) * calc.cos(yi))) #lq.diagram( aspect-ratio: 1, lq.colormesh(x, y, z) ) ``` -------------------------------- ### Configure Legend Placement Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Use the legend parameter to specify the placement of the legend in the diagram. Supported positions include 'top', 'bottom', 'left', and 'right'. ```typst #lq.diagram( legend: (position: bottom), lq.plot(..., label: "Data 1"), lq.plot(..., label: "Data 2"), ) ``` -------------------------------- ### bar() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Creates vertical bar charts. It takes arrays for bar positions (x) and heights (y), with various options for styling and alignment. ```APIDOC ## bar() ### Description Creates vertical bar charts with customizable appearance. ### Signature ```typst #let bar( x, y, fill: auto, stroke: none, align: center, width: 80%, offset: 0, base: 0, label: none, clip: true, z-index: 2, ) = { } ``` ### Parameters #### x - Type: array - Description: Bar positions along x-axis. #### y - Type: array | function - Description: Bar heights. #### fill - Type: none | color | gradient | tiling | array - Default: auto - Description: Bar fill. Single value for all bars or array of per-bar fills. #### stroke - Type: auto | none | stroke | dictionary - Default: none - Description: Bar stroke. Dictionary allows per-side styling. #### align - Type: "left" | "center" | "right" - Default: center - Description: Bar alignment at x positions. #### width - Type: ratio | int | float | duration | array - Default: 80% - Description: Bar width. `ratio` (e.g., 80%) relative to spacing. Numeric for data units. `duration` for datetime. Array for per-bar widths. #### offset - Type: int | float | duration | array - Default: 0 - Description: Offset applied to all x values. Array for per-bar offsets. #### base - Type: int | float | array - Default: 0 - Description: Y coordinate of bar baseline. Array for per-bar bases. #### label - Type: content - Default: none - Description: Legend label. #### clip - Type: bool - Default: true - Description: Clip to data area. #### z-index - Type: int | float - Default: 2 - Description: Rendering order. ### Usage Examples #### Basic Bar Chart ```typst #lq.diagram( xaxis: (subticks: none), lq.bar( (1, 2, 3, 4, 5, 6), (1, 2, 3, 2, 5, 3) ) ) ``` #### Multiple Bar Series ```typst #lq.diagram( xaxis: (subticks: none), lq.bar( (1, 2, 3, 4, 5), (5, 3, 4, 2, 1), width: 0.35, fill: blue, label: "Series A" ), lq.bar( (1, 2, 3, 4, 5), (3, 2, 5, 4, 2), width: 0.35, fill: red, offset: 0.35, label: "Series B" ) ) ``` #### Variable Bar Widths ```typst #lq.diagram( lq.bar( (1, 2, 3, 4, 5), (1, 2, 3, 2, 5), width: (1, 0.5, 1, 0.5, 1), fill: orange ) ) ``` ``` -------------------------------- ### Datetime Bars with Width Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Generate a bar chart with datetime on the x-axis. Specify the width of the bars using a duration, such as '20day'. ```typst #let start = datetime(year: 2024, month: 1, day: 1) #let dates = ( start, start + 1day * 30, start + 1day * 60, start + 1day * 90, ) #lq.diagram( xscale: "datetime", lq.bar( dates, (100, 150, 120, 200), width: 20day ) ) ``` -------------------------------- ### Mark Object Configuration Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/04-TYPES.md Defines the structure for a mark object, specifying drawing function, fill color, stroke, and size. Used for custom styling of data point markers. ```typst ( mark: function, // Drawing function (e.g., circle, rect) fill: color, // Fill color stroke: stroke, // Outline stroke size: length, // Size of mark ) ``` -------------------------------- ### Place Content at Data Coordinate Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Use the `place` function to position arbitrary content at specific data coordinates within a plot. It supports alignment and clipping options. ```typst #let place( x, y, body, align: top + left, clip: true, ) = { } ``` -------------------------------- ### boxplot() / hboxplot() Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Generates box plots to visualize data distribution quartiles. Supports customization of positions, width, fill, and stroke. ```APIDOC ## boxplot() / hboxplot() ### Description Generates box plots to visualize data distribution quartiles. Supports customization of positions, width, fill, and stroke. ### Signature ```typst #let boxplot( data, positions: none, width: auto, fill: auto, stroke: none, whisker-length: 1.5, label: none, clip: true, z-index: 2, ) = { } ``` ### Parameters #### Path Parameters - `data` (array) - Required - Array of arrays, each inner array is one box's data values. - `positions` (auto | array) - Optional - X positions of boxes. `auto` uses 1, 2, 3, ... Defaults to none. - `width` (auto | ratio | float) - Optional - Box width. `auto` for automatic spacing. Defaults to auto. - `fill` (auto | color | array) - Optional - Box fill color. Single or per-box array. Defaults to auto. - `stroke` (none | stroke) - Optional - Box stroke. Defaults to none. - `whisker-length` (float) - Optional - Whisker reach in units of IQR (e.g., 1.5 for standard). Defaults to 1.5. - `label` (any) - Optional - Legend label. Defaults to none. - `clip` (bool) - Optional - Clip to data area. Defaults to true. - `z-index` (int | float) - Optional - Rendering order. Defaults to 2. ### Usage Example ```typst #lq.diagram( lq.boxplot( ( (1, 2, 2, 3, 3, 3, 4, 4, 5), (1, 1, 2, 3, 4, 5, 5, 6, 6), ), positions: (1, 2), width: 0.5 ) ) ``` ``` -------------------------------- ### Equal Aspect Ratio Diagram Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Maintain an equal aspect ratio for the diagram by setting 'width' to 'auto' and 'aspect-ratio' to 1.0. Define axis limits to ensure the aspect ratio is visually consistent. ```typst #lq.diagram( width: auto, height: 6cm, aspect-ratio: 1.0, xlim: (-5, 5), ylim: (-5, 5), lq.plot(...) ) ``` -------------------------------- ### Custom Margins for Diagram Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/06-EXAMPLES-AND-PATTERNS.md Apply custom margins to a diagram using a dictionary specifying percentages for left, right, top, and bottom. ```typst #lq.diagram( margin: (left: 3%, right: 5%, top: 8%, bottom: 4%), lq.plot(...) ) ``` -------------------------------- ### Push Branch to Fork Source: https://github.com/lilaq-project/lilaq/blob/main/CONTRIBUTING.md After committing your changes, push the new branch to your forked repository. This makes your changes available for a pull request. ```sh git push origin feature/your-feature-name ``` -------------------------------- ### Custom Tick Formatter Function Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/05-UTILITIES-AND-CONFIG.md Implement a custom function to format tick values. The function receives a tick value and should return a string representation for display. ```typst #let my-formatter(value) = { str(value) + " units" } #lq.diagram( xaxis: (format-ticks: my-formatter) ) ``` -------------------------------- ### Smooth Plot with Bézier Interpolation Source: https://github.com/lilaq-project/lilaq/blob/main/_autodocs/02-PLOT-FUNCTIONS.md Generates a smooth plot using Bézier spline interpolation. Note that `smooth: true` is incompatible with the `step` parameter. ```typst #lq.diagram( lq.plot( range(8), (3, 6, 2, 6, 5, 9, 0, 4), smooth: true ) ) ```