# Inspect Viz ## Welcome Welcome to Inspect Viz, a data visualisation library for [Inspect AI](https://inspect.aisi.org.uk/). Inspect Viz provides flexible tools for creating high quality interactive visualisations from Inspect evaluations. Here’s an Inspect Viz plot created with the [`scores_timeline()`](view-scores-timeline.qmd) function that compares benchmarks scores over time[^1]: Use the filters to switch benchmarks and restrict to models from various organization(s). Hover over the points to get additional details on them or view the underlying Inspect log for the evals. ## Installation First, install the `inspect_viz` package from GitHub as follows: ``` bash pip install git+https://github.com/meridianlabs-ai/inspect_viz ``` Inspect Viz plots are interactive Jupyter Widgets and can be authored in variety of ways: 1. In any [Jupyter Notebook](https://jupyter.org/) (JupyterLab, VS Code, Colab, etc.) 2. In VS Code with the **Jupyter: Run Current File in Interactive Window** command. 3. In VS Code within a [Quarto](https://quarto.org) executable markdown document. See the article on [LLM Assistance](llm-assistance.qmd) for best practices on using language models to help with creating plots. See the articles on [Publishing](publishing.qmd) for details on including plots in documents as static images or within websites and dashboards as interactive widgets. ## Views Inspect Viz [Views](views.qmd) are pre-built plots that work with data created by the Inspect log [data frame](https://inspect.aisi.org.uk/dataframe.html) reading functions. For example, the [`scores_by_factor()`](view-scores-by-factor.qmd) view enables you to compare scores across models and a boolean factor: ``` python from inspect_viz import Data from inspect_viz.view.beta import scores_by_factor evals = Data.from_file("evals-hint.parquet") scores_by_factor(evals, "task_arg_hint", ("No hint", "Hint")) ``` The [`tool_calls()`](view-tool-calls.qmd) view enables you to visualize tool calls by sample: ``` python from inspect_viz.view.beta import tool_calls tools = Data.from_file("cybench_tools.parquet") tool_calls(tools) ``` Available views include: | View | Description | |----|----| | [`scores_by_task()`](view-scores-by-task.qmd) | Bar plot for comparing eval scores (with confidence intervals) across models and tasks. | | [`scores_by_factor()`](view-scores-by-factor.qmd) | Bar bar plot for comparing eval scores by model and a boolean factor (e.g. no hint vs. hint). | | [`scores_by_limit()`](view-scores-by-limit.qmd) | Line plot showing success rate by token limit. | | [`scores_timeline()`](view-scores-timeline.qmd) | Scatter plot with eval scores by model, organization, and release date. Filterable by evaluation and organization. | | [`scores_heatmap()`](view-scores-heatmap.qmd) | Heatmap with values for comparing scores across model and task. | | [`scores_by_model()`](view-scores-by-model.qmd) | Bar plot for comparing model scores on a single eval. | | [`tool_calls()`](view-tool-calls.qmd) | Heat map visualising tool calls over evaluation turns. | ## Plots While pre-built views are useful, you also may want to create your own custom plots. Plots in `inspect_viz` are composed of one or more [marks](reference/inspect_viz.mark.qmd), which can do either higher level plotting (e.g. `dot()`, `bar_x()`, `bar_y()`, `area()`, `heatmap()`, etc.) or lower level drawing on tπhe plot canvas (e.g. `text()`, `image()`, `arrow()`, etc.) ### Dot Plot Here is an example of a simple dot plot using a dataset of [GPQA Diamond](https://huggingface.co/datasets/fingertap/GPQA-Diamond) results: ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import dot gpqa = Data.from_file("gpqa.parquet") plot( dot( gpqa, x="model_release_date", y="score_headline_value", fill="model_organization_name", channels= { "Model": "model_display_name", "Score": "score_headline_value", "Stderr": "score_headline_stderr", } ), title="GPQA Diamond", legend="color", grid=True, x_label="Release Date", y_label="Score", y_domain=[0,1.0], ) ``` Line 5 Read the dataset from a parquet file. You can can also use `Data.from_dataframe()` to read data from any Pandas, Polars, or PyArrow data frame. Line 8 Plot using a `dot()` mark. The `plot()` function takes one or more marks or interactors. Line 12 Map the “model_organization_name” column to the `fill` scale of the plot (causing each orgnization to have its own color). Lines 13,17 Show tooltip with defined channels. Line 20 Add a `legend` to the plot as a key to our color mappings. Line 24 Ensure that the y-axis goes from 0 to 1. ### Bar Plot Here is a simple horizontal bar plot that counts the number of each species: ``` python from inspect_viz.mark import bar_x evals = Data.from_file("agi-lsat-ar.parquet") plot( bar_x( evals, x="score_headline_value", y="model_display_name", sort={"y": "x", "reverse": True}, fill="#3266ae" ), title="AR-LSAT", x_label="Score", y_label=None, margin_left=120. ) ``` Line 10 Sort the bars by score (descending). Lines 15-16 Y-axis is labeled with model names so remove default label and ensure it has enough margin. ## Links Inspect Viz supports creating direct links from visualizations to published Inspect log transcripts. Links can be made at the eval level, or to individual samples, messages, or events. For example, this plot produced with `scores_by_model()` includes a link to the underlying logs in its tooltips: ``` python from inspect_viz.view.beta import scores_by_model scores_by_model(evals) # baseline=0.91 ``` The pre-built [Views](views.qmd) all support linking when a `log_viewer` column is available in the dataset. To learn more about ammending datasets with viewer URLs as well as adding linking support to your own plots see the article on [Links](components-links.qmd). ## Filters Use [inputs](reference/inspect_viz.input.qmd) to enable filtering datasets and dynamically updating plots. For example, if we had multiple benchmarks available for a scores timeline, we could add a `select()` input for choosing between them: ``` python from inspect_viz.input import select from inspect_viz.layout import vconcat benchmarks = Data.from_file("benchmarks.parquet") vconcat( select( benchmarks, label="Benchmark", column="task_name", value="auto" ), plot( dot( benchmarks, x="model_release_date", y="score_headline_value", fill="model_organization_name", ), legend="color", grid=True, x_label="Release Date", y_label="Score", y_domain=[0,1.0], color_domain="fixed" ) ) ``` We’ve introduced a few new things here: 1. The `vconcat()` function from the [layout](reference/inspect_viz.layout.qmd) module lets us stack inputs on top of our plot. 2. The `select()` function from the [input](reference/inspect_viz.input.qmd) module binds a select box to the `task_name` column. 3. The `color_domain="fixed"` argument to `plot()` indicates that we want to preserve model organization colors even when the plot is filtered. ## Marks So far the plots we’ve created include only a single [mark](reference/inspect_viz.mark.qmd), however many of the more interesting plots you’ll create will include multiple marks. For example, here we create a heatmap of evaluation scores by model. There is a `cell()` mark which provides the heatmap background color and a `text()` mark which displays the value. ``` python from inspect_viz.mark import cell, text scores = Data.from_file("scores.parquet") plot( cell( scores, x="task_name", y="model", fill="score_headline_value", ), text( scores, x="task_name", y="model", text="score_headline_value", fill="white", ), padding=0, color_scheme="viridis", height=250, margin_left=150, x_label=None, y_label=None ) ``` Marks can be used to draw dots, lines, bars, cells, arrows, text, and images on a plot. ## Data In the examples above we made `Data` available by reading from a parquet file. We can also read data from any Python Data Frame (e.g. Pandas, Polars, PyArrow, etc.). For example: ``` python import pandas as pd from inspect_viz import Data # read directly from file penguins = Data.from_file("penguins.parquet") # read from Pandas DF (i.e. to preprocess first) df = pd.read_parquet("penguins.parquet") penguins = Data.from_dataframe(df) ``` You might wonder why is there a special `Data` class in Inspect Viz rather than using data frames directly? This is because Inpsect Viz is an interactive system where data can be dynamically filtered and transformed as part of plotting—the `Data` therefore needs to be sent to the web browser rather than remaining only in the Python session. This has a couple of important implications: 1. Data transformations should be done using standard Python Data Frame operations *prior* to reading into `Data` for Inspect Viz. 2. Since `Data` is embedded in the web page, you will want to filter it down to only the columns required for plotting (as you don’t want the additional columns making the web page larger than is necessary). ### Selections One other important thing to understand is that `Data` has a built in *selection* which is used in filtering operations on the client. This means that if you want your inputs and plots to stay synchoronized, you should pass the same `Data` instance to all of them (i.e. import into `Data` once and then share that reference). For example: ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import dot from inspect_viz.input import select from inspect_viz.layout import vconcat # we import penguins once and then pass it to select() and dot() penguins = Data.from_file("penguins.parquet") vconcat( select(penguins, label="Species", column="species"), plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", color_domain="fixed" ) ) ``` ## Tables You can also display data in a tabular layout using the `table()` function: ``` python from inspect_viz.table import column, table benchmarks = Data.from_file("benchmarks.parquet") table( benchmarks, columns=[ column("model_organization_name", label="Organization"), column("model_display_name", label="Model"), column("model_release_date", label="Release Date"), column("score_headline_value", label="Score", width=100), column("score_headline_stderr", label="StdErr", width=100), ] ) ``` You can sort and filter tables by column, use a scrolling or paginated display, and customize several other aspects of table appearance and behavior. ## Learning More Use these resources to learn more about using Inspect Viz: - [Views](views.qmd) describes the various available pre-built views and how to customize them. - [Plots](components-plots.qmd) goes into further depth on plotting options and how to create custom plots. - Articles on [Marks](components-marks.qmd), [Links](components-links.qmd), [Tables](components-tables.qmd), [Inputs](components-inputs.qmd), and [Interactivity](components-interactivity.qmd) explore other components commonly used in visualizations. - [Publishing](publishing.qmd) covers publishing Inspect Viz content as standalone plots, notebooks, websites, and dashboards. - [Reference](reference/index.qmd) provides details on the available marks, interactors, transforms, and inputs. - [Examples](examples/index.qmd) demonstrates more advanced plotting and interactivity features. [^1]: This plot was inspired by and includes data from the [Epoch AI](https://epoch.ai/data/ai-benchmarking-dashboard) Benchmarking Hub # Plots A `plot()` produces a single visualisation and consists of one or more *marks*—graphical primitives such as bars, areas, and lines—which serve as chart layers. Each plot has a dedicated set of encoding *channels* with named *scale* mappings such as `x`, `y`, `color`, `opacity`, etc. Below we’ll describe the core semantics of plots and the various ways you can customize them. ## Basics Here is a simple dot plot that demonstrates some key concepts (click on the numbers at right for additional details): ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import dot penguins = Data.from_file("penguins.parquet") plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", grid=True, width=700, height=400 ) ``` Lines 8-9 `dot()` mark for a simple dot plot, using a distinct `stroke` and `symbol` to denote the “species” column. Line 10 Legend in the default location, keyed by `symbol`. Lines 11-13 Additional attributes that affect plot size and appearance. ## Facets Plots support faceting of the `x` and `y` dimensions, producing associated `fx` and `fy` scales. For example, here we compare model performance on several tasks. The `task_name` is the `fx` scale, resulting in a separate grouping of bars for each task: ``` python from inspect_viz import Data from inspect_viz.plot import plot, legend from inspect_viz.mark import bar_y evals = Data.from_file("evals.parquet") plot( bar_y( evals, x="model", fx="task_name", y="score_headline_value", fill="model", tip=True, channels={ "Task": "task_name", "Model": "model", "Score": "score_headline_value", "Log Viewer": "log_viewer" } ), legend=legend("color", frame_anchor="bottom"), x_label=None, x_ticks=[], fx_label=None, y_label="score", y_domain=[0, 1.0] ) ``` Line 9 Add an x-facet (“task_name”) using the `fx` option. Line 20 Define legend using `legend()` function (to enable setting `location` and other options). Line 21 Remove default x labeling as it is handled by the legend. Line 22 Tweak y-axis with shorter label and ensure that it goes all the way up to 1.0. ## Marks The plots above use only a single mark (`dot()` and `bar_y()` respectively). More sophisticated plots are often constructed with multiple marks. For example, here is a plot that adds a regression line mark do a standard dot plot: ``` python from inspect_viz import Data from inspect_viz.mark import dot, regression_y from inspect_viz.plot import plot athletes = Data.from_file("athletes.parquet") plot( dot( athletes, x="weight", y="height", fill="sex", opacity=0.1 ), regression_y( athletes, x="weight", y="height", stroke="sex" ), legend="color" ) ``` Lines 8,12 Use `fill` to distinguish male and female athletes; use `opacity` to deal with a large density of data points. Lines 13,17 Use `stroke` to ensure that male and female athletes each get their own regression line. ## Tooltips Tooltips enable you to provide additional details when the user hovers their mouse over various regions of the plot. Tooltips are enabled automatically for dot marks (`dot()`, `dot_x()`, `dot_y()`, `circle()`, and `hexagon()`) and cell marks (`cell()`, `cell_x()`, etc.) and can be enabled with `tip=True` for other marks. For example: ``` python plot( bar_y( evals, x="model", fx="task_name", y="score_headline_value", fill="model", tip=True ), legend=legend("color", frame_anchor="bottom"), x_label=None, x_ticks=[], fx_label=None, y_label="score", y_domain=[0, 1.0] ) ``` Line 6 Add `tip=True` to enable tooltips for marks where they are not automatically enabled. ![](tooltip-basic.png) Note that tooltips can interfere with plot interactions—for example, if your bar plot was clickable to drive selections in other plots you would not want to specify `tip=True`. ### Channels As illustrated above, tooltips show all dataset channels that provide scales (e.g. `x`, `y`, `fx`, `stroke`, `fill`, `symbol`, etc.). There are a few things we do to improve on the default display: 1. The labels are scale names rather than domain specific names (e.g. “fx” rather than “model”) 2. The order of labels isn’t ideal. 3. There are some duplicate values (e.g “fill” and “fx”) 4. We might want to include additional columns not used in the rest of the plot (e.g. a link to the log file). You can exercise more control over the tooltip by specifying `channels` along with the mark. For example: ``` python plot( bar_y( evals, x="model", fx="task_name", y="score_headline_value", fill="model", tip=True, channels={ "Task": "task_name", "Model": "model", "Score": "score_headline_value", "Log Viewer": "log_viewer" } ), ... ) ``` Lines 7,12 The `channels` option maps labels to columns in the underlying data—all defined `channels` will appear in the tooltip. URL values are automatically turned into links as shown here. ![](tooltip-channels.png) ## Titles Plot titles can be added using the `title` option. For example, here we add a title at the top of the frame: ``` python plot( dot(athletes, x="weight", y="height", fill="sex", opacity=0.1), regression_y(athletes, x="weight", y="height", stroke="sex"), title="Olympic Athletes", legend="color" ) ``` If you have facet labels on the top of the x-axis, you may need to provide some additional `top_margin` for the `title` so that it is placed above the facet labels. Use the `title()` function to customize this: ``` python from inspect_viz.mark import title plot( ... title=title("Olympic Athletes", margin_top=40), ... ) ``` You can also customize the font size, weight, and family using the `title()` function. ## Axes There are several options available for controlling the domain, range, ticks, and labels for axes. ### Labels By default axes labels are taken from the columns they are mapped to. Specify an `x_label` or `y_label` to override this: ``` python plot( ..., x_label="release_date", y_label="score" ) ``` If you want no axes label at all, pass `None`. For example: ``` python plot( ..., x_label=None ) ``` ### Domain By default, the x and y axes have a domain that matches the underlying data. For example, if the data ranges from 0 to 0.8 the axes will reflect this. Set a specific `x_domain` or `y_domain` to override this. For example, here we specify that we want the y-axis to span from 0 to 1.0: ``` python plot( ..., y_domain=[0,1.0] ) ``` You can also specify “fixed” for a domain, which will preserve the domain of the initial values plotted. This is useful if you have created filters for your data and you want the axes to remain stable across filtering. For example: ``` python plot( ..., y_domain="fixed" ) ``` ### Ticks You can explicitly control the axes ticks using the `x_ticks` and `y_ticks` options. For example, here we specify ticks from 0 to 100 by 10: ``` python plot( ..., x_ticks=range(0, 100, 10) ) ``` If you want no ticks at all specify `[]`, for example: ``` python plot( ..., x_ticks=[] ) ``` There are several other tick related options. Here - `[x,y]_tick_size` — The length of axis tick marks in pixels. - `[x,y]_tick_rotate` — The rotation angle of axis tick labels in degrees clockwise. - `[x,y]_tick_spacing` — The desired approximate spacing between adjacent axis ticks, affecting the default ticks. - `[x,y]_tick_padding` — The distance between an axis tick mark and its associated text label. - `[x,y]_tick_format` — How to format inputs for axis tick labels (a [d3-format](https://d3js.org/d3-format) or [d3-time-format](https://d3js.org/d3-time-format)). ## Legends *Legends* can be added to `plot` specifications or included as standalone elements: ``` python from inspect_viz.plot import plot, legend plot( ..., legend=legend("color") ) ``` Below we’ll describe the options used to position and style legends. See the `legend()` function documentation for details on all legend options. ### Positioning - Use `frame_anchor` to position the legend on a side or corner of the plot. - Use `inset` to position the legend inside the plot area (use `inset_x` and `inset_y` to position more precisely) For example, to place the legend inset in the top left, you could write: ``` python legend("color", frame_anchor="top-left", inset=20) ``` ![](legend-basic.png) ### Legend Style Legends are by default placed in a bordered box. Use the `border` and `background` options to control box colors (specifying `False` to omit border or background color). For example: ``` python legend("color", border="blue", background="white") ``` ### Multiple Legends You may can pass multiple legends (strings like “color” or calls to `legend()`) to the `plot()` funciton. Each may be positioned independently using `frame_anchor` and `inset`, or if they share a position, the legends will be merged into a container in that location. For example, the following adds two legends in the same container in the default position ( right of the plot): ``` python plot( dot(penguins, x=x_axis, y=y_axis, stroke="species", symbol="species"), grid=True, x_label="Body mass (g) →", y_label="↑ Flipper length (mm)", legend=[legend("color"), legend("symbol")] ) ``` ![](legend-multiple.png) ### Interactions Legends also act as interactors, taking a bound `Selection` as a `target` parameter. For example, discrete legends use the logic of the `toggle` interactor to enable point selections. Two-way binding is supported for Selections using *single* resolution, enabling legends and other interactors to share state. See the docs on [Toggle](components-interactivity.qmd#toggle) interactors for an example of an interactive legend. ### Legend Name The `name` directive gives a `plot` a unique name. A standalone legend can reference a named plot `legend(..., for_plot="penguins")` to avoid respecifying scale domains and ranges. ## Baselines Baselines can be including `baseline()` marks in the plot definition (or by including them in the `marks` option of pre-built [views](views.qmd)). For example, here we add a baseline with the median weight from the athletes data: ``` python from inspect_viz.mark import baseline from inspect_viz.transform import median, sql plot( dot(athletes, x="weight", y="height", fill="sex", opacity=0.1), baseline(70), regression_y(athletes, x="weight", y="height", stroke="sex"), legend="color" ) ``` If you have a simple static baseline, you may simply provide the value, along with other options to customize the label, position, and other attributes of the baseline. You can also use a tranformation function like `median()` to define baselines: ``` python from inspect_viz.mark import title plot( ... baseline( median("weight"), data=athletes, label="Median", label_position="middle", color="red"), ... ) ``` By default, baselines are drawn using the x-axis values. To draw a baseline using the y-axis values, pass `orientation="y"` to the baseline function. ## Margins Since the text included in axes lables is dynamic, you will often need to adjust the plot margins to ensure that the text fits properly within the plot. Use the `margin_top`, `margin_left`, `margin_right`, and `margin_bottom` options to do this. Note that there are also `facet_margin_top`, `facet_margin_left`, etc. options available. For example, here we set a `margin_left` of 100 pixels to ensure that potentially long model names have room to display: ``` python plot( data, bar_y(...), margin_left=100 ) ``` ## Colors Use the `color_scheme` option to the `plot()` function to pick a theme (see the `ColorScheme` reference for available schemes). Use the `color_range` option to specify an explicit set of colors. For example, here we use the “tableau10” `color_scheme`: ``` python plot( bar_y( evals, x="model", fx="task_name", y="score_headline_value", fill="model", ), legend=legend("color", frame_anchor="bottom"), x_label=None, x_ticks=[], fx_label=None, y_label="score", y_domain=[0, 1.0], color_scheme="tableau10" ) ``` ## Data In the examples above we made `Data` available by reading from a parquet file. We can also read data from any Python Data Frame (e.g. Pandas, Polars, PyArrow, etc.). For example: ``` python import pandas as pd from inspect_viz import Data # read directly from file penguins = Data.from_file("penguins.parquet") # read from Pandas DF (i.e. to preprocess first) df = pd.read_parquet("penguins.parquet") penguins = Data.from_dataframe(df) ``` You might wonder why is there a special `Data` class in Inspect Viz rather than using data frames directly? This is because Inpsect Viz is an interactive system where data can be dynamically filtered and transformed as part of plotting—the `Data` therefore needs to be sent to the web browser rather than remaining only in the Python session. This has a couple of important implications: 1. Data transformations should be done using standard Python Data Frame operations *prior* to reading into `Data` for Inspect Viz. 2. Since `Data` is embedded in the web page, you will want to filter it down to only the columns required for plotting (as you don’t want the additional columns making the web page larger than is necessary). ### Selections One other important thing to understand is that `Data` has a built in *selection* which is used in filtering operations on the client. This means that if you want your inputs and plots to stay synchoronized, you should pass the same `Data` instance to all of them (i.e. import into `Data` once and then share that reference). For example: ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import dot from inspect_viz.input import select from inspect_viz.layout import vconcat # we import penguins once and then pass it to select() and dot() penguins = Data.from_file("penguins.parquet") vconcat( select(penguins, label="Species", column="species"), plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", color_domain="fixed" ) ) ``` ## SQL You can use the `sql()` transform function to dynamically compute the values of channels within plots. For example, here we dynamically add a `bias` parameter to a column: ``` python from inspect_viz import Data, Param from inspect_viz.input import slider from inspect_viz.layout import vconcat from inspect_viz.mark import area_y from inspect_viz.plot import plot from inspect_viz.transform import sql random_walk = Data.from_file("random-walk.parquet") bias = Param(100) vconcat( slider(label="Bias", target=bias, min=0, max=1000, step=1), plot( area_y( random_walk, x="t", y=sql(f"v + {bias}"), fill="steelblue" ) ) ) ``` Any valid SQL expression can be used. For example, here we use an `IF` expression to set the stroke color based on a column value: ``` python stroke=sql(f"IF(task_arg_hint, 'blue', 'red')") ``` ## Dates ### Numeric Values In some cases your plots will want to deal with date columns as numeric values (e.g. for plotting a regression line). For this case, use the `epochs_ms()` transform function to take a date and turn it into a timestampm (milliseconds since the epoch). For example: ``` python from inspect_viz.mark import regression_y from inspect_viz.transform import epoch_ms regression_y( evals, x=epoch_ms("model_release_date"), y="score_headline_value", stroke="#AAAAAA" ) ``` Note that when doing this you’ll also want to apply formatting to the tick labels so they appear as dates (the next section covers how to do this). ### Tick Formatting Use the tick format attributes (e.g. `x_tick_format` and `y_tick_format`) to specify the formatting for date columns on tick labels. For example: ``` python plot( ..., x_tick_format="%b. %Y" ) ``` You can specify any [d3-time-format](https://d3js.org/d3-time-format) as the tick format. ### Reductions In some cases you may have timeseries data which you’d like to reduce across months or years (e.g.collapse year values to enable comparison over months only). The following transformations can be used to do this: | | | |----|----| | `date_day()` | Transform a Date value to a day of the month for cyclic comparison. Year and month values are collapsed to enable comparison over days only. | | `date_month()` | Transform a Date value to a month boundary for cyclic comparison. Year values are collapsed to enable comparison over months only. | | `date_day_month()` | Map date/times to a month and day value, all within the same year for comparison. | ## Attributes *Attributes* are plot-level settings such as `width`, `height`, margins, and scale options (e.g., `x_domain`, `color_range`, `y_tick_format`). Attributes may be `Param`-valued, in which case a plot updates upon param changes. Some of the more useful plot attribues include: - `width`, `height`, and `aspect_ratio` for controlling plot size. - `margin` and `facet_margin` (and more specific margins like `margin_top`) for controlling layout margins. - `style` for providing CSS styles. - `aria_label` and `aria_description`, `x_aria_label`, `x_aria_description`, etc. for accessibilty attributes. - `x_domain`, `x_range,`y_domain`, and`y_range\` for controlling the domain and range of axes. - Tick settings for `x`, `y`, `fx`, and `fy` axes (e.g. `x_ticks`, `x_tick_rotate`, etc.) - `r` (radius) scale settings (e.g. `r_domain`, `r_range`, `r_label`, etc.) See `PlotAttributes` for documentation on all available plot attributes. # Marks ## Overview *Marks* are graphical primitives, often with accompanying data transforms, that serve as chart layers. Marks accept a `Data` source (which are queried as required) and a set of supported options, including encoding *channels* (such as `x`, `y`, `fill`, and `stroke`) that can encode data *fields*. A data field may be a column reference or query expression, including dynamic param values. Common expressions include aggregates (`count()`, `sum()`, `avg()`, `median()`, *etc.*), window functions, date functions, and a `bin()` transform. Marks support dual modes of operation: if an explicit array of data values is provided instead of a backing `Data` reference, the values will be visualized without issuing any queries to the data. This functionality is particularly useful for adding manual annotations, such as custom rules or text labels. ## Basic Basic marks, such as `dot()`, `bar_x()`, `bar_y()`, `rect()`, `cell()`, `text()`, `tick()`, `rule_x()`, and `rule_y()`, mirror their namesakes in [Observable Plot](https://observablehq.com/plot/). For example, here is a plot with two marks. (a dot plot and a regression line): ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import dot, regression_y athletes = Data.from_file("athletes.parquet") plot( dot(athletes, x="weight", y="height", fill="sex", opacity=0.1), regression_y(athletes, x="weight", y="height", stroke="sex") ) ``` Variants such as `bar_x()` and `bar_y()` indicate spatial orientation and data type assumptions. `bar_y()` indicates vertical bars—continuous `y` over an ordinal `x` domain—whereas `rect_y()` indicates a continuous `x` domain. `Data` is backed by a DuckDB SQL database running in the web browser. Basic marks follow a straightforward query construction process: - Iterate over all encoding channels to build a `SELECT` query. - If no aggregates are encountered, query all fields directly. - If aggregates are present, include non-aggregate fields as `GROUP BY` criteria. - If provided, map filtering criteria to a SQL `WHERE` clause. ## Channels Marks are constructed by mapping *channels* to scales. Besides columns, other types of channel inputs include transforms (e.g. `count()`, `bin()`, `stddev()`, or even arbitrary `sql()` statements) as well as literal values (often used for `text()` annotations on plots or a `line()` drawn at an arbitrary location). Here are the scales which you will most commonly bind channels to: | Scale | Description | |----------|---------------------------------------------------------| | `x` | Horizontal position | | `y` | Vertical position | | `fx` | Horizontal facet position | | `fy` | Vertical facet position | | `z` | Optional ordinal channel for grouping data into series. | | `r` | Radius of a mark (e.g. circle radius) | | `stroke` | Color for mark | | `fill` | Fill color for mark | | `symbol` | Symbol used for mark | In addition, many marks have scales to deal with ranges of x or y values (e.g. area marks, arrows, etc.): | Scale | Description | |-------|------------------------------| | `x1` | Starting horizontal position | | `x2` | Ending horizontal position | | `y1` | Starting vertical position | | `y2` | Ending vertical position | ## Connected The `area()` and `line()` marks connect consecutive sample points. Connected marks are treated similarly to basic marks, with one notable addition: the queries for spatially oriented marks (`area_y()`, `line_x()`) can apply [M4 optimization](https://observablehq.com/@uwdata/m4-scalable-time-series-visualization). The query construction method uses plot width and data min/max information to determine the pixel resolution of the mark range. When the data points outnumber available pixels, M4 performs perceptually faithful pixel-aware binning of the series, limiting the number of drawn points. This optimisation offers dramatic data reductions for both single and multiple series. Separately, a `regression_y()` mark is available for linear regression fits. Regression calculations and associated statistics are performed in-database in a single aggregate query. The mark then draws the regression line and optional confidence interval area. ## Density The `density_y()` mark performs 1D kernel density estimation (KDE). The `density_y()` mark defaults to areas, but supports a `type` option to instead use lines, points, or other basic marks. The generated query performs *linear binning*, an alternative to standard binning that proportionally distributes the weight of a point between adjacent bins to provide greater accuracy for density estimation. The query uses subqueries for the “left” and “right” bins, then aggregates the results. The query result is a 1D grid of binned values which are then smoothed. As smoothing is performed in the browser, interactive bandwidth updates are processed immediately. The `density()`, `contour()`, `heatmap()`, and `raster()` marks compute densities over a 2D domain using either linear (default) or standard binning. Smoothing again is performed in browser; setting the `bandwidth` option to zero disables smoothing. The `contour()` mark then performs contour generation, whereas the `raster()` mark generates a coloured bitmap. The `heatmap()` mark is a convenient shortcut for a `raster()` that performs smoothing by default. Dynamic changes of bandwidth, contour thresholds, and color scales are handled immediately in browser. The `hexbin()` mark pushes hexagonal binning and aggregation to the database. Color and size channels may be mapped to `count()` or other aggregates. Hexagon plotting symbols can be replaced by other basic marks (such as `text()`) via the `type` option. The `dense_line()` mark creates a density map of line segments, rather than points. Line density estimation is pushed to the database. To ensure that steep lines are not over-represented, we approximate arc-length normalisation for each segment by normalising by the number of filled raster cells on a per-column basis. We then aggregate the resulting weights for all series to produce the line densities. # Links ## Overview Inspect Viz supports creating direct links from visualizations to published Inspect log transcripts. Links can be made at the eval level, or to individual samples, messages, or events. The basic steps required for creating links to logs from visualizations are: 1. Publish your log directory using the [`inspect view bundle`](https://inspect.aisi.org.uk/log-viewer.html#sec-publishing) command. 2. Read logs into a data frame using the [log dataframe](https://inspect.aisi.org.uk/dataframe.html) functions, then ammend the data frame with log viewer URLs that point to the published bundle (we’ll cover how to do this below). 3. Include the log viewer URLs as a custom channels on your plot [marks](components-marks.qmd) as appropriate. The link will be available within the [tooltip](components-plots.qmd#tooltips) for your mark. ## Step 1: Publish Logs You can use the command [`inspect view bundle`](https://inspect.aisi.org.uk/log-viewer.html#sec-publishing) (or the [`bundle_log_dir()`](https://inspect.aisi.org.uk/reference/inspect_ai.log.html#bundle_log_dir) function from Python) to create a self contained directory with the log viewer and a set of logs for display. This directory can then be deployed to any static web server ([GitHub Pages](https://docs.github.com/en/pages), [S3 buckets](https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html), [Netlify](https://docs.netlify.com/get-started/), etc.) to provide a standalone version of the viewer. For example, to bundle the `logs` directory to a directory named `logs-www`: ``` bash $ inspect view bundle --log-dir logs --output-dir logs-www ``` You can then deploy `logs-www` to any static web host. ## Step 2: Prepare Data Next, you’ll want to ammend the data frame that you’ve read with e.g. [`evals_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#evals_df) or [`samples_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#samples_df) with log viewer URLs that point to the published logs. You can do this using the [`prepare()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#prepare) and [`log_viewer()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#log_viewer) functions from the `inspect_ai.analysis` module. For example, if you have previously published your “logs” directory to https://example.com/logs/: ``` python from inspect_viz import Data from inspect_ai.analysis import evals_df, prepare, log_viewer # read evals and ammend with log viewer URL df = evals_df("logs") df = prepare(df, log_viewer("evals", { "logs": "https://example.com/logs/" })) # read as inspect viz data evals = Data.from_dataframe(df) ``` ## Step 3: Link Channel Once your data is prepared, you need to ensure that links are incorporated onto plots. ### Custom Plot If you are creating a custom plot, you should add a mapping to the “log_viewer” column to your mark’s `channels`. For example: ``` python from inspect_viz import Data from inspect_viz.plot import plot, legend from inspect_viz.mark import bar_y evals = Data.from_file("evals.parquet") plot( bar_y( evals, x="model", fx="task_name", y="score_headline_value", channels={ "Log Viewer": "log_viewer" }, fill="model", ), legend=legend("color", frame_anchor="bottom"), x_label=None, x_ticks=[], fx_label=None, y_label="score", y_domain=[0, 1.0] ) ``` Line 11 Add Log Viewer channel mapped to the `log_viewer` column created with the `prepare()` function above. ### Built-In Views The built-in [Views](views.qmd) already support the `log_viewer` column, so links appear automatically when using those functions. For example: ``` python from inspect_viz import Data from inspect_viz.view.beta import scores_by_model evals = Data.from_file("agi-lsat-ar.parquet") scores_by_model(evals) ``` If you mouse over the bars you will see a log viewer link which you can click to navigate to the log. # Tables Use tables to display an interactive grid of data used in your visualization. Tables support commonly used operations like sorting, filtering, pagination and a variety of other customization options. ## Basics In its most simple form, the `table()` function will display the contents of the `Data` provided. For example, the following: ``` python from inspect_viz import Data from inspect_viz.table import table penguins = Data.from_file("penguins.parquet") table(penguins) ``` results in a table displaying all the columns and rows in the penguins dataset: In addition to providing the base `Data` for the table, you may also select which columns are displayed: ``` python from inspect_viz import Data from inspect_viz.table import table penguins = Data.from_file("penguins.parquet") table(penguins, columns=[ "species", "island", "sex", "body_mass"]) ``` Tables have a number of global options for configuring the behavior, but also have many options specific to one or more columns. To specify column level options, using the `column` function in the list of columns rather than simply passing the column name: ``` python from inspect_viz import Data from inspect_viz.table import column, table penguins = Data.from_file("penguins.parquet") table(penguins, columns=[ column("species", align="center"), "island", "sex", "body_mass"]) ``` ### Size By default, tables will have a height which matches the size of their content and a width which files their container (with a default maximum size of 500px). You can explicitly provide a height and width value in pixels for the table if you’d like the table to be a specific size: ``` python from inspect_viz import Data from inspect_viz.table import table penguins = Data.from_file("penguins.parquet") table(penguins, height=200, width=550) ``` You can use `max_width` to constrain the maximum width of the table in pixels. It will still attempt to fill its container, but it’s width will not exceed the `max_width`. ## Columns When providing column data for a table, you can provide a list of columns names from your Data to be displayed. You can also use the `column` function to provide additional options for each column. For example, to customize the string that is displayed in the header for the column, using the `label` option like: ``` python from inspect_viz import Data from inspect_viz.table import column, table penguins = Data.from_file("penguins.parquet") table(penguins, columns=[ "species", "island", "sex", column("body_mass", label="mass")]) ``` ### Width If no explicit column size is provided, the width of each column is an equal share of the available space. You can specify the width of columns either using an explicit pixel size: ``` python from inspect_viz import Data from inspect_viz.table import column, table penguins = Data.from_file("penguins.parquet") table(penguins, width=370, columns=[ column("species", width=80), column("island", width=100), column("sex", width=70), column("body_mass", width=100)]) ``` or using `flex` for some or all of the columns. Flex sizing works by dividing the remaining space in the grid among all flex columns in proportion to their flex value. ``` python from inspect_viz import Data from inspect_viz.table import column, table penguins = Data.from_file("penguins.parquet") table(penguins, width=550, columns=[ column("species", flex=1), column("island", flex=1.2), column("sex", width=70), column("body_mass", flex=1)]) ``` You can also use `max_width` to set a maximum width for a column or `min_width` to set a minimum width for a column. This will be used to provide caps on width when columns are being sized automatically using flex sizing. ### Alignment You can control the alignment of the values within each columns header and body using the `align` and `header_align` options. For example: ``` python from inspect_viz import Data from inspect_viz.table import column, table penguins = Data.from_file("penguins.parquet") table(penguins, columns=[ column("species", align="center", header_align="center"), column("island"), column("sex"), column("body_mass")]) ``` ### Formatting You can control the formatting of each cell’s value using the `format` option. The `format` option accepts a [d3-format](https://d3js.org/d3-format) string for numeric values and a [d3-time-format](https://d3js.org/d3-time-format) string for date values to define how the value will be formatted. ``` python table(penguins, columns=[ column("species"), column("island"), column("sex"), column("body_mass", format=",.2f")]) ``` Default formats for values are as follows: [TABLE] ### Text Wrapping You can control the text wrapping behavior of the values within each columns header and body using the `wrap_text` and `header_wrap_text` options. This is most frequently paired with `auto_height` to create rows with automatic heights which wrap text. For example: ``` python table(penguins, columns=[ column("species", auto_height=True, wrap_text=True), column("island", flex=1.2), column("sex", width=70), column("body_mass", flex=1)]) ``` ## Rows ### Height By default, each row of the the table, including the header row, is 29px tall. You can set an explicit row size for the body of the table using the `row_height` argument. Set the header’s row height using the `header_height` argument: ``` python from inspect_viz import Data from inspect_viz.table import table penguins = Data.from_file("penguins.parquet") table(penguins, header_height=60, row_height=50) ``` ### Auto Height In addition to explicitly providing the heights for rows, you can also allow the content to determine the height of the row. To do this, configure one or more column with `auto_height`. The height of the row will then be determined using the largest height required to display the content of any columns with the `auto_height` option. ``` python table(penguins, width=550, columns=[ column("species", flex=1), column("island", flex=1.2, auto_height=True), column("sex", width=70), column("body_mass", flex=1)]) ``` You can also use the `header_auto_height` option to specify columns that will automatically size the header row height. ## Sorting Each column in the table is sortable by clicking on the header for the column you’d like to sort. Each click toggles between the sorting ascending, sorting descending, and not sorting. Holding `shift` while clicking will add the clicked column as a secondary sort, preserving any other sorts that have already been specified. You can disable sorting for the entire table using the `sorting` argument: ``` python table(penguins, sorting=False) ``` You can control whether individual columns can be sorted using the `sortable` option for `column`: ``` python table(penguins, columns=[ column("species", sortable=False), column("island"), column("sex"), column("body_mass")]) ``` ## Filtering Each column of the table is filterable by clicking the filter icon in the header of the column. Depending upon the type of data in the column, different filtering options will be presented to the user. To disable filtering for a table, use `filtering`: ``` python table(penguins, filtering=False) ``` You can control whether individual columns can be filtered using the `filterable` option for `column`: ``` python table(penguins, columns=[ column("species", filterable=False), column("island"), column("sex"), column("body_mass")]) ``` #### Filter Location You can control where in the table filters appear by passing other `header` or `row` as the value for filter. `header` places in the filter as buttons in the header row next to the header text. `row` creates\` a separate row with inline filter UI for filtering columns. For example: ``` python table(penguins, filtering='row') ``` ## Resizing Each column of the table may be resized by the user by clicking and dragging the separator between columns in the header row. To make the table columns not resizable, use the `resizing` option: ``` python table(penguins, resizing=False) ``` You can control whether individual columns can be resized using the `resizable` option for `column`: ``` python table(penguins, columns=[ column("species", resizable=False), column("island"), column("sex"), column("body_mass")]) ``` ## Pagination When configured, tables can display pages of items with pagination controls at the bottom of the table rather than display all the items in a scrollable body. To enable pagination, simply provide the pagination argument to the `table`: ``` python from inspect_viz.table import column, table table(penguins, columns=[ column("species"), column("island"), column("sex"), column("body_mass")], pagination=True) ``` By default, the table will automatically set the page size to use the available space in the table without scrolling. You can also explicitly choose page size and page size options: ``` python from inspect_viz.table import column, table, Pagination table(penguins, columns=[ column("species"), column("island"), column("sex"), column("body_mass")], pagination=Pagination(page_size=20, page_size_selector=[20,40,60])) ``` ## Grouping When displaying tabular data, it can be useful to group the data by specific fields. For example, to display a table with the average attributes of male and female penguins based upon their species, you can using grouping function for some columns: ``` python from inspect_viz.transform import avg, count table(penguins, height=120, columns=[ column("species"), column(avg("body_mass")), column(avg("flipper_length"))]) ``` When providing transforms to apply to columns (e.g. `avg`, `sum`), columns without aggregating transforms will be treated as columns to group by. So in the above example, the table is grouped by `species` displaying the rest of the values using their aggregate values. ## Literal Data You can also pass literal values (an `int | float | bool`) as a column by passing one or more values as the `column` itself. For example: ``` python table(penguins, columns=[ column([1,2,3,4,5,6,7,8,9], label="sample_bucket"), column("species"), column("body_mass"), column("flipper_length")]) ``` If a single value is passed, that value will be repeated for every row in the dataset. If a list of values is passed, each row will increment through the list and include the value from the row index. If the list is shorter than the dataset, values will be repeated by repeatedly iterating through the list. ## Selection By default, the table will display the selection provided by the data source. If you’d like, you can provide an alternative selection by using `filter_by`. #### Targeting Selections It can be useful to use selected rows within a table to target a selection to be used elsewhere (for example, in highlighting points within a dot plot). To do this, use the `target` option to select the output selection. This will cause a selection clause of the form column IN (rows) to be added to the selection for each currently selected table row. For example: ``` python table(penguins, target=selection) ``` You can use the `select` option to control how selection works within the table. By default, `select` is set to `single_row` which will allow selection of one row at a time by clicking the row. Other options are listed below: | Option | Action | |----|----| | `hover` | The selection will be updated when the user’s mouse hovers over a row. | | `single_row` | The selection will be updated when a single row is selected. The selected row will be highlighted. | | `multiple_row` | The selection will be updated when one or more rows are selected. The selected rows will be highlighted. | | `single_row_checkbox` | The selection will be updated when a single row is selected using a checkbox. | | `multiple_row_checkbox` | The selection will be updated when one or more rows is selected using a checkbox. | ## Appearance Tables have a minimal default appearance using the [AG Grid](https://www.ag-grid.com/javascript-data-grid/themes/) `Balham` theme. If the table is being displayed in a [Quarto](https://www.quarto.org) page or dashboard, it will automatically inherit the theme of the page on which it is hosted. You can customize most aspects of the table appearance using the `style` argument like: ``` python from inspect_viz.table import column, table, Pagination, TableStyle table(penguins, columns=[ column("species"), column("island"), column("sex"), column("body_mass")], style=TableStyle( background_color="#FCFAFF", foreground_color="purple", accent_color="#E8FFB3")) ``` ### Color Using the three following basic color options will provide new colors for the table (with the overall colors of the table derived from these three themes). Each of these colors accepts a `css` color value (for example a hex color string or a named value like `red`). | Option | Target | |----|----| | `background_color` | The background color use for cells. | | `foreground_color` | The foreground color used for values within cells. | | `accent_color` | Accent color used for things like selection and highlights. | In addition to the previous basic options, you can do further customization of the colors by passing a `css` color value to the following: | Option | Target | |----|----| | `text_color` | The text color for UI elements presented within the table. | | `header_text_color` | The color for text in the header row. | | `cell_text_color` | The color for text in cell within the body of the table. | | `selected_row_background_color` | The background color of selected rows. | ### Fonts You can control the fonts used by the table by passing a `css` `font-family` value in the following options: | Option | Target | |----------------------|------------------------------------------------------| | `font_family` | The default font for all text within the table. | | `header_font_family` | The font used for text within the header row. | | `cell_font_family` | The font used for text within the body of the table. | ### Border You can control the border of the table using the following border options: | Options | Target | |-----------------|----------------------------------------------------| | `border_color` | The color of the border (value `css` color value). | | `border_width` | The width in pixels of the border. | | `border_radius` | The border radius in pixels. | ### Spacing The `spacing` options controls how tightly data and UI elements are packed together in the table. All the padding within in the table is defined relative to this value, so changing this value will affect the spacing of everything in the table. By default, tables have `4` pixels of spacing. To change this value, pass the number of pixels like so: ``` python table(penguins, columns=[ column("species"), column("island"), column("sex"), column("body_mass")], style=TableStyle(spacing=20)) ``` # Inputs Inputs are used to create interactive visualisations by targeting either `Param` values or `Selection` ranges. Available inputs include: - `select()` - `slider()` - `search()` - `checkbox()` - `radio_group()` - `checkbox_group()` All inputs can write updates to a provided `Param` or `Selection`. Param values are updated to match the input value. Selections are provided a predicate clause. This linking can be bidirectional: an input component will also subscribe to a param and track its value updates. ## Select The `select()` input is used to select one more more values from a list. The list can be sourced from a data column (via the `column` parameter) or be static (via the `options` parameter). Here is a select input bound to a column (this input targets the default `Selection` associated with the passed `Data`): ``` python from inspect_viz import Data from inspect_viz.input import select penguins = Data.from_file("penguins.parquet") select(penguins, label="Species", column="species") ``` Note that by default the select has no value so does not filtering (represented by the default “All” selection). If you want a `select()` to have an initial value then specify it using the `value` parameter (or pass ‘auto’ to select the first value): ``` python select(penguins, label="Species", column="species", value="auto") ``` Here is a select input with explicit options (this input targets a `Param`): ``` python from inspect_viz import Param fruit = Param("Apple") select(label="Fruit", options=["Apple", "Orange", "Banana"], target=fruit) ``` Pass `multiple=True` to enable multiple inputs. In this case values are specified via typing/autocomplete rather than a drop down menu. ``` python athletes = Data.from_file("athletes.parquet") select(athletes, label="Sports", column="sport", multiple=True) ``` ## Slider The `slider()` input enables specificiation of either a single numeric value or a range of values. Here we enable the selection of a maximum body mass for a column: ``` python from inspect_viz.input import slider slider(penguins, label="Max Body Mass", column="body_mass") ``` Pass `select="interval"` to specify an interval rather than single value: ``` python slider(penguins, label="Body Mass Range", column="body_mass", select="interval") ``` Sliders can also target a `Param` and have explicit `min`, `max`, and `step` values: ``` python bias = Param(0.5) slider(label="Bias", min=0, max=1.0, step=0.1, target=bias) ``` ## Search The `search()` input enables filtering a dataset based on text matching. For example, this input filters by WNBA player name ``` python from inspect_viz.input import search players = Data.from_file("wnba-shots-2023.parquet") search(players, label="Athlete", column="athlete_name") ``` ## Checkbox The `checkbox()` input enables toggling a binary value. You can either target boolean `Param` values or provide custom values mapped to checked and unchecked. ``` python from inspect_viz.input import checkbox enabled = Param(True) checkbox(label="Enabled", target=enabled) ``` Here we provide custom values that map to checked and unchecked states: ``` python bias = Param(0.1) checkbox(label="Use Bias", values=[0.0, 0.1], target=bias) ``` ## Radio Group The `radio_group()` is an alternative to `select()` which displays all of the available options rather than collapsing them into a menu: ``` python from inspect_viz.input import radio_group penguins = Data.from_file("penguins.parquet") radio_group(penguins, label="Species", column="species") ``` Or targeting a `Param`: ``` python fruit = Param("Apple") radio_group(label="Fruit", options=["Apple", "Orange", "Banana"], target=fruit) ``` ## Checkbox Group The `checkbox_group()` provides an interface to select multiple values (similar to `select(..., multiple=True)`): ``` python from inspect_viz.input import checkbox_group penguins = Data.from_file("penguins.parquet") checkbox_group(penguins, label="Species", column="species") ``` You can also use `checkbox_group()` with a `Param`: ``` python fruit = Param(["Apple", "Orange"]) checkbox_group(label="Fruit", options=["Apple", "Orange", "Banana"], target=fruit) ``` # Interactivty ## Overview Inspect Viz supports interactive filtering and cross-filtering of plot data based based on [Inputs](components-inputs.qmd) and [Interactors](#interactors). Filtering is done based on *Selections*: each `Data` table has a built-in selection and you can also create `Selection` instances for more sophisticated behaviors. ## Filtering The most straightforward usage of selections is adding inputs which filter the data displayed in a plot. This filtering uses the *built in* selection of `Data` instances. For example, here we add a `select()` input to enable filtering by species: ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import dot from inspect_viz.input import select from inspect_viz.layout import vconcat penguins = Data.from_file("penguins.parquet") vconcat( select(penguins, label="Species", column="species"), plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", color_domain="fixed" ) ) ``` Line 9 `vconcat()` function stacks the select input on top of the plot. Line 10 Select input bound to “species” column. Line 12 Use of `penguins` in both `select()` and `plot()` automatically binds to default selection for the penguins `Data` object. Line 15 Fixed color domain ensures that species colors remain the same even when filtered. ### Fixed Domain The example agove introduces an important concept when dealing with selections and filtering: `"fixed"` scale domains (in this case `color_domain="fixed"`). Fixed scale domains instruct a plot to first calculate a scale domain in a data-driven manner, but then keep that domain fixed across subsequent updates. Fixed domains enable stable configurations without requiring a hard-wired domain to be known in advance, preventing disorienting scale domain “jumps” that hamper comparison across filter interactions. Several of the examples below will use `"fixed"` domains to provide this stability across interactions. ## Params As illustrated above, inputs can be used to filter dataset selections. Inputs can also be used to set `Param` values that make various aspects of plots dynamic. For example, here is a density plot of flight delays which uses a `slider()` input to vary the amount of smooth ing by setting the kernel bandwidth: ``` python from inspect_viz import Param from inspect_viz.input import slider from inspect_viz.mark import density_y flights = Data.from_file("flights.parquet") bandwidth = Param(0.1) vconcat( slider( label="Bandwidth (σ)", target=bandwidth, min=0.1, max=100, step=0.1 ), plot( density_y( flights, x="delay", fill="steelblue", bandwidth=bandwidth ), x_domain="fixed", y_axis=None, height=250, ) ) ``` Line 7 Create a `bandwidth` parameter with a default value of 0.1. Line 11 Bind the `slider()` to the `bandwidth` parameter. Line 16 Apply the `bandwidth` to the plot (plot automatically redraws when the bandwidth changes). ## Interactors *Interactors* imbue plots with interactive behavior. Most interactors listen to input events from rendered plot SVG elements to update bound [*selections*](reference/inspect_viz.qmd#selection). Interactors take facets into account to properly handle input events across subplots. ### Interval The `interval_x()` and `interval_y()` interactors create 1D interval brushes. The `interval_xy()` interactor creates a 2D brush. Interval interactors accept a `pixel_size` parameter that sets the brush resolution: values may snap to a grid whose bins are larger than screen pixels and this can be leveraged to optimize query latency. For example, below we stack two plots vertically, a `dot()` plot along with a `bar_x()` plot that counts the `sex` column. We then add an `interval_x()` interactor that enables us to filter the dataset using selections on the dot plot. ``` python from inspect_viz import Data, Selection from inspect_viz.interactor import Brush, interval_x from inspect_viz.plot import plot from inspect_viz.mark import bar_x, dot, regression_y from inspect_viz.transform import count athletes = Data.from_file("athletes.parquet") range = Selection.intersect() vconcat( plot( dot(athletes, x="weight", y="height", fill="sex", opacity=0.1), regression_y(athletes, x="weight", y="height", stroke="sex"), interval_x( target=range, brush=Brush(fill="none", stroke="#888") ), legend="color" ), plot( bar_x( athletes, filter_by=range, x=count(), y="sex", fill="sex" ), y_label=None, height=150, x_domain="fixed" ) ) ``` Line 9 A `Selection` is a means of filtering datasets based on interactions. Here we use an “intersect” selection for application of a simple filter from dot plot to bar plot. Line 16 The `range` selection is set via the `interval_x()` interactor (which enables using the mouse to select an x-range). Line 17 The `Brush` defines the color of the interactor (in this case `#888`, a medium-gray). Line 23 The `range` selection is consumed using the `filter_by` parameter. Line 28 We set the `x_domain` for the bar plot to “fixed” so that the scale doesn’t change as the dataset is filtered. Try using the mouse to brush over regions on the dot plot—the bar plot will update accordingly. ### Toggle The `toggle()` interactor selects individual points (e.g., by click or shift-click) and generates a selection clause over specified fields of those points. Directives such as `toggle_color()`, `toggle_x()`, and `toggle_y()` simplify specification of which channel fields are included in the resulting predicates. The `highlight()` interactor updates the rendered state of a visualization in response to a Selection. Non-selected points are set to translucent, neutral gray, or other specified visual properties. Selected points maintain normal encodings. This example demonstrates using the `toggle_y()` and `highlight()` interactors to render a bar chart that can be clicked to select a subset of points on the dot plot above it. The dot plot legend also targets the same the selection to make itself interactive. ``` python from inspect_viz import Data, Selection from inspect_viz.interactor import highlight, toggle_y from inspect_viz.plot import legend, plot from inspect_viz.mark import bar_x, dot from inspect_viz.layout import vconcat from inspect_viz.transform import count, date_month_day seattle = Data.from_file("seattle-weather.parquet") weather = Selection.single() vconcat( plot( dot( data=seattle, filter_by=weather, x=date_month_day("date"), y="temp_max", fill="weather", fill_opacity=0.7, r="precipitation", ), legend=legend("color", target=weather), x_tick_format="%b", color_domain="fixed", r_domain="fixed", r_range=[2, 10] ), plot( bar_x(seattle, x=count(), y="weather", fill="weather"), toggle_y(target=weather), highlight(by=weather), x_domain="fixed", y_label=None, height=200 ) ) ``` Line 10 Single selection (filter out all other points). Line 16 Dot plot should filter by the selection. Line 21 Show precipitation level using dot radius. Line 23 Clicks on the legend target the same selection Line 31 `toggle_y()` interactor to filter by weather. Line 32 `highlight()` interactor to fade out unselected bars. Try clicking either the legend or the bar plot elements to filter the dot plot. ## Crossfilter In many cases you’ll want to have an input or interactor that both consumes and produces the same selection (i.e. filtered based on interactions with other inputs or interactors, but also able to provide its own filtering). ### Inputs This example demonstrates crossfiltering across [inputs](reference/inspect_viz.input.qmd). We plot shot types taken during the 2023 WNBA season, providing a `select()` input that filters by team, and another `select()` input that filters by player (which in turn is also filtered by the currently selected team). Click on the numbers at right for additional explanation of the code. ``` python from inspect_viz import Data, Selection from inspect_viz.input import select from inspect_viz.layout import vconcat, hconcat from inspect_viz.mark import bar_x from inspect_viz.plot import plot from inspect_viz.transform import count shots = Data.from_file("wnba-shots-2023.parquet") filter = Selection.crossfilter() vconcat( hconcat( select( shots, label="Team", column="team_name", target=filter ), select( shots, label="Athlete", column="athlete_name", filter_by=filter, target=filter ) ), plot( bar_x( shots, filter_by=filter, x=count(), y="category", fill="category" ), y_label=None, color_domain="fixed", y_domain=["Jump", "Layup", "Hook"], height=200, margin_left=60 ) ) ``` Line 10 Create a crossfilter selection, which enables inputs to both consume and produce the same selection (conditioning their available choices on other inputs). Line 16 The team select box targets the `filter` selection (filtering both the choices in the athelte select box and what is displayed in the plot). Line 20 The athlete select box is both *filtered by* and targets the `filter` selection, enabling it to both confine itself to the selected team as well as filter what is displayed in the plot. Lines 29-30 As different teams and players are selected, the y-axis may take on differnet values and ordering. These options ensure that the y-axis remains stable across selections. ### Interactors This example demonstrates crossfiltering across plot [interactors](reference/inspect_viz.interactor.qmd). We plot histograms showing arrival delay and departure time for flights. When you select a range in one plot, the other plot updates to show only the data within that selection—and vice versa. This bidirectional filtering is achieved using `Selection.crossfilter()`, which ensures each plot’s selection affects all other plots except itself. Click on the numbers at right for additional explanation of the code. ``` python from inspect_viz import Data, Selection from inspect_viz.mark import rect_y from inspect_viz.layout import vconcat from inspect_viz.plot import plot from inspect_viz.transform import count, bin from inspect_viz.interactor import interval_x flights = Data.from_file("flights.parquet") brush = Selection.crossfilter() def flights_plot(x, label): return plot( rect_y( flights, filter_by=brush, x=bin(x), y=count(), fill="steelblue" ), interval_x(target=brush), height=200, x_label=label, x_domain="fixed", y_tick_format="s" ) vconcat( flights_plot("delay", "Arrival Delay (min)"), flights_plot("time", "Departure Time (hour)") ) ``` Line 10 Create a crossfilter selection, which ensures each plot’s selection affects all other plots except itself. Line 12 Our two plots are identical save for the `x` value and the `x_label` so factor out into a function. Line 18 The `interval_x()` interactor enables horizontal selection (targeting the crossfiltering `brush`). Line 21 Use a `"fixed"` domain so that the x-axis remains stable even when being filtered. Try selecting a horizontal range on either or both of the bar plots. # Scores by Task ## Overview The `scores_by_task()` function renders a bar plot for comparing eval scores. ``` python from inspect_viz import Data from inspect_viz.view.beta import scores_by_task evals = Data.from_file("evals.parquet") scores_by_task(evals) ``` ## Data Preparation Above we read the data for the plot from a parquet file. This file was in turn created by: 1. Reading logs into a data frame with [`evals_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#evals_df). 2. Using the [`prepare()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#prepare) function to add [`model_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) and [`log_viewer()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) columns to the data frame. ``` python from inspect_ai.analysis import evals_df, log_viewer, model_into, prepare df = evals_df("logs") df = prepare(df, model_info(), log_viewer("eval", {"logs": "https://samples.meridianlabs.ai/"}), ) df.to_parquet("evals.parquet") ``` You can additionally use the [`task_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#task_info) operation to map lower-level task names to task display names (e.g. “gpqa_diamond” -\> “GPQA Diamond”). Note that both the log viewer links and model names are optional (the plot will render without links and use raw model strings if the data isn’t prepared with `log_viewer()` and `model_info()`). ## Function Reference Bar plot for comparing eval scores. Summarize eval scores using a bar plot. By default, scores (`y`) are plotted by “task_display_name” (`fx`) and “model_display_name” (`x`). By default, confidence intervals are also plotted (disable this with `y_ci=False`). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_task.py#L18) ``` python def scores_by_task( data: Data, model_name: str = "model_display_name", task_name: str = "task_display_name", score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", score_label: str | None | NotGiven = NOT_GIVEN, ci: bool | float = 0.95, title: str | Title | None = None, marks: Marks | None = None, width: float | Param | None = None, height: float | Param | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](reference/inspect_viz.qmd#data) Evals data table. This is typically created using a data frame read with the inspect `evals_df()` function. `model_name` str Name of field for the model name (defaults to “model_display_name”) `task_name` str Name of field for the task name (defaults to “task_display_name”) `score_value` str Name of field for the score value (defaults to “score_headline_value”). `score_stderr` str Name of field for stderr (defaults to “score_headline_metric”). `score_label` str \| None \| NotGiven Score axis label (pass None for no label). `ci` bool \| float Confidence interval (e.g. 0.80, 0.90, 0.95, etc.). Defaults to 0.95. `title` str \| [Title](reference/inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function). `marks` [Marks](reference/inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| [Param](reference/inspect_viz.qmd#param) \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| [Param](reference/inspect_viz.qmd#param) \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `**attributes` Unpack\[[PlotAttributes](reference/inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `margin_bottom` are is set to 10 pixels and `x_ticks` is set to `[]`. ## Implementation The [Scores by Task](examples/inspect/scores-by-task/index.qmd) example demonstrates how this view was implemented using lower level plotting components. # Scores by Model ## Overview The `scores_by_model()` function creates a horizontal bar plot for comparing the scores of different models on a single evaluation, with one or more baselines overlaid as vertical lines. ``` python from inspect_viz import Data from inspect_viz.view.beta import scores_by_model from inspect_viz.mark import baseline evals = Data.from_file("agi-lsat-ar.parquet") scores_by_model(evals, marks=baseline(0.697, label="Human")) ``` ## Data Preparation Above we read the data for the plot from a parquet file. This file was in turn created by: 1. Reading logs into a data frame with [`evals_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#evals_df). 2. Using the [`prepare()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#prepare) function to add [`model_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) and [`log_viewer()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) columns to the data frame. ``` python from inspect_ai.analysis import evals_df, log_viewer, model_into, prepare df = evals_df("logs") df = prepare(df, model_info(), log_viewer("eval", {"logs": "https://samples.meridianlabs.ai/"}), ) df.to_parquet("agi-lsat-ar.parquet") ``` You can additionally use the [`task_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#task_info) operation to map lower-level task names to task display names (e.g. “gpqa_diamond” -\> “GPQA Diamond”). Note that both the log viewer links and model names are optional (the plot will render without links and use raw model strings if the data isn’t prepared with `log_viewer()` and `model_info()`). ## Function Reference Bar plot for comparing the scores of different models on a single evaluation. Summarize eval scores using a bar plot. By default, scores (`y`) are plotted by “model_display_name” (`y`). By default, confidence intervals are also plotted (disable this with `y_ci=False`). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_model.py#L18) ``` python def scores_by_model( data: Data, *, model_name: str = "model_display_name", score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", ci: float = 0.95, sort: Literal["asc", "desc"] | None = None, score_label: str | None | NotGiven = None, model_label: str | None | NotGiven = None, color: str | None = None, title: str | Title | None = None, marks: Marks | None = None, width: float | None = None, height: float | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](reference/inspect_viz.qmd#data) Evals data table. This is typically created using a data frame read with the inspect `evals_df()` function. `model_name` str Column containing the model name (defaults to “model_display_name”) `score_value` str Column containing the score value (defaults to “score_headline_value”). `score_stderr` str Column containing the score standard error (defaults to “score_headline_stderr”). `ci` float Confidence interval (e.g. 0.80, 0.90, 0.95, etc.). Defaults to 0.95. `sort` Literal\['asc', 'desc'\] \| None Sort order for the bars (sorts using the ‘x’ value). Can be “asc” or “desc”. Defaults to “asc”. `score_label` str \| None \| NotGiven x-axis label (defaults to None). `model_label` str \| None \| NotGiven x-axis label (defaults to None). `color` str \| None The color for the bars. Defaults to “\#416AD0”. Pass any valid hex color value. `title` str \| [Title](reference/inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function) `marks` [Marks](reference/inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `**attributes` Unpack\[[PlotAttributes](reference/inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `y_inset_top` and `margin_bottom` are set to 10 pixels and `x_ticks` is set to `[]`. ## Implementation The [Scores by Model](examples/inspect/scores-by-model/index.qmd) example demonstrates how this view was implemented using lower level plotting components. # Scores by Factor ## Overview The `scores_by_factor()` function renders a bar plot for comparing eval scores by model and a boolean factor (e.g. non-reasoning vs. reasoning, no hint vs. hint, etc.). ``` python from inspect_viz import Data from inspect_viz.view.beta import scores_by_factor evals = Data.from_file("evals-hint.parquet") scores_by_factor(evals, "task_arg_hint", ("No hint", "Hint")) ``` ## Data Preparation Above we read the data for the plot from a parquet file. This file was in turn created by: 1. Reading logs into a data frame with [`evals_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#evals_df). 2. Using the [`prepare()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#prepare) function to add [`model_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) and [`log_viewer()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) columns to the data frame. ``` python from inspect_ai.analysis import evals_df, log_viewer, model_into, prepare df = evals_df("logs") df = prepare(df, model_info(), log_viewer("eval", {"logs": "https://samples.meridianlabs.ai/"}), ) df.to_parquet("evals-hint.parquet") ``` You can additionally use the [`task_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#task_info) operation to map lower-level task names to task display names (e.g. “gpqa_diamond” -\> “GPQA Diamond”). You should also ensure that your evals data frame has a boolean field corresponding to the factor you are splitting on (in the example above this is “task_arg_hint”). ## Function Reference Summarize eval scores with a factor of variation (e.g ‘No hint’ vs. ‘Hint’). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_factor.py#L13) ``` python def scores_by_factor( data: Data, factor: str, factor_labels: tuple[str, str], score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", score_label: str = "Score", model: str = "model", model_label: str = "Model", ci: bool | float = 0.95, color: str | tuple[str, str] = "#3266ae", title: str | Mark | None = None, marks: Marks | None = None, width: float | Param | None = None, height: float | Param | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](reference/inspect_viz.qmd#data) Evals data table. This is typically created using a data frame read with the inspect `evals_df()` function. `factor` str Field with factor of variation (should be of type boolean). `factor_labels` tuple\[str, str\] Tuple of labels for factor of variation. `False` value should be first, e.g. `("No hint", "Hint")`. `score_value` str Name of field for x (scoring) axis (defaults to “score_headline_value”). `score_stderr` str Name of field for scoring stderr (defaults to “score_headline_stderr”). `score_label` str Label for x-axis (defaults to “Score”). `model` str Name of field for y axis (defaults to “model”). `model_label` str Lable for y axis (defaults to “Model”). `ci` bool \| float Confidence interval (e.g. 0.80, 0.90, 0.95, etc.). Defaults to 0.95.) `color` str \| tuple\[str, str\] Hex color value (or tuple of two values). If one value is provided the second is computed by lightening the main color. `title` str \| [Mark](reference/inspect_viz.mark.qmd#mark) \| None Title for plot (`str` or mark created with the `title()` function). `marks` [Marks](reference/inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| [Param](reference/inspect_viz.qmd#param) \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| [Param](reference/inspect_viz.qmd#param) \| None The outer height of the plot in pixels, including margins. Default to 65 pixels for each item on the “y” axis. `**attributes` Unpack\[[PlotAttributes](reference/inspect_viz.plot.qmd#plotattributes)\] Additional \`PlotAttributes ## Implementation The [Scores by Factor](examples/inspect/scores-by-factor/index.qmd) example demonstrates how this view was implemented using lower level plotting components. # Scores Timeline ## Overview The `scores_timeline()` function plots eval scores by model, organization, and release date[^1]: ``` python from inspect_viz import Data from inspect_viz.view.beta import scores_timeline evals = Data.from_file("benchmarks.parquet") scores_timeline(evals) ``` ## Data Preparation Above we read the data for the plot from a parquet file. This file was in turn created by: 1. Reading logs into a data frame with [`evals_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#evals_df). 2. Using the [`prepare()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#prepare) function to add [`model_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info), [`frontier()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#frontier) and [`log_viewer()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) columns to the data frame. ``` python from inspect_ai.analysis import ( evals_df, frontier, log_viewer, model_into, prepare ) df = evals_df("logs") df = prepare(df, model_info(), frontier(), log_viewer("eval", {"logs": "https://samples.meridianlabs.ai/"}), ) df.to_parquet("benchmarks.parquet") ``` ## Filtering A `select()` input for tasks is automatically provided if more than one task exists in the `data`. A `checkbox_group()` is automatically provided for organizations if more than one organization exists (you can disable this with `organizations_filter=False`). When multiple organizations exist, clicking on the legend for an organization will filter the plot by that organization. ## Function Reference Eval scores by model, organization, and release date. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_timeline.py#L28) ``` python def scores_timeline( data: Data, task_name: str = "task_display_name", model_name: str = "model_display_name", model_organization: str = "model_organization_name", model_release_date: str = "model_release_date", score_name: str = "score_headline_name", score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", organizations: list[str] | None = None, filters: bool | list[Literal["task", "organization"]] = True, ci: float | bool = 0.95, time_label: str = "Release Date", score_label: str = "Score", eval_label: str = "Eval", title: str | Title | None = None, marks: Marks | None = None, width: float | Param | None = None, height: float | Param | None = None, regression: bool = False, legend: Legend | NotGiven | None = NOT_GIVEN, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](reference/inspect_viz.qmd#data) Data read using `evals_df()` and amended with model metadata using the `model_info()` prepare operation (see [Data Preparation](https://inspect.aisi.org.uk/dataframe.html#data-preparation) for details). `task_name` str Column for task name (defaults to “task_display_name”). `model_name` str Column for model name (defaults to “model_display_name”). `model_organization` str Column for model organization (defaults to “model_organization_name”). `model_release_date` str Column for model release date (defaults to “model_release_date”). `score_name` str Column for scorer name (defaults to “score_headline_name”). `score_value` str Column for score value (defaults to “score_headline_value”). `score_stderr` str Column for score stderr (defaults to “score_headline_stderr”) `organizations` list\[str\] \| None List of organizations to include (in order of desired presentation). `filters` bool \| list\[Literal\['task', 'organization'\]\] Provide UI to filter plot by task and organization(s). `ci` float \| bool Confidence interval (defaults to 0.95, pass `False` for no confidence intervals) `time_label` str Label for time (x-axis). `score_label` str Label for score (y-axis). `eval_label` str Label for eval select input. `title` str \| [Title](reference/inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function). `marks` [Marks](reference/inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| [Param](reference/inspect_viz.qmd#param) \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| [Param](reference/inspect_viz.qmd#param) \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `regression` bool If `True`, adds a regression line to the plot (uses the confidence interval passed using ci). Defaults to False. `legend` [Legend](reference/inspect_viz.plot.qmd#legend) \| NotGiven \| None Legend to use for the plot (defaults to `None`, which uses the default legend). `**attributes` Unpack\[[PlotAttributes](reference/inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `x_domain` is set to “fixed”, the `y_domain` is set to `[0,1.0]`, `color_label` is set to “Organizations”, and `color_domain` is set to `organizations`. ## Implementation The [Scores Timeline](examples/inspect/scores-timeline/index.qmd) example demonstrates how this view was implemented using lower level plotting components. [^1]: This plot was inspired by and includes data from the [Epoch AI](https://epoch.ai/data/ai-benchmarking-dashboard) Benchmarking Hub # Scores Heatmap ## Overview The `scores_heatmap()`function renders a heatmap for comparing eval scores. ``` python from inspect_viz import Data from inspect_viz.view.beta import scores_heatmap evals = Data.from_file("evals.parquet") scores_heatmap(evals, height=200, legend=True) ``` ## Data Preparation Above we read the data for the plot from a parquet file. This file was in turn created by: 1. Reading logs into a data frame with [`evals_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#evals_df). 2. Using the [`prepare()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#prepare) function to add [`model_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) and [`log_viewer()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#model_info) columns to the data frame. ``` python from inspect_ai.analysis import evals_df, log_viewer, model_into, prepare df = evals_df("logs") df = prepare(df, model_info(), log_viewer("eval", {"logs": "https://samples.meridianlabs.ai/"}), ) df.to_parquet("evals.parquet") ``` You can additionally use the [`task_info()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#task_info) operation to map lower-level task names to task display names (e.g. “gpqa_diamond” -\> “GPQA Diamond”). Note that both the log viewer links and model names are optional (the plot will render without links and use raw model strings if the data isn’t prepared with `log_viewer()` and `model_info()`). ## Function Reference Creates a heatmap plot of success rate of eval data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_heatmap.py#L33) ``` python def scores_heatmap( data: Data, task_name: str = "task_display_name", task_label: str | None | NotGiven = None, model_name: str = "model_display_name", model_label: str | None | NotGiven = None, score_value: str = "score_headline_value", cell: CellOptions | None = None, tip: bool = True, title: str | Title | None = None, marks: Marks | None = None, height: float | None = None, width: float | None = None, legend: Legend | bool | None = None, sort: Literal["ascending", "descending"] | SortOrder | None = "ascending", orientation: Literal["horizontal", "vertical"] = "horizontal", **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](reference/inspect_viz.qmd#data) Evals data table. `task_name` str Name of column to use for columns. `task_label` str \| None \| NotGiven x-axis label (defaults to None). `model_name` str Name of column to use for rows. `model_label` str \| None \| NotGiven y-axis label (defaults to None). `score_value` str Name of the column to use as values to determine cell color. `cell` [CellOptions](reference/inspect_viz.view.qmd#celloptions) \| None Options for the cell marks. `tip` bool Whether to show a tooltip with the value when hovering over a cell (defaults to True). `title` str \| [Title](reference/inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function) `marks` [Marks](reference/inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `height` float \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)). `width` float \| None The outer width of the plot in pixels, including margins. Defaults to 700. `legend` [Legend](reference/inspect_viz.plot.qmd#legend) \| bool \| None Options for the legend. Pass None to disable the legend. `sort` Literal\['ascending', 'descending'\] \| SortOrder \| None Sort order for the x and y axes. If ascending, the highest values will be sorted to the top right. If descending, the highest values will appear in the bottom left. If None, no sorting is applied. If a SortOrder is provided, it will be used to sort the x and y axes. `orientation` Literal\['horizontal', 'vertical'\] The orientation of the heatmap. If “horizontal”, the tasks will be on the x-axis and models on the y-axis. If “vertical”, the tasks will be on the y-axis and models on the x-axis. `**attributes` Unpack\[[PlotAttributes](reference/inspect_viz.plot.qmd#plotattributes)\] Additional \`PlotAttributes ## Implementation The [Scores Heatmap](examples/inspect/scores-heatmap/index.qmd) example demonstrates how this view was implemented using lower level plotting components. # Tool Calls ## Overview The `tool_calls()` function creates a heat map visualising tool calls over evaluation turns. ``` python from inspect_viz import Data from inspect_viz.view.beta import tool_calls tools = Data.from_file("cybench_tools.parquet") tool_calls(tools) ``` ## Data Preparation To create the plot we read a raw messages data frame from an eval log using the [`messages_df()`](https://inspect.aisi.org.uk/reference/inspect_ai.analysis.html#messages_df) function, then filter down to just the fields we require for visualization: ``` python from inspect_ai.analysis import messages_df, log_viewer, model_info, prepare, EvalModel, MessageColumns, SampleSummary # read messages from log log = ".eval" # Be sure to add EvalModel column so links can be prepared df = messages_df(log, columns=EvalModel + SampleSummary + MessageColumns) # trim columns df = df[[ "eval_id", "sample_id", "message_id", "model", "id", "order", "tool_call_function", "limit", "log" ]] # prepare the data frame with model info and log links df = prepare(df, [ model_info(), log_viewer("message", url_mappings={ "logs": "https://samples.meridianlabs.ai/" }) ]) # write to parquet df.to_parquet("cybench_tools.parquet") ``` Note that the trimming of columns is particularly important because Inspect Viz embeds datasets directly in the web pages that host them (so we want to minimize their size for page load performance and bandwidth usage). ## Function Reference Heat map visualising tool calls over evaluation turns. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_tool_calls.py#L15) ``` python def tool_calls( data: Data, x: str = "order", y: str = "id", tool: str = "tool_call_function", limit: str = "limit", tools: list[str] | None = None, x_label: str | None = "Message", y_label: str | None = "Sample", title: str | Title | None = None, marks: Marks | None = None, width: float | None = None, height: float | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](reference/inspect_viz.qmd#data) Messages data table. This is typically created using a data frame read with the inspect `messages_df()` function. `x` str Name of field for x axis (defaults to “order”) `y` str Name of field for y axis (defaults to “id”). `tool` str Name of field with tool name (defaults to “tool_call_function”) `limit` str Name of field with sample limit (defaults to “limit”). `tools` list\[str\] \| None Tools to include in plot (and order to include them). Defaults to all tools found in `data`. `x_label` str \| None x-axis label (defaults to “Message”). `y_label` str \| None y-axis label (defaults to “Sample”). `title` str \| [Title](reference/inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function) `marks` [Marks](reference/inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `**attributes` Unpack\[[PlotAttributes](reference/inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `margin_top` is set to 0, `margin_left` to 20, `margin_right` to 100, `color_label` is “Tool”, `y_ticks` is empty, and `x_ticks` and `color_domain` are calculated from `data`. ## Implementation The [Tool Calls](examples/inspect/tool-calls/index.qmd) example demonstrates how this view was implemented using lower level plotting components. # Scores by Task This example illustrates the code behind the [`scores_by_task()`](../../../view-scores-by-task.qmd) pre-built view function. If you want to include this plot in your notebooks or websites you should start with that function rather than the lower-level code below. **Code** ``` python from inspect_viz import Data from inspect_viz.plot import plot, legend from inspect_viz.mark import bar_y, TipOptions, text, title from inspect_viz.transform import sql evals = Data.from_file("evals.parquet") plot( bar_y( evals, x="model", fx="task_name", y="score_headline_value", channels= { "Log Viewer": "log_viewer" }, fill="model", tip=True ), title=title("Plot Title", margin_top=40), legend=legend("color", frame_anchor="bottom"), x_label=None, fx_label=None, x_ticks=[], y_label="score", y_domain=[0, 1.0], color_label="Model" ) ``` Line 12 Facet the x-axis (i.e. create multiple groups of bars) by task name. Line 14 Add a channel with links to the Inspect log files (links appear in the tooltip). Line 20 We don’t need an explicit “model” or “task_name” label as they are obvious from context. We also don’t need ticks b/c the fill color and legend provide this. Line 21 Ensure that y-axis shows the full range of scores (by default it caps at the maximum). #### Confidence Interval Here we add a confidence interval for each reported score by adding a `rule_x()` mark. Note that we derive the confidence interval transforms using the `ci_bounds()` function. **Code** ``` python from inspect_viz.mark import rule_x from inspect_viz.transform import sql, ci_bounds # confidence interval bounds ci_lower, ci_upper = ci_bounds( score="score_headline_value", level=0.95, stderr="score_headline_stderr" ) plot( bar_y( evals, x="model", fx="task_name", y="score_headline_value", channels= { "Log Viewer": "log_viewer" }, fill="model", tip=True ), rule_x( evals, x="model", fx="task_name", y1=ci_lower, y2=ci_upper, stroke="black", marker="tick-x", ), legend=legend("color", frame_anchor="bottom"), x_label=None, fx_label=None, x_ticks=[], y_label="score", y_domain=[0, 1.0], color_label="Model" ) ``` Lines 4,9 Use the `ci_bounds()` bounds function to create transforms that we will pass for `y1` and `y2`. Lines 19,27 Draw the confidence interval using a `rule_x()` mark. # Scores by Model This example illustrates the code behind the [`scores_by_model()`](../../../view-scores-by-model.qmd) pre-built view function. If you want to include this plot in your notebooks or websites you should start with that function rather than the lower-level code below. The plot summarizes the scores of a single evaluation task, showing performance for 13 different models. Models are ordered based upon their headline score (defaulting to descending). **Code** ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import rule_y, baseline from inspect_viz.transform import ci_bounds evals = Data.from_file("agi-lsat-ar.parquet") ci_lower, ci_upper = ci_bounds( score="score_headline_value", level=0.95, stderr="score_headline_stderr" ) plot( rule_y( evals, x="score_headline_value", y="model", sort={"y": "x", "reverse": True}, stroke_width=4, stroke_linecap="round", marker_end="circle", tip=True, stroke="#416AD0", ), rule_y( evals, x1=ci_lower, x2=ci_upper, y="model", sort={"y": "x", "reverse": True}, stroke="#416AD020", stroke_width=15, ), baseline(0.78, label="Human"), margin_left=225, y_label=None, x_label="Score", x_domain=[0, 1.0] ) ``` Lines 8-12 Create transforms for upper and lower CI bounds. Lines 15-25 This draws the core bar chart, sorting the y-axis by the value of x (descending). Lines 26-34 This draws the error bars using the upper and lower bounds. Line 35 Add a mark for human baseline. Line 36 Ensure there is room for model names in the left margin. Line 39 Ensure that the x axis always goes to 1.0 (even if scores are below that). # Scores by Factor This example illustrates the code behind the [`scores_by_factor()`](../../../view-scores-by-factor.qmd) pre-built view function. If you want to include this plot in your notebooks or websites you should start with that function rather than the lower-level code below. **Code** ``` python from inspect_viz import Data from inspect_viz.mark import frame, rule_y from inspect_viz.plot import legend, plot from inspect_viz.transform import ci_bounds, sql evals = Data.from_file("evals.csv") # factor colors/labels fx_colors = ["#3266ae", "#a6c0e5"] fx_labels = ["No hint", "Hint"] # confidence interval tranforms ci_lower, ci_upper = ci_bounds( score="score_headline_value", level=0.95, stderr="score_headline_stderr" ) # compute plot height (65 pixels per model) height = 65 * len(evals.column_unique("model_display_name")) plot( frame("left", inset_top=5, inset_bottom=5), rule_y( evals, x="score_headline_value", y="task_arg_hint", fy="model_display_name", sort={"fy": "-x"}, stroke=sql(f"IF(NOT task_arg_hint, '{fx_labels[0]}', '{fx_labels[1]}')"), stroke_width=3, stroke_linecap="round", marker_end="circle", tip=True, channels={ "Model": "model_display_name", "Hint": "task_arg_hint", "Score": "score_headline_value", "Stderr": "score_headline_stderr" }, ), rule_y( evals, x1=ci_lower, x2=ci_upper, y="task_arg_hint", fy="model_display_name", stroke=f"{fx_colors[0]}20", stroke_width=15, ), legend=legend("color", target=evals.selection), x_label="Score", y_label=None, y_ticks=[], y_tick_size=0, fy_label=None, fy_axis="left", color_domain=fx_labels, color_range=fx_colors, margin_top=0, margin_left=100, height=height ) ``` Lines 9-10 Factors need to define a dark/light color and labels for the their `False` and `True` states. Line 20 Compute plot height based on number of unique models. Line 23 Sets off each model with their own horizonal axis line. Line 29 Order models on y axis from highest to lowest score. Lines 44-45 Confidence interval using specified stderr column. Line 51 Clickable legend to filter view by factor value. Lines 53-55 Y-axis labels and ticks already covered by factor and `frame()`. Lines 58-59 Map legend and colors map to factor. Line 61 Leave room for model names. # Scores Timeline This example illustrates the code behind the [`scores_timeline()`](../../../view-scores-timeline.qmd) pre-built view function. If you want to include this plot in your notebooks or websites you should start with that function rather than the lower-level code below. The example also relies on some [data preparation](../../../view-scores-timeline.qmd#data-preparation) steps to annotate the raw evals data with shorter model names and a “frontier” column which drives the inclusion of text labels for scores that set a new high water mark. **Code** ``` python from inspect_viz import Data, Selection from inspect_viz.input import checkbox_group, select from inspect_viz.layout import vconcat, vspace from inspect_viz.plot import plot, legend from inspect_viz.mark import dot, rule_x, text, regression_y from inspect_viz.table import table from inspect_viz.transform import ci_bounds, epoch_ms # read data evals = Data.from_file("benchmarks.parquet") # transforms to compute ci bounds from score and stderr columns ci_lower, ci_upper = ci_bounds( score="score_headline_value", level=0.95, stderr="score_headline_stderr" ) vconcat( # select benchmark select(evals, label="Eval: ", column="task_name", value="GPQA Diamond", width=425), # filter models by organization(s) checkbox_group(evals, column="model_organization_name"), # dot plot w/ error bars vspace(15), plot( # benchmark score dot( evals, x=epoch_ms("model_release_date"), y="score_headline_value", r=3, fill="model_organization_name", channels= { "Model": "model_display_name", "Scorer": "score_headline_name", "Stderr": "score_headline_stderr", "Log Viewer": "log_viewer" } ), # confidence interval rule_x( evals, x=epoch_ms("model_release_date"), y="score_headline_value", y1=ci_lower, y2=ci_upper, stroke="model_organization_name", stroke_opacity=0.4, marker="tick-x", ), # regression line regression_y( evals, x=epoch_ms("model_release_date"), y="score_headline_value", stroke="#AAAAAA" ), # frontier annotation text( evals, text="model_display_name", x=epoch_ms("model_release_date"), y="score_headline_value", line_anchor="middle", frame_anchor="right", filter="frontier", dx=-4, fill="model_organization_name", ), legend=legend("color", target=evals.selection), x_domain="fixed", y_domain=[0,1.0], x_label="Release Date", y_label="Score", color_label="Organization", color_domain="fixed", x_tick_format="%b. %Y", grid=True, ) ) ``` Line 10 Benchmark data sourced from [Epoch AI](https://epoch.ai/data/ai-benchmarking-dashboard). Lines 13,17 Create transforms used to compute the confidence intervals for each point. Line 33 Use `epoch_ms` to convert the date into a timestamp so it is numeric for use in computing the regression Lines 37,42 Additional channels are added to the tooltip. Line 52 Confidence interval: compute dynamically using `ci_value()`, color by organization, and reduce opacity. Line 65 Text annotations are automatically moved to avoid collisions. Line 70 Only show annotations for records with `frontier=True`. Line 74 Specifying `target` makes the legend clickable. Lines 75-76 Domains: `x_domain` fixed so that the axes don’t jump around for organization selections; `y_domain` should always span up to 1.0. Line 81 Use a tick format to format the x_axis value (which is a numeric timestamp) into a pretty date string. This plot was inspired by and includes data from the [Epoch AI](https://epoch.ai/data/ai-benchmarking-dashboard) Benchmarking Hub. # Scores Heatmap This example illustrates the code behind the [`scores_heatmap()`](../../../view-scores-heatmap.qmd) pre-built view function. If you want to include this plot in your notebooks or websites you should start with that function rather than the lower-level code below. **Code** ``` python from inspect_viz import Data from inspect_viz.plot import plot from inspect_viz.mark import cell, text evals_data = Data.from_file("evals.parquet") plot( cell( evals_data, x="task_name", y="model", fill="score_headline_value", tip=True, inset=1, sort={ "y": {"value": "fill", "reduce": "sum", "reverse": True}, "x": {"value": "fill", "reduce": "sum", "reverse": False}, }, ), text( evals_data, x="task_name", y="model", text="score_headline_value", fill="white", styles={"font_weight": 600}, ), padding=0, color_scheme="viridis", height=250, margin_left=150, x_label=None, y_label=None ) ``` Line 8 The `cell` mark draws the cells, position each cell along the x and y axis using the fields specified in `x` and `y`. Line 12 The cell’s color is determined using the field specified in the `fill`. Line 14 The cell inset controls the space between cells. Lines 15-18 Sorting of the cells is important in a heatmap to cause colors to be grouped along the x and y axis. In this case, we sort using the sum of the rows and columns, place the highest values at the top righ and lowest values at the bottom left. Line 20 Place the value as text centered in the cell. Line 28 Remove plot padding so the inset along controls spacing between cells. # Tool Calls This example illustrates the code behind the [`tool_calls()`](../../../reference/inspect_viz.view.qmd#tool_calls) pre-built view function. If you want to include this plot in your notebooks or websites you should start with that function rather than the lower-level code below. The plot visualizes tool usage over a series of turns in a Cybench evaluation. We use a `cell()` mark to visualize tool use over messages in each sample of an evaluation. We note any limit that ended the sample using a `text()` mark on the right side of the frame. **Code** ``` python from inspect_viz import Data from inspect_viz.plot import plot, legend from inspect_viz.mark import cell, text from inspect_viz.transform import first # read data (see 'Data Preparation' below) data = Data.from_file("cybench_tools.parquet") tools = ["bash", "python", "submit"] plot( cell( data, x="order", y="id", fill="tool_call_function" ), text( data, text=first("limit"), y="id", frame_anchor="right", font_size=8, font_weight=200, dx=50 ), legend=legend("color", frame_anchor="right"), margin_top=0, margin_left=20, margin_right=100, x_ticks=list(range(0, 400, 80)), y_ticks=[], x_label="Message", y_label="Sample", color_label="Tool", color_domain=tools ) ``` Line 7 Read tool call data (see [Data Preparation](../../../view-tool-calls.qmd#data-preparation) for details). Lines 12,17 `cell()` mark showing tool calls. Lines 19,27 `text()` mark showing whether the sample terminated due to a limit. Lines 29,31 Tweak the margins so the axis labels and text annotations appear correctly. Lines 32-33 Reduce the number of tick marks on the x-axis and eliminate y-ticks. Lines 34-36 Set some custom labels and ensure that tools follow our designed order. Line 37 Specify which tools we should show and in what order. # Penguins Explorer Use the species drop down to see only points for a particular species. Use the x and y drop downs to explore differnet variables. **Code** ``` python from inspect_viz import Data, Param from inspect_viz.input import select from inspect_viz.layout import hconcat, vconcat from inspect_viz.mark import dot from inspect_viz.plot import plot, legend from inspect_viz.table import table penguins = Data.from_file("penguins.parquet") axes = ["body_mass", "flipper_length", "bill_depth", "bill_length"] x_axis = Param("body_mass") y_axis = Param("flipper_length") vconcat( hconcat( select(penguins, label="Species", column="species"), select(label="X", options=axes, target=x_axis), select(label="Y", options=axes, target=y_axis) ), plot( dot(penguins, x=x_axis, y=y_axis, stroke="species", symbol="species"), grid=True, x_label="Body mass (g) →", y_label="↑ Flipper length (mm)", legend="color" ), ) ``` # Bias Parameter Use the slider to create bias offsets for the y-axis. **Code** ``` python from inspect_viz import Data, Param from inspect_viz.input import slider from inspect_viz.mark import area_y from inspect_viz.layout import vconcat from inspect_viz.plot import plot from inspect_viz.transform import sql random_walk = Data.from_file("random-walk.parquet") bias = Param(100) vconcat( slider(label="Bias", target=bias, min=0, max=1000, step=1), plot(area_y(random_walk, x="t", y=sql(f"v + {bias}"), fill="steelblue")) ) ``` # Seattle Weather Select a horizontal range on the dot pot to filter the contents of the bar plot. Click the legend or the bar plot to filter by weather conditions. **Code** ``` python from inspect_viz import Data, Selection from inspect_viz.interactor import Brush, highlight, interval_x, toggle_y from inspect_viz.plot import legend, plot, plot_defaults from inspect_viz.mark import bar_x, dot from inspect_viz.layout import vconcat from inspect_viz.transform import count, date_month_day # data seattle = Data.from_file("seattle-weather.parquet") # plot defaults for domain and range weather = ["sun", "fog", "drizzle", "rain", "snow"] plot_defaults( color_domain=weather, color_range=["#e7ba52", "#a7a7a7", "#aec7e8", "#1f77b4", "#9467bd"] ) # selections (scatter x-range and bar/legend click) range = Selection("intersect") click = Selection("single") vconcat( plot( dot( data=seattle, filter_by=click, x=date_month_day("date"), y="temp_max", fill="weather", fill_opacity=0.7, r="precipitation", ), interval_x(target=range, brush=Brush(fill="none", stroke="#888")), highlight(by=range, fill="#ccc", fill_opacity=0.2), legend=legend("color", target=click), xy_domain="fixed", x_tick_format="%b", r_domain="fixed", r_range=[2, 10] ), plot( bar_x(seattle, x=count(), y="weather", fill="#ccc", fill_opacity=0.2), bar_x(seattle, filter_by=range, x=count(), y="weather", fill="weather"), toggle_y(target=click), highlight(by=click), x_domain="fixed", y_domain=weather, y_label=None, height=200 ) ) ``` # Athletes (Regression) Use the drop downs to filter by sport or sex. Select a range on the plot to filter the table and see the regression lines for the selected range. Hover over the table to highlight the corresponding point on the plot. **Code** ``` python from inspect_viz import Data, Selection from inspect_viz.input import search, select from inspect_viz.interactor import Brush, interval_xy from inspect_viz.layout import hconcat, vconcat from inspect_viz.mark import TextStyles, dot, regression_y, text from inspect_viz.plot import plot from inspect_viz.table import column, table athletes = Data.from_file("athletes.parquet") category = Selection.intersect() query = Selection.intersect(include=category) hover = Selection.intersect(empty=True) vconcat( hconcat( select(athletes, label="Sport", column="sport", target=category), select(athletes, label="Sex", column="sex", target=category), ), plot( text( text=["Olympic Athletes"], frame_anchor="top", styles=TextStyles(font_size=14), dy=-20 ), dot( athletes, filter_by=query, x="weight", y="height", fill="sex", r=2, opacity=0.1, ), regression_y(athletes, filter_by=query, x="weight", y="height", stroke="sex"), interval_xy(target=query, brush=Brush(fill_opacity=0, stroke="black")), dot( athletes, filter_by=hover, x="weight", y="height", fill="sex", stroke="currentColor", stroke_width=1, r=3 ), xy_domain="fixed", r_domain="fixed", color_domain="fixed" ), table( athletes, filter_by=query, target=hover, columns=[ column("name", width=200), "sex", "height", "weight", "sport" ], ) ) ``` # Athletes (Error Bars) Confidence intervals of Olympic athlete heights, in meters. Data are batched into groups of 10 samples per sport. Use the samples slider to see how the intervals update as the sample size increases (as in [online aggregation](https://en.wikipedia.org/wiki/Online_aggregation)). For each sport, the numbers on the right show the maximum number of athletes in the full dataset. **Code** ``` python import pandas as pd import numpy as np from inspect_viz import Data, Param, Selection from inspect_viz.mark import error_bar_x, text from inspect_viz.plot import plot, legend from inspect_viz.transform import count from inspect_viz.input import slider from inspect_viz.layout import hconcat, vconcat, vspace # prepare data (create batch column so we can target various numbers of samples) df = pd.read_parquet("athletes.parquet") df = df[df['height'].notna()] df['row_num'] = df.groupby('sport').cumcount() + 1 df['batch'] = 10 * np.ceil(df['row_num'] / 10).astype(int) df = df.drop('row_num', axis=1) df = df.reset_index(drop=True) athletes = Data.from_dataframe(df) ci = Param(0.95) query = Selection.single() vconcat( hconcat( slider( athletes, label="Samples", select="interval", target=query, column="batch", step=10, value=(0,20) ), slider( label="Conf.", target=ci, min=0.5, max=0.999, value=0.95, step=0.001 ) ), plot( error_bar_x( athletes, filter_by=query, ci=ci, x="height", y="sport", stroke="sex", stroke_width=1, marker="tick", sort={ "y": "-x"} ), text( athletes, text=count(), y="sport", dx=25, frame_anchor="right", font_size=8, fill="#999" ), legend=legend("color", frame_anchor="bottom"), x_domain=[1.5,2.1], y_domain="fixed", y_grid=True, y_label=None, margin_top=0, margin_left=105 ) ) ``` # Plots ## Overview There are several ways to publish plots created with Inspect Viz: 1. Use the `write_png()` function to create an image for use in a document or presentation. 2. Use the `write_html()` function to create a standalone HTML file. 3. Create and share a Jupyter notebook with the plot. 4. Embed the plot in a website or dashboard. This article will cover the first two options for sharing standalone plots—the [Notebooks](publishing-notebooks.qmd), [Websites](publishing-websites.qmd), and [Dashboards](publishing-dashboards.qmd) articles will cover the other possibilities. ## Plot as Image Use the `write_png()` function to save a PNG version of any plot. > [!NOTE] > > The `write_png()` function requires that you install the > [playwright](https://playwright.dev/python/) Python package, which > enables taking screenshots of web graphics using an embedded version > of the Chromium web browser. You can do this as follows: > > ``` bash > pip install playwright > playwright install > ``` To create a plot and export it as a PNG: ``` python from inspect_viz import Data from inspect_viz.mark import dot from inspect_viz.plot import plot, write_png penguins = Data.from_file("penguins.parquet") pl = plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", grid=True ) write_png("penguins.png", pl) ``` Here is the plot that was written (note that since this plot is a static PNG file rather than a JavaScript widget it does not have tooltips): ![](penguins.png) ### Plot Size You can control the size of the image written by specifying the `width` and `height` directly in the call to `plot()`. For example: ``` python pl = plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", grid=True, width=900, height=400 ) ``` ### Export Options There are a couple of other options that can be used when exporting plots to PNG: | Option | Description | |----|----| | `scale` | Device scale to capture plot at. Use 2 (the default) for retina quality images suitable for high resolution displays or print output) | | `padding` | Padding (in pixels) to add around exported plot. Defaults to 8 pixels. | ## Plot as HTML You can also create an HTML version of a plot using the `write_html()` function. For example: ``` python from inspect_viz import Data from inspect_viz.mark import dot from inspect_viz.plot import plot, write_html penguins = Data.from_file("penguins.parquet") pl = plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", grid=True ) write_html("penguins.html", pl) ``` Unlike with `write_png()`, the exported HTML plot retains all interactive features (tooltips, filters, etc.). In some cases you might therefore also include [inputs](components-inputs.qmd) with your plot. For example: ``` python pl = vconcat( select(penguins, label="Species", column="species"), plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", color_domain="fixed" ) ) write_html("penguins.html", pl) ``` # Notebooks ## Overview A convenient way to share sets of plots and related commentary is to publish a notebook. There are a couple of straightforward ways to create HTML documents from notebooks ([Quarto](#quarto) and [nbconvert](#nbconvert)), and then these documents can in turn be printed to PDF if required. You can also share a live version of a notebook that supports filtering and plot interactions by pubishing it on a platform like [Google Colab](https://colab.research.google.com/). ## Quarto The [Quarto](https://quarto.org) publishing system can also convert notebooks to HTML. To install the `quarto-cli` Python package: ``` bash pip install quarto-cli ``` Then, convert any notebook which includes Inspect Viz plots as follows: ``` bash quarto render notebook.ipynb --to html --execute ``` This will create an HTML file named “notebook.html” and a directory named “notebook_files” alongside the “notebook.ipynb”. > [!IMPORTANT] > > The `--execute` flag is required to ensure that all Inspect Viz > outputs are properly rendered (as some notebook front ends like VS > Code don’t properly cache Jupyter Widget outputs). #### Preview To work on a notebook with a live updating preview, use the `quarto preview` command: ``` bash quarto preview notebook.ipynb --to html --execute ``` #### Code Blocks You can also specify that you’d to disable display of code blocks using the `-M echo:false` option: ``` bash quarto render notebook.ipynb --to html --execute -M echo:false ``` If you need a PDF version of the notebook, open the file in a browser and print to PDF. #### Publishing You can use the [Quarto Publish](https://quarto.org/docs/publishing/) command to publish a notebook to GitHub Pages, Hugging Face Spaces, Netlify, or Quarto’s own publishing service. To publish a notebook, pass it to the `quarto publish` command: ``` bash quarto publish notebook.ipynb ``` ## nbconvert The [nbconvert](https://nbconvert.readthedocs.io/en/latest/) Python package enables export of any Jupyter notebook to HTML. Install `nbconvert` with: ``` bash pip install nbconvert ``` Then, convert any notebook which includes Inspect Viz plots as follows: ``` bash jupyter nbconvert --to html --execute notebook.ipynb ``` This will create an HTML file named “notebook.html” alongside the “notebook.ipynb”. > [!IMPORTANT] > > The `--execute` flag is required to ensure that all Inspect Viz > outputs are properly rendered (as some notebook front ends like VS > Code don’t properly cache Jupyter Widget outputs). #### Code Cells You can also specify that you’d like code cells removed using the `--no-input` option: ``` bash jupyter nbconvert --to html --execute --no-input notebook.ipynb ``` If you need a PDF version of the notebook, open the file in a browser and print to PDF. # Websites ## Overview If you want to publish one or more plots as part of a website there are a couple of high level orientations to the problem: 1. Use a Jupyter-based website publishing system that supports interactive Jupyter Widgets (e.g. [Quarto](https://quarto.org)). 2. Use the `to_html()` function to create embeddable HTML fragments for your plots and embed them in any website. We’ll cover both of these approaches below. ## Quarto Websites The [Quarto](https://quarto.org) publishing system can create websites that include dynamic output from Python code, including interactve Jupyter Widgets like the ones created by Inspect Viz. To install the `quarto-cli` Python package: ``` bash pip install quarto-cli ``` Quarto is a markdown-based publishing system that enables you to embed executable Python blocks whose output is included in the published website. For instance, Here is the source code for the [Bias Parameter](examples/general/bias-parameter/index.qmd) example: ```` python --- title: "Bias Parameter" echo: false --- Use the slider to create bias offsets for the y-axis. ```{python} from inspect_viz import Data, Param from inspect_viz.input import slider from inspect_viz.mark import area_y from inspect_viz.plot import plot from inspect_viz.transform import sql random_walk = Data.from_file("random-walk.parquet") bias = Param(0) ``` ```{python} slider(label="Bias", target=bias, min=0, max=1000, step=1, value=100) ``` ```{python} plot(area_y(random_walk, x="t", y=sql(f"v + {bias}"), fill="steelblue")) ``` ```` Line 3 We specify `echo: false` to prevent display of code blocks. Lines 8-17 Markdown code blocks decorated with `{python}` are executed. Here is what the page looks like when rendered on the website (it’s a screenshot so you won’t be able to use the slider!): ![](bias-parameter.png) ### Notebook Execution When using Inspect Viz with Quarto Websites you should always add the following configuration to your `_quarto.yml` to specify that notebooks should be fully executed when rendered: **\_quarto.yml** ``` yaml execute: enabled: true ``` ### Learning More The website was created with Quarto and includes many live Inspect Viz plots and tables. The source code for the [Examples](https://github.com/meridianlabs-ai/inspect_viz/tree/main/docs/examples) section is a good place to start to understand the basics. The documentation on [Quarto Websites](https://quarto.org/docs/websites/) includes a tutorial and many additional details on creating, customizing, and publishing websites. [Quarto Dashboards](publishing-dashboards.qmd) are a special type of Quarto website optimized for displaying many plots and tables together, so are also worth considering. ## HTML Fragments If you are working with an existing website or with another website publishing system, it is also straightforward to embed HTML snippets which include Inspect Viz plots and tables. ### Single Plot To create a standalone snippet which you can include in any website, use the `write_html()` function: ``` python from inspect_viz import Data from inspect_viz.mark import dot from inspect_viz.plot import plot, write_html penguins = Data.from_file("penguins.parquet") pl = plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", grid=True ) write_html("penguins.html", pl) ``` ### Multiple Plots If you want to include multiple plots on a page, you might find it more convenient to call the `to_html()` function as part of your website generation process. The returned HTML includes the Jupyter Widget runtime dependencies, so if you have multiple plots you’ll instead want to include these dependencies once in the `` of your document and the create HTML snippets without the dependencies. Here is the dependencies code that you should place in the `` tag: ``` html ``` Then, specify `dependencies=False` when you call `to_html()` to get only the plot and not the dependencies scripts which are already in your `` tag: ``` python from inspect_viz.plot import to_html pl = plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", grid=True ) pl_html = to_html(pl, dependencies=False) # ...include pl_html in your website ``` # Dashboards ## Overview [Quarto Dashboards](https://quarto.org/docs/dashboards/) are a special type of Quarto website optimized for publishing easily navigable sets of plots and tables. Features of Quarto Dashboards include: 1. Many flexible ways to layout components (row or column based, tabsets, multiple pages, etc.) including responsive layout for mobile devices. 2. A variety of ways to present inputs for interactivity including toolbars, sidebars, and card-level inputs. 3. Dozens of available themes including the ability to create your own themes. ## Example Here is the [Scores Timeline](examples/inspect/scores-timeline/index.qmd) example from this repository re-written as a dashboard (this is a live dashboard embedded as an iframe): Below is the source code for this dashboard. You’ll notice that this looks quite similar to the code for any other Quarto document, but level-two headings (`##`) have been added to denote a toolbar and dashboard rows (additional headings could be used to create columns and tabsets). ```` python --- title: "Capabilities Timeline" format: dashboard --- ```{python} from inspect_viz import Data, Param from inspect_viz.input import select from inspect_viz.mark import dot from inspect_viz.plot import plot from inspect_viz.table import table, column from inspect_viz.view.beta import scores_timeline from inspect_viz.input import checkbox_group, select evals = Data.from_file("benchmarks.parquet") ``` ## {.sidebar} ```{python} select( evals, column="task_name", value="auto", label="Benchmark" ) checkbox_group( evals, column="model_organization_name", label="Organization" ) ``` *** Benchmark data from the Epoch AI [Benchmarking Hub](https://epoch.ai/data/ai-benchmarking-dashboard). ## Column ### Row {height=60%} ```{python} scores_timeline(evals, filters=False) ``` ### Row {height=40%} ```{python} table( evals, columns=[ column("model_organization_name", label="Organization"), column("model_display_name", label="Model"), column("model_release_date", label="Release Date"), column("score_headline_value", label="Score", width=100), column("score_headline_stderr", label="StdErr", width=100), ] ) ``` ```` ## Notebook Execution When using Inspect Viz with Quarto Websites you should always add the following configuration to your `_quarto.yml` to specify that notebooks should be fully executed when rendered: **\_quarto.yml** ``` yaml execute: enabled: true ``` ## Learning More - See the [Quarto Dashboards](https://quarto.org/docs/dashboards/) documentation for additional details on creating dashboards. - See the [Dashboard Examples](https://quarto.org/docs/gallery/#dashboards) to get an idea for the sorts of layouts and themes that are available and to see the source code for a variety of dashboard types. # PNG Output ## Overview When publishing a [notebook](publishing-notebooks.qmd), [website](publishing-websites.qmd), or [dashboard](publishing-dashboards.qmd), Inspect Viz plots are rendered by default as Jupyter Widgets that use JavaScript to provide various interactive features (tooltips, filtering, brushing, etc.). While this is the recommended way to publish Inspect Viz content, you can also choose to render content as static PNG images. You might want do this if you are creating an Office or PDF document from a notebook, or want plots in a dashboard to be available even when disconnected from the Internet. Note however that rendering plots as PNG images does take longer than the native JavaScript output format, and that interactive features are not available in this mode. #### Prerequisites To create PNG output with Inspect Viz, first install the [playwright](https://playwright.dev/python/) Python package, which enables taking screenshots of web graphics using an embedded version of the Chromium web browser. You can do this as follows: ``` bash pip install playwright playwright install ``` ## Standalone Use the `write_png()` function to save a stanalone PNG version of any plot. For example: ``` python from inspect_viz import Data from inspect_viz.mark import dot from inspect_viz.plot import plot, write_png penguins = Data.from_file("penguins.parquet") pl = plot( dot(penguins, x="body_mass", y="flipper_length", stroke="species", symbol="species"), legend="symbol", grid=True ) write_png("penguins.png", pl) ``` ## Embedded When your plots are embedded in a notebook or website, use the global `output_format` option to specify that you’d like to render them in PNG format. For example, the plot below is rendered as a static PNG graphic: ``` python from inspect_viz import Data, options from inspect_viz.view.beta import scores_by_factor # set 'png' as default output format options.output_format = "png" # render plot evals = Data.from_file("evals-hint.parquet") scores_by_factor(evals, "task_arg_hint", ("No hint", "Hint")) ``` Lines 4-5 Set the global `options.output_format` option to render all plots in a notebook or Quarto document as static PNG images. You can also do this for a single plot or set of plots using `options_context()`: ``` python from inspect_viz import options_context with options_context(output_format="png"): # plot code here ``` Note that when rendering a PDF document with Quarto, the output format is automatically set to “png” (as PDFs can’t ever include interactive JavaScript content). # inspect_viz ## Core ### Data Data source for visualizations. Data sources can be created from any standard Python data frame (e.g. Pandas, Polars, etc.) or from a path pointing to a data file in a standard format (e.g. csv, parquet, etc.) [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/data.py#L18) ``` python class Data ``` #### Attributes `columns` list\[str\] Column names for data source. #### Methods from_dataframe Create `Data` from a standard Python data frame (e.g. Pandas, Polars, PyArrow, etc.). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/data.py#L24) ``` python @classmethod def from_dataframe(cls, df: IntoDataFrame) -> "Data" ``` `df` IntoDataFrame Data frame to read. from_file Create `Data` from a data file (e.g. csv, parquet, feather, etc.). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/data.py#L33) ``` python @classmethod def from_file(cls, file: str | PathLike[str]) -> "Data" ``` `file` str \| PathLike\[str\] File to read data from. Supported formats include csv, json, xslx, parquet, feather, sas7bdat, dta, and fwf. ### Component Data visualization component (input, plot, mark, table, layout, etc.). Visualization components are Jupyter widgets that can be used in any notebook or Jupyter based publishing system. See the documentation on inputs, plots, marks, and interactors for details on available components. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/component.py#L47) ``` python class Component(AnyWidget) ``` ## Params ### Selection Selection that can be filtered by inputs and other selections. Selection types include: - `Selection.intersect()` for intersecting clauses (logical “and”) - `Selection.union()` for unionone clauses (logical “or”) - `Selection.single()` for a single clause only - `Selection.crossfilter()` for a cross-filtered intersection [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/selection.py#L10) ``` python class Selection(str) ``` #### Methods intersect Create a new Selection instance with an intersect (conjunction) resolution strategy. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/selection.py#L27) ``` python @classmethod def intersect( cls, cross: bool = False, empty: bool = False, include: Union["Selection", list["Selection"]] | None = None, ) -> "Selection" ``` `cross` bool Boolean flag indicating cross-filtered resolution. If true, selection clauses will not be applied to the clients they are associated with. `empty` bool Boolean flag indicating if a lack of clauses should correspond to an empty selection with no records. This setting determines the default selection state. `include` Union\[[Selection](inspect_viz.qmd#selection), list\[[Selection](inspect_viz.qmd#selection)\]\] \| None Upstream selections whose clauses should be included as part of the new selection. Any clauses published to upstream selections will be relayed to the new selection. union Create a new Selection instance with a union (disjunction) resolution strategy. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/selection.py#L43) ``` python @classmethod def union( cls, cross: bool = False, empty: bool = False, include: Union["Selection", list["Selection"]] | None = None, ) -> "Selection" ``` `cross` bool Boolean flag indicating cross-filtered resolution. If true, selection clauses will not be applied to the clients they are associated with. `empty` bool Boolean flag indicating if a lack of clauses should correspond to an empty selection with no records. This setting determines the default selection state. `include` Union\[[Selection](inspect_viz.qmd#selection), list\[[Selection](inspect_viz.qmd#selection)\]\] \| None Upstream selections whose clauses should be included as part of the new selection. Any clauses published to upstream selections will be relayed to the new selection. single Create a new Selection instance with a singular resolution strategy that keeps only the most recent selection clause. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/selection.py#L59) ``` python @classmethod def single( cls, cross: bool = False, empty: bool = False, include: Union["Selection", list["Selection"]] | None = None, ) -> "Selection" ``` `cross` bool Boolean flag indicating cross-filtered resolution. If true, selection clauses will not be applied to the clients they are associated with. `empty` bool Boolean flag indicating if a lack of clauses should correspond to an empty selection with no records. This setting determines the default selection state. `include` Union\[[Selection](inspect_viz.qmd#selection), list\[[Selection](inspect_viz.qmd#selection)\]\] \| None Upstream selections whose clauses should be included as part of the new selection. Any clauses published to upstream selections will be relayed to the new selection. crossfilter Create a new Selection instance with a cross-filtered intersect resolution strategy. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/selection.py#L75) ``` python @classmethod def crossfilter( cls, empty: bool = False, include: Union["Selection", list["Selection"]] | None = None, ) -> "Selection" ``` `empty` bool Boolean flag indicating if a lack of clauses should correspond to an empty selection with no records. This setting determines the default selection state. `include` Union\[[Selection](inspect_viz.qmd#selection), list\[[Selection](inspect_viz.qmd#selection)\]\] \| None Upstream selections whose clauses should be included as part of the new selection. Any clauses published to upstream selections will be relayed to the new selection. ### Param Parameter that can be bound from inputs. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/param.py#L16) ``` python class Param(str) ``` #### Attributes `id` str Unique id (automatically generated). `default` [ParamValue](inspect_viz.qmd#paramvalue) Default value. ### ParamValue Type alias for parameter values (scalar or sequence of scalars). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/param.py#L10) ``` python ParamValue: TypeAlias = ( int | float | bool | str | datetime | Sequence[int | float | bool | str] ) ``` ## Options ### options Inspect Viz global options. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/_options.py#L25) ``` python options: Options = Options(output_format="auto") ``` ### options_context Context manager for temporarily overriding global options. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/_options.py#L29) ``` python @contextmanager def options_context(**kwargs: Unpack[OptionsArgs]) -> Iterator[None] ``` `**kwargs` Unpack\[OptionsArgs\] Options to override within the context. ### Options Inspect Viz global options. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/_core/_options.py#L12) ``` python class Options(SimpleNamespace) ``` #### Attributes `output_format` Literal\['auto', 'js', 'png'\] Output format for components. Defaults to “auto”, which resolves to “js” (interactive plots and tables) in all contexts except Quarto PDF output (which uses “png”). Specify “png” to always write static PNG images instead (interactive features will be disabled in this case). # inspect_viz.view.beta > [!NOTE] > > View functions are currently in beta and are exported from the > **inspect_ai.view.beta** module. The beta module will be preserved > after final release so that code written against it now will continue > to work after the beta. ## Scores ### scores_by_task Bar plot for comparing eval scores. Summarize eval scores using a bar plot. By default, scores (`y`) are plotted by “task_display_name” (`fx`) and “model_display_name” (`x`). By default, confidence intervals are also plotted (disable this with `y_ci=False`). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_task.py#L18) ``` python def scores_by_task( data: Data, model_name: str = "model_display_name", task_name: str = "task_display_name", score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", score_label: str | None | NotGiven = NOT_GIVEN, ci: bool | float = 0.95, title: str | Title | None = None, marks: Marks | None = None, width: float | Param | None = None, height: float | Param | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](inspect_viz.qmd#data) Evals data table. This is typically created using a data frame read with the inspect `evals_df()` function. `model_name` str Name of field for the model name (defaults to “model_display_name”) `task_name` str Name of field for the task name (defaults to “task_display_name”) `score_value` str Name of field for the score value (defaults to “score_headline_value”). `score_stderr` str Name of field for stderr (defaults to “score_headline_metric”). `score_label` str \| None \| NotGiven Score axis label (pass None for no label). `ci` bool \| float Confidence interval (e.g. 0.80, 0.90, 0.95, etc.). Defaults to 0.95. `title` str \| [Title](inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function). `marks` [Marks](inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| [Param](inspect_viz.qmd#param) \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| [Param](inspect_viz.qmd#param) \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `margin_bottom` are is set to 10 pixels and `x_ticks` is set to `[]`. ### scores_by_factor Summarize eval scores with a factor of variation (e.g ‘No hint’ vs. ‘Hint’). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_factor.py#L13) ``` python def scores_by_factor( data: Data, factor: str, factor_labels: tuple[str, str], score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", score_label: str = "Score", model: str = "model", model_label: str = "Model", ci: bool | float = 0.95, color: str | tuple[str, str] = "#3266ae", title: str | Mark | None = None, marks: Marks | None = None, width: float | Param | None = None, height: float | Param | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](inspect_viz.qmd#data) Evals data table. This is typically created using a data frame read with the inspect `evals_df()` function. `factor` str Field with factor of variation (should be of type boolean). `factor_labels` tuple\[str, str\] Tuple of labels for factor of variation. `False` value should be first, e.g. `("No hint", "Hint")`. `score_value` str Name of field for x (scoring) axis (defaults to “score_headline_value”). `score_stderr` str Name of field for scoring stderr (defaults to “score_headline_stderr”). `score_label` str Label for x-axis (defaults to “Score”). `model` str Name of field for y axis (defaults to “model”). `model_label` str Lable for y axis (defaults to “Model”). `ci` bool \| float Confidence interval (e.g. 0.80, 0.90, 0.95, etc.). Defaults to 0.95.) `color` str \| tuple\[str, str\] Hex color value (or tuple of two values). If one value is provided the second is computed by lightening the main color. `title` str \| [Mark](inspect_viz.mark.qmd#mark) \| None Title for plot (`str` or mark created with the `title()` function). `marks` [Marks](inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| [Param](inspect_viz.qmd#param) \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| [Param](inspect_viz.qmd#param) \| None The outer height of the plot in pixels, including margins. Default to 65 pixels for each item on the “y” axis. `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional \`PlotAttributes ### scores_timeline Eval scores by model, organization, and release date. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_timeline.py#L28) ``` python def scores_timeline( data: Data, task_name: str = "task_display_name", model_name: str = "model_display_name", model_organization: str = "model_organization_name", model_release_date: str = "model_release_date", score_name: str = "score_headline_name", score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", organizations: list[str] | None = None, filters: bool | list[Literal["task", "organization"]] = True, ci: float | bool = 0.95, time_label: str = "Release Date", score_label: str = "Score", eval_label: str = "Eval", title: str | Title | None = None, marks: Marks | None = None, width: float | Param | None = None, height: float | Param | None = None, regression: bool = False, legend: Legend | NotGiven | None = NOT_GIVEN, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](inspect_viz.qmd#data) Data read using `evals_df()` and amended with model metadata using the `model_info()` prepare operation (see [Data Preparation](https://inspect.aisi.org.uk/dataframe.html#data-preparation) for details). `task_name` str Column for task name (defaults to “task_display_name”). `model_name` str Column for model name (defaults to “model_display_name”). `model_organization` str Column for model organization (defaults to “model_organization_name”). `model_release_date` str Column for model release date (defaults to “model_release_date”). `score_name` str Column for scorer name (defaults to “score_headline_name”). `score_value` str Column for score value (defaults to “score_headline_value”). `score_stderr` str Column for score stderr (defaults to “score_headline_stderr”) `organizations` list\[str\] \| None List of organizations to include (in order of desired presentation). `filters` bool \| list\[Literal\['task', 'organization'\]\] Provide UI to filter plot by task and organization(s). `ci` float \| bool Confidence interval (defaults to 0.95, pass `False` for no confidence intervals) `time_label` str Label for time (x-axis). `score_label` str Label for score (y-axis). `eval_label` str Label for eval select input. `title` str \| [Title](inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function). `marks` [Marks](inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| [Param](inspect_viz.qmd#param) \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| [Param](inspect_viz.qmd#param) \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `regression` bool If `True`, adds a regression line to the plot (uses the confidence interval passed using ci). Defaults to False. `legend` [Legend](inspect_viz.plot.qmd#legend) \| NotGiven \| None Legend to use for the plot (defaults to `None`, which uses the default legend). `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `x_domain` is set to “fixed”, the `y_domain` is set to `[0,1.0]`, `color_label` is set to “Organizations”, and `color_domain` is set to `organizations`. ### scores_by_model Bar plot for comparing the scores of different models on a single evaluation. Summarize eval scores using a bar plot. By default, scores (`y`) are plotted by “model_display_name” (`y`). By default, confidence intervals are also plotted (disable this with `y_ci=False`). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_model.py#L18) ``` python def scores_by_model( data: Data, *, model_name: str = "model_display_name", score_value: str = "score_headline_value", score_stderr: str = "score_headline_stderr", ci: float = 0.95, sort: Literal["asc", "desc"] | None = None, score_label: str | None | NotGiven = None, model_label: str | None | NotGiven = None, color: str | None = None, title: str | Title | None = None, marks: Marks | None = None, width: float | None = None, height: float | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](inspect_viz.qmd#data) Evals data table. This is typically created using a data frame read with the inspect `evals_df()` function. `model_name` str Column containing the model name (defaults to “model_display_name”) `score_value` str Column containing the score value (defaults to “score_headline_value”). `score_stderr` str Column containing the score standard error (defaults to “score_headline_stderr”). `ci` float Confidence interval (e.g. 0.80, 0.90, 0.95, etc.). Defaults to 0.95. `sort` Literal\['asc', 'desc'\] \| None Sort order for the bars (sorts using the ‘x’ value). Can be “asc” or “desc”. Defaults to “asc”. `score_label` str \| None \| NotGiven x-axis label (defaults to None). `model_label` str \| None \| NotGiven x-axis label (defaults to None). `color` str \| None The color for the bars. Defaults to “\#416AD0”. Pass any valid hex color value. `title` str \| [Title](inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function) `marks` [Marks](inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `y_inset_top` and `margin_bottom` are set to 10 pixels and `x_ticks` is set to `[]`. ### scores_heatmap Creates a heatmap plot of success rate of eval data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_heatmap.py#L33) ``` python def scores_heatmap( data: Data, task_name: str = "task_display_name", task_label: str | None | NotGiven = None, model_name: str = "model_display_name", model_label: str | None | NotGiven = None, score_value: str = "score_headline_value", cell: CellOptions | None = None, tip: bool = True, title: str | Title | None = None, marks: Marks | None = None, height: float | None = None, width: float | None = None, legend: Legend | bool | None = None, sort: Literal["ascending", "descending"] | SortOrder | None = "ascending", orientation: Literal["horizontal", "vertical"] = "horizontal", **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](inspect_viz.qmd#data) Evals data table. `task_name` str Name of column to use for columns. `task_label` str \| None \| NotGiven x-axis label (defaults to None). `model_name` str Name of column to use for rows. `model_label` str \| None \| NotGiven y-axis label (defaults to None). `score_value` str Name of the column to use as values to determine cell color. `cell` [CellOptions](inspect_viz.view.qmd#celloptions) \| None Options for the cell marks. `tip` bool Whether to show a tooltip with the value when hovering over a cell (defaults to True). `title` str \| [Title](inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function) `marks` [Marks](inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `height` float \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)). `width` float \| None The outer width of the plot in pixels, including margins. Defaults to 700. `legend` [Legend](inspect_viz.plot.qmd#legend) \| bool \| None Options for the legend. Pass None to disable the legend. `sort` Literal\['ascending', 'descending'\] \| SortOrder \| None Sort order for the x and y axes. If ascending, the highest values will be sorted to the top right. If descending, the highest values will appear in the bottom left. If None, no sorting is applied. If a SortOrder is provided, it will be used to sort the x and y axes. `orientation` Literal\['horizontal', 'vertical'\] The orientation of the heatmap. If “horizontal”, the tasks will be on the x-axis and models on the y-axis. If “vertical”, the tasks will be on the y-axis and models on the x-axis. `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional \`PlotAttributes ### scores_by_limit Visualizes success rate as a function of a resource limit (time, tokens). Model success rate is plotted as a function of the time, tokens, or other resource limit. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_limit.py#L153) ``` python def scores_by_limit( data: Data, model: str = "model_display_name", success: str = "success_rate", stderr: str | None = "standard_error", facet: str | None = None, other_termination_rate: str | bool = False, limit: str | None = None, limit_label: str | NotGiven = NOT_GIVEN, scale: Literal["log", "linear", "auto"] = "auto", height: float | None = None, width: float | None = None, ci: float = 0.95, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](inspect_viz.qmd#data) A dataframe prepared using the `prepare_limit_dataframe` function. `model` str Name of field holding the model (defaults to “model_display_name”). `success` str Name of field containing the success rate (defaults to “success_rate”). `stderr` str \| None Name of field containing the standard_error (defaults to “standard_error”). `facet` str \| None Name of field to use for faceting (defaults to None). `other_termination_rate` str \| bool Name of field containing the other termination rate (defaults to “other_termination_rate”). `limit` str \| None Name of field for x axis (by default, will detect limit type using the columns present in the data frame). `limit_label` str \| NotGiven The limit label (by default, will select limit label using the columns present in the data frame). Pass None for no label. `scale` Literal\['log', 'linear', 'auto'\] The scale type for the limit access. If ‘auto’, will use log scale if the range is 2 or more orders of magnitude (defaults to ‘auto’). `height` float \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `width` float \| None The outer width of the plot in pixels, including margins. Defaults to 700. `ci` float Confidence interval (e.g. 0.80, 0.90, 0.95, etc.). Defaults to 0.95. `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. ### scores_by_limit_df Prepares a dataframe for plotting success rate as a function of a resource limit (time, tokens). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_by_limit.py#L23) ``` python def scores_by_limit_df( df: pd.DataFrame, score: str, limit: Literal["total_tokens", "total_time", "working_time"] = "total_tokens", scale: Literal["log", "linear", "auto"] = "auto", steps: int = 100, ) -> pd.DataFrame ``` `df` pd.DataFrame A dataframe containing sample summaries and eval information. `score` str Name of field containing the score (0 = fail, 1 = success). `limit` Literal\['total_tokens', 'total_time', 'working_time'\] The resource limit to use (one of ‘total_tokens’, ‘total_time’, ‘working_time’). Defaults to ‘total_tokens’. `scale` Literal\['log', 'linear', 'auto'\] The scale type for the limit access. If ‘auto’, will use log scale if the range is 2 or more orders of magnitude (defaults to ‘auto’). `steps` int The number of points to use when sampling the limit range (defaults to 100). ## Tools ### tool_calls Heat map visualising tool calls over evaluation turns. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_tool_calls.py#L15) ``` python def tool_calls( data: Data, x: str = "order", y: str = "id", tool: str = "tool_call_function", limit: str = "limit", tools: list[str] | None = None, x_label: str | None = "Message", y_label: str | None = "Sample", title: str | Title | None = None, marks: Marks | None = None, width: float | None = None, height: float | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `data` [Data](inspect_viz.qmd#data) Messages data table. This is typically created using a data frame read with the inspect `messages_df()` function. `x` str Name of field for x axis (defaults to “order”) `y` str Name of field for y axis (defaults to “id”). `tool` str Name of field with tool name (defaults to “tool_call_function”) `limit` str Name of field with sample limit (defaults to “limit”). `tools` list\[str\] \| None Tools to include in plot (and order to include them). Defaults to all tools found in `data`. `x_label` str \| None x-axis label (defaults to “Message”). `y_label` str \| None y-axis label (defaults to “Sample”). `title` str \| [Title](inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function) `marks` [Marks](inspect_viz.mark.qmd#marks) \| None Additional marks to include in the plot. `width` float \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. By default, the `margin_top` is set to 0, `margin_left` to 20, `margin_right` to 100, `color_label` is “Tool”, `y_ticks` is empty, and `x_ticks` and `color_domain` are calculated from `data`. ## Types ### CellOptions Cell options for the heatmap. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/view/beta/_scores_heatmap.py#L23) ``` python class CellOptions(TypedDict, total=False) ``` #### Attributes `inset` float \| None Inset for the cell marks. Defaults to 1 pixel. `text` str \| None Text color for the cell marks. Defaults to “white”. Set to None to disable text. # inspect_viz.plot ## Plot ### plot Create a plot. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_plot.py#L21) ``` python def plot( *plot: Mark | Interactor | Legend | Sequence[Mark | Interactor | Legend], x_label: str | Param | None | NotGiven = NOT_GIVEN, fx_label: str | Param | None | NotGiven = NOT_GIVEN, y_label: str | Param | None | NotGiven = NOT_GIVEN, fy_label: str | Param | None | NotGiven = NOT_GIVEN, title: str | Title | None = None, width: float | Param | None = None, height: float | Param | None = None, name: str | None = None, legend: Literal["color", "opacity", "symbol"] | Sequence[Literal["color", "opacity", "symbol"]] | Legend | Sequence[Legend] | None = None, **attributes: Unpack[PlotAttributes], ) -> Component ``` `*plot` [Mark](inspect_viz.mark.qmd#mark) \| [Interactor](inspect_viz.interactor.qmd#interactor) \| [Legend](inspect_viz.plot.qmd#legend) \| Sequence\[[Mark](inspect_viz.mark.qmd#mark) \| [Interactor](inspect_viz.interactor.qmd#interactor) \| [Legend](inspect_viz.plot.qmd#legend)\] Plot elements (marks, interactors, legends) `x_label` str \| [Param](inspect_viz.qmd#param) \| None \| NotGiven A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. Pass `None` for no x_label. `fx_label` str \| [Param](inspect_viz.qmd#param) \| None \| NotGiven A textual label to show on the axis or legend; if `None`, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. `y_label` str \| [Param](inspect_viz.qmd#param) \| None \| NotGiven A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. Pass `None` for no y_label. `fy_label` str \| [Param](inspect_viz.qmd#param) \| None \| NotGiven A textual label to show on the axis or legend; if `None`, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. `title` str \| [Title](inspect_viz.mark.qmd#title) \| None Title for plot (`str` or mark created with the `title()` function). `width` float \| [Param](inspect_viz.qmd#param) \| None The outer width of the plot in pixels, including margins. Defaults to 700. `height` float \| [Param](inspect_viz.qmd#param) \| None The outer height of the plot in pixels, including margins. The default is width / 1.618 (the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio)) `name` str \| None A unique name for the plot. The name is used by standalone legend components to to lookup the plot and access scale mappings. `legend` Literal\['color', 'opacity', 'symbol'\] \| Sequence\[Literal\['color', 'opacity', 'symbol'\]\] \| [Legend](inspect_viz.plot.qmd#legend) \| Sequence\[[Legend](inspect_viz.plot.qmd#legend)\] \| None Plot legend. `**attributes` Unpack\[[PlotAttributes](inspect_viz.plot.qmd#plotattributes)\] Additional `PlotAttributes`. ### PlotAttributes Plot attributes. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L155) ``` python class PlotAttributes(TypedDict, total=False) ``` #### Attributes `aspect_ratio` float \| bool \| None \| [Param](inspect_viz.qmd#param) \| None The desired aspect ratio of the *x* and *y* scales, affecting the default height. Given an aspect ratio of *dx* / *dy*, and assuming that the *x* and *y* scales represent equivalent units (say, degrees Celsius or meters), computes a default height such that *dx* pixels along *x* represents the same variation as *dy* pixels along *y*. Note: when faceting, set the *fx* and *fy* scales’ **round** option to false for an exact aspect ratio. `margin` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four margins: **margin_top**, **margin_right**, **margin_bottom**, and **margin_left**. Otherwise, the default margins depend on the maximum margins of the plot’s marks. While most marks default to zero margins (because they are drawn inside the chart area), Plot’s axis marks have non-zero default margins. `margin_top` float \| [Param](inspect_viz.qmd#param) \| None The top margin; the distance in pixels between the top edges of the inner and outer plot area. Defaults to the maximum top margin of the plot’s marks. `margin_right` float \| [Param](inspect_viz.qmd#param) \| None The right margin; the distance in pixels between the right edges of the inner and outer plot area. Defaults to the maximum right margin of the plot’s marks. `margin_bottom` float \| [Param](inspect_viz.qmd#param) \| None The bottom margin; the distance in pixels between the bottom edges of the inner and outer plot area. Defaults to the maximum bottom margin of the plot’s marks. `margin_left` float \| [Param](inspect_viz.qmd#param) \| None The left margin; the distance in pixels between the left edges of the inner and outer plot area. Defaults to the maximum left margin of the plot’s marks. `margins` dict\[str, float \| [Param](inspect_viz.qmd#param)\] \| None A shorthand object notation for setting multiple margin values. The object keys are margin names (top, right, etc). `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets: **inset_top**, **inset_right**, **inset_bottom**, and **inset_left**. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it. `align` float \| [Param](inspect_viz.qmd#param) \| None How to distribute unused space in the **range** for *point* and *band* scales. A number in \[0, 1\], such as: - 0 - use the start of the range, putting unused space at the end - 0.5 (default) - use the middle, distributing unused space evenly - 1 use the end, putting unused space at the start For ordinal position scales only. `padding` float \| [Param](inspect_viz.qmd#param) \| None For *band* scales, how much of the **range** to reserve to separate adjacent bands; defaults to 0.1 (10%). For *point* scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%). For ordinal position scales only. `axis` Literal\['top', 'right', 'bottom', 'left', 'both'\] \| bool \| None \| [Param](inspect_viz.qmd#param) The side of the frame on which to place the implicit axis: *top* or *bottom* for *x* or *fx*, or *left* or *right* for *y* or *fy*. The default depends on the scale: - *x* - *bottom* - *y* - *left* - *fx* - *top* if there is a *bottom* *x* axis, and otherwise *bottom* - *fy* - *right* if there is a *left* *y* axis, and otherwise *right* If *both*, an implicit axis will be rendered on both sides of the plot (*top* and *bottom* for *x* or *fx*, or *left* and *right* for *y* or *fy*). If null, the implicit axis is suppressed. For position axes only. `grid` bool \| str \| [Param](inspect_viz.qmd#param) Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color. `aria_label` str \| None The [aria-label attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) on the SVG root. `aria_description` str \| None The [aria-description attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description) on the SVG root. `clip` Literal\['frame', 'sphere'\] \| bool \| None \| [Param](inspect_viz.qmd#param) The default clip for all marks. `x_scale` [PositionScale](inspect_viz.plot.qmd#positionscale) \| None \| [Param](inspect_viz.qmd#param) \| None The *x* scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. For quantitative data (numbers), defaults to *linear*; for temporal data (dates), defaults to *utc*; for ordinal data (strings or booleans), defaults to *point* for position scales, *categorical* for color scales, and otherwise *ordinal*. However, the radius scale defaults to *sqrt*, and the length and opacity scales default to *linear*; these scales are intended for quantitative data. The plot’s marks may also impose a scale type; for example, the barY mark requires that *x* is a *band* scale. `x_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. Linear scales have a default domain of \[0, 1\]. Log scales have a default domain of \[1, 10\] and cannot include zero. Radius scales have a default domain from 0 to the median first quartile of associated channels. Length have a default domain from 0 to the median median of associated channels. Opacity scales have a default domain from 0 to the maximum value of associated channels. `x_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (*point* and *band*), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. `x_nice` bool \| float \| Interval \| [Param](inspect_viz.qmd#param) \| None If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for *linear* scales, and nice time intervals for *utc* and *time* scales. Pass an interval such as *minute*, *wednesday* or *month* to specify what constitutes a nice interval. For continuous scales only. `x_inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets: **inset_top**, **inset_right**, **inset_bottom**, and **inset_left**. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it. `x_inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it). `x_inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it). `x_clamp` bool \| [Param](inspect_viz.qmd#param) \| None If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum. Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit **domain** since if the domain is inferred, no values will be outside the domain. For continuous scales only. `x_round` bool \| [Param](inspect_viz.qmd#param) \| None If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering. For position scales only. `x_align` float \| [Param](inspect_viz.qmd#param) \| None How to distribute unused space in the **range** for *point* and *band* scales. A number in \[0, 1\], such as: - 0 - use the start of the range, putting unused space at the end - 0.5 (default) - use the middle, distributing unused space evenly - 1 use the end, putting unused space at the start For ordinal position scales only. `x_padding` float \| [Param](inspect_viz.qmd#param) \| None For *band* scales, how much of the **range** to reserve to separate adjacent bands; defaults to 0.1 (10%). For *point* scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%). For ordinal position scales only. `x_padding_inner` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to separate adjacent bands. `x_padding_outer` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to inset first and last bands. `x_axis` Literal\['top', 'bottom', 'both'\] \| bool \| None \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the implicit axis: *top* or *bottom* for *x*. Defaults to *bottom* for an *x* scale. If *both*, an implicit axis will be rendered on both sides of the plot (*top* and *bottom* for *x*). If null, the implicit axis is suppressed. `x_ticks` float \| Interval \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as *day* or *month*. `x_tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for *x* and *y* axes and *color* and *opacity* *ramp* legends, and 0 for *fx* and *fy* axes. `x_tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired approximate spacing between adjacent axis ticks, affecting the default **ticks**; defaults to 80 pixels for *x* and *fx*, and 35 pixels for *y* and *fy*. `x_tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by **x_tick_size** and **x_tick_rotate**. `x_tick_format` str \| None \| [Param](inspect_viz.qmd#param) \| None How to format inputs (abstract values) for axis tick labels; one of: - a [d3-format](https://d3js.org/d3-time) string for numeric scales - a [d3-time-format](https://d3js.org/d3-time-format) string for temporal scales `x_tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of axis tick labels in degrees clocksize; defaults to 0. `x_grid` bool \| str \| Interval \| list\[str \| float\] \| [Param](inspect_viz.qmd#param) Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines. `x_line` bool \| [Param](inspect_viz.qmd#param) \| None If true, draw a line along the axis; if false (default), do not. `x_label_anchor` Literal\['right', 'left', 'center'\] \| [Param](inspect_viz.qmd#param) \| None Where to place the axis **label** relative to the plot’s frame. For vertical position scales (*y* and *fy*), may be *top*, *bottom*, or *center*; for horizontal position scales (*x* and *fx*), may be *left*, *right*, or *center*. Defaults to *center* for ordinal scales (including *fx* and *fy*), and otherwise *top* for *y*, and *right* for *x*. `x_label_arrow` [LabelArrow](inspect_viz.plot.qmd#labelarrow) \| [Param](inspect_viz.qmd#param) \| None Whether to apply a directional arrow such as → or ↑ to the x-axis scale label. If *auto* (the default), the presence of the arrow depends on whether the scale is ordinal. `x_label_offset` float \| [Param](inspect_viz.qmd#param) \| None The axis **label** position offset (in pixels); default depends on margins and orientation. `x_font_variant` str \| [Param](inspect_viz.qmd#param) \| None The font-variant attribute for axis ticks; defaults to *tabular-nums* for quantitative axes. `x_aria_label` str \| [Param](inspect_viz.qmd#param) \| None A short label representing the axis in the accessibility tree. `x_aria_description` str \| [Param](inspect_viz.qmd#param) \| None A textual description for the axis in the accessibility tree. `x_percent` bool \| [Param](inspect_viz.qmd#param) \| None If true, shorthand for a transform suitable for percentages, mapping proportions in \[0, 1\] to \[0, 100\]. `x_reverse` bool \| [Param](inspect_viz.qmd#param) \| None Whether to reverse the scale’s encoding; equivalent to reversing either the **domain** or **range**. `x_zero` bool \| [Param](inspect_viz.qmd#param) \| None Whether the **domain** must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero. For quantitative scales only. `x_exponent` float \| [Param](inspect_viz.qmd#param) \| None A power scale’s exponent (*e.g.*, 0.5 for sqrt); defaults to 1 for a linear scale. For *pow* scales only. `x_base` float \| [Param](inspect_viz.qmd#param) \| None A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For *log* scales only. `x_constant` float \| [Param](inspect_viz.qmd#param) \| None A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For *symlog* scales only. `y_scale` [PositionScale](inspect_viz.plot.qmd#positionscale) \| None \| [Param](inspect_viz.qmd#param) \| None The *y* scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. For quantitative data (numbers), defaults to *linear*; for temporal data (dates), defaults to *utc*; for ordinal data (strings or booleans), defaults to *point* for position scales, The plot’s marks may also impose a scale type; for example, the barY mark requires that *x* is a *band* scale. `y_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. Linear scales have a default domain of \[0, 1\]. Log scales have a default domain of \[1, 10\] and cannot include zero. `y_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (*point* and *band*), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. `y_nice` bool \| float \| Interval \| [Param](inspect_viz.qmd#param) \| None If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for *linear* scales, and nice time intervals for *utc* and *time* scales. Pass an interval such as *minute*, *wednesday* or *month* to specify what constitutes a nice interval. For continuous scales only. `y_inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets: **inset_top**, **inset_right**, **inset_bottom**, and **inset_left**. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it. `y_inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it). `y_inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it). `y_clamp` bool \| [Param](inspect_viz.qmd#param) \| None If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum. Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit **domain** since if the domain is inferred, no values will be outside the domain. For continuous scales only. `y_round` bool \| [Param](inspect_viz.qmd#param) \| None If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering. For position scales only. `y_align` float \| [Param](inspect_viz.qmd#param) \| None How to distribute unused space in the **range** for *point* and *band* scales. A number in \[0, 1\], such as: - 0 - use the start of the range, putting unused space at the end - 0.5 (default) - use the middle, distributing unused space evenly - 1 use the end, putting unused space at the start For ordinal position scales only. `y_padding` float \| [Param](inspect_viz.qmd#param) \| None For *band* scales, how much of the **range** to reserve to separate adjacent bands; defaults to 0.1 (10%). For *point* scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%). For ordinal position scales only. `y_padding_inner` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to separate adjacent bands. `y_padding_outer` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to inset first and last bands. `y_axis` Literal\['left', 'right', 'both'\] \| bool \| None \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the implicit axis: *left* or *right* for *y*. Defaults to *left* for a *y* scale. If *both*, an implicit axis will be rendered on both sides of the plot (*left* and *right* for *y*). If null, the implicit axis is suppressed. `y_ticks` float \| Interval \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as *day* or *month*. `y_tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for *x* and *y* axes and *color* and *opacity* *ramp* legends, and 0 for *fx* and *fy* axes. `y_tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired approximate spacing between adjacent axis ticks, affecting the default **ticks**; defaults to 80 pixels for *x* and *fx*, and 35 pixels for *y* and *fy*. `y_tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by **y_tick_size** and **y_tick_rotate**. `y_tick_format` str \| None \| [Param](inspect_viz.qmd#param) \| None How to format inputs (abstract values) for axis tick labels; one of: - a [d3-format](https://d3js.org/d3-time) string for numeric scales - a [d3-time-format](https://d3js.org/d3-time-format) string for temporal scales `y_tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of axis tick labels in degrees clocksize; defaults to 0. `y_grid` bool \| str \| Interval \| list\[str \| float\] \| [Param](inspect_viz.qmd#param) Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines. `y_line` bool \| [Param](inspect_viz.qmd#param) \| None If true, draw a line along the axis; if false (default), do not. `y_label_anchor` Literal\['top', 'bottom', 'center'\] \| [Param](inspect_viz.qmd#param) \| None Where to place the axis **label** relative to the plot’s frame. For vertical position scales (*y* and *fy*), may be *top*, *bottom*, or *center*; for horizontal position scales (*x* and *fx*), may be *left*, *right*, or *center*. Defaults to *center* for ordinal scales (including *fx* and *fy*), and otherwise *top* for *y*, and *right* for *x*. `y_label_arrow` [LabelArrow](inspect_viz.plot.qmd#labelarrow) \| [Param](inspect_viz.qmd#param) \| None Whether to apply a directional arrow such as → or ↑ to the x-axis scale label. If *auto* (the default), the presence of the arrow depends on whether the scale is ordinal. `y_label_offset` float \| [Param](inspect_viz.qmd#param) \| None The axis **label** position offset (in pixels); default depends on margins and orientation. `y_font_variant` str \| [Param](inspect_viz.qmd#param) \| None The font-variant attribute for axis ticks; defaults to *tabular-nums* for quantitative axes. `y_aria_label` str \| [Param](inspect_viz.qmd#param) \| None A short label representing the axis in the accessibility tree. `y_aria_description` str \| [Param](inspect_viz.qmd#param) \| None A textual description for the axis in the accessibility tree. `y_percent` bool \| [Param](inspect_viz.qmd#param) \| None If true, shorthand for a transform suitable for percentages, mapping proportions in \[0, 1\] to \[0, 100\]. `y_reverse` bool \| [Param](inspect_viz.qmd#param) \| None Whether to reverse the scale’s encoding; equivalent to reversing either the **domain** or **range**. Note that by default, when the *y* scale is continuous, the *max* value points to the top of the screen, whereas ordinal values are ranked from top to bottom. `y_zero` bool \| [Param](inspect_viz.qmd#param) \| None Whether the **domain** must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero. For quantitative scales only. `y_exponent` float \| [Param](inspect_viz.qmd#param) \| None A power scale’s exponent (*e.g.*, 0.5 for sqrt); defaults to 1 for a linear scale. For *pow* scales only. `y_base` float \| [Param](inspect_viz.qmd#param) \| None A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For *log* scales only. `y_constant` float \| [Param](inspect_viz.qmd#param) \| None A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For *symlog* scales only. `xy_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None Set the *x* and *y* scale domains. `facet_margin` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four facet margins: margin_top, margin_right, margin_bottom, and margin_left. `facet_margin_top` float \| [Param](inspect_viz.qmd#param) \| None The top facet margin; the (minimum) distance in pixels between the top edges of the inner and outer plot area. `facet_margin_bottom` float \| [Param](inspect_viz.qmd#param) \| None The right facet margin; the (minimum) distance in pixels between the right edges of the inner and outer plot area. `facet_margin_left` float \| [Param](inspect_viz.qmd#param) \| None The bottom facet margin; the (minimum) distance in pixels between the bottom edges of the inner and outer plot area. `facet_margin_right` float \| [Param](inspect_viz.qmd#param) \| None The left facet margin; the (minimum) distance in pixels between the left edges of the inner and outer plot area. `facet_grid` bool \| str \| Interval \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None Default axis grid for fx and fy scales; typically set to true to enable. `facet_label` str \| None \| [Param](inspect_viz.qmd#param) \| None Default axis label for fx and fy scales; typically set to null to disable. `fx_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. `fx_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**, and the plot’s dimensions. For ordinal position scales (*point* and *band*), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. `fx_inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets: **inset_top**, **inset_right**, **inset_bottom**, and **inset_left**. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it. `fx_inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it). `fx_inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it). `fx_round` bool \| [Param](inspect_viz.qmd#param) \| None If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering. For position scales only. `fx_align` float \| [Param](inspect_viz.qmd#param) \| None How to distribute unused space in the **range** for *point* and *band* scales. A number in \[0, 1\], such as: - 0 - use the start of the range, putting unused space at the end - 0.5 (default) - use the middle, distributing unused space evenly - 1 use the end, putting unused space at the start For ordinal position scales only. `fx_padding` float \| [Param](inspect_viz.qmd#param) \| None For *band* scales, how much of the **range** to reserve to separate adjacent bands; defaults to 0.1 (10%). For *point* scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%). For ordinal position scales only. `fx_padding_inner` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to separate adjacent bands. `fx_padding_outer` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to inset first and last bands. `fx_axis` Literal\['top', 'bottom', 'both'\] \| bool \| None \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the implicit axis: *top* or *bottom* for *fx*. Defaults to *top* if there is a *bottom* *x* axis, and otherwise *bottom*. If *both*, an implicit axis will be rendered on both sides of the plot (*top* and *bottom* for *fx*). If null, the implicit axis is suppressed. `fx_ticks` float \| Interval \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as *day* or *month*. `fx_tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for *x* and *y* axes and *color* and *opacity* *ramp* legends, and 0 for *fx* and *fy* axes. `fx_tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired approximate spacing between adjacent axis ticks, affecting the default **ticks**; defaults to 80 pixels for *x* and *fx*, and 35 pixels for *y* and *fy*. `fx_tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by **fx_tick_size** and **fx_tick_rotate**. `fx_tick_format` str \| None \| [Param](inspect_viz.qmd#param) \| None How to format inputs (abstract values) for axis tick labels; one of: - a [d3-format](https://d3js.org/d3-time) string for numeric scales - a [d3-time-format](https://d3js.org/d3-time-format) string for temporal scales `fx_tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of axis tick labels in degrees clocksize; defaults to 0. `fx_grid` bool \| str \| Interval \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines. See also the grid mark. For axes only. `fx_line` bool \| [Param](inspect_viz.qmd#param) \| None If true, draw a line along the axis; if false (default), do not. `fx_label_anchor` Literal\['right', 'left', 'center'\] \| [Param](inspect_viz.qmd#param) \| None Where to place the axis **label** relative to the plot’s frame. For vertical position scales (*y* and *fy*), may be *top*, *bottom*, or *center*; for horizontal position scales (*x* and *fx*), may be *left*, *right*, or *center*. Defaults to *center* for ordinal scales (including *fx* and *fy*), and otherwise *top* for *y*, and *right* for *x*. `fx_label_offset` float \| [Param](inspect_viz.qmd#param) \| None The axis **label** position offset (in pixels); default depends on margins and orientation. `fx_font_variant` str \| [Param](inspect_viz.qmd#param) \| None The font-variant attribute for axis ticks; defaults to *tabular-nums* for quantitative axes. `fx_aria_label` str \| [Param](inspect_viz.qmd#param) \| None A short label representing the axis in the accessibility tree. `fx_aria_description` str \| [Param](inspect_viz.qmd#param) \| None A textual description for the axis in the accessibility tree. `fx_reverse` bool \| [Param](inspect_viz.qmd#param) \| None Whether to reverse the scale’s encoding; equivalent to reversing either the **domain** or **range**. `fy_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. `fy_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**, and the plot’s dimensions. For ordinal position scales (*point* and *band*), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. `fy_inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets: **inset_top**, **inset_right**, **inset_bottom**, and **inset_left**. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it. `fy_inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it). `fy_inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it). `fy_round` bool \| [Param](inspect_viz.qmd#param) \| None If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering. For position scales only. `fy_align` float \| [Param](inspect_viz.qmd#param) \| None How to distribute unused space in the **range** for *point* and *band* scales. A number in \[0, 1\], such as: - 0 - use the start of the range, putting unused space at the end - 0.5 (default) - use the middle, distributing unused space evenly - 1 use the end, putting unused space at the start For ordinal position scales only. `fy_padding` float \| [Param](inspect_viz.qmd#param) \| None For *band* scales, how much of the **range** to reserve to separate adjacent bands; defaults to 0.1 (10%). For *point* scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%). For ordinal position scales only. `fy_padding_inner` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to separate adjacent bands. `fy_padding_outer` float \| [Param](inspect_viz.qmd#param) \| None For a *band* scale, how much of the range to reserve to inset first and last bands. `fy_axis` Literal\['left', 'right', 'both'\] \| bool \| None \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the implicit axis: *left* or *right* for *fy*. Defaults to *left* for an *fy* scale. If *both*, an implicit axis will be rendered on both sides of the plot (*left* and *right* for *fy*). If null, the implicit axis is suppressed. `fy_ticks` float \| Interval \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as *day* or *month*. `fy_tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for *x* and *y* axes and *color* and *opacity* *ramp* legends, and 0 for *fx* and *fy* axes. `fy_tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired approximate spacing between adjacent axis ticks, affecting the default **ticks**; defaults to 80 pixels for *x* and *fx*, and 35 pixels for *y* and *fy*. `fy_tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by **fy_tick_size** and **fy_tick_rotate**. `fy_tick_format` str \| None \| [Param](inspect_viz.qmd#param) \| None How to format inputs (abstract values) for axis tick labels; one of: - a [d3-format](https://d3js.org/d3-time) string for numeric scales - a [d3-time-format](https://d3js.org/d3-time-format) string for temporal scales `fy_tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of axis tick labels in degrees clocksize; defaults to 0. `fy_grid` bool \| str \| Interval \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines. See also the grid mark. For axes only. `fy_line` bool \| [Param](inspect_viz.qmd#param) \| None If true, draw a line along the axis; if false (default), do not. `fy_label_anchor` Literal\['top', 'bottom', 'center'\] \| [Param](inspect_viz.qmd#param) \| None Where to place the axis **label** relative to the plot’s frame. For vertical position scales (*y* and *fy*), may be *top*, *bottom*, or *center*; for horizontal position scales (*x* and *fx*), may be *left*, *right*, or *center*. Defaults to *center* for ordinal scales (including *fx* and *fy*), and otherwise *top* for *y*, and *right* for *x*. `fy_label_offset` float \| [Param](inspect_viz.qmd#param) \| None The axis **label** position offset (in pixels); default depends on margins and orientation. `fy_font_variant` str \| [Param](inspect_viz.qmd#param) \| None The font-variant attribute for axis ticks; defaults to *tabular-nums* for quantitative axes. `fy_aria_label` str \| [Param](inspect_viz.qmd#param) \| None A short label representing the axis in the accessibility tree. `fy_aria_description` str \| [Param](inspect_viz.qmd#param) \| None A textual description for the axis in the accessibility tree. `fy_reverse` bool \| [Param](inspect_viz.qmd#param) \| None Whether to reverse the scale’s encoding; equivalent to reversing either the **domain** or **range**. `color_scale` [ColorScale](inspect_viz.plot.qmd#colorscale) \| None \| [Param](inspect_viz.qmd#param) \| None The *color* scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. For quantitative data (numbers), defaults to *linear*; for temporal data (dates), defaults to *utc*; for ordinal data (strings or booleans), defaults to *point* for position scales, *categorical* for color scales, and otherwise *ordinal*. `color_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. `color_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**. For other ordinal data, it is an array (or iterable) of output values in the same order as the **domain**. `color_clamp` bool \| [Param](inspect_viz.qmd#param) \| None If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum. Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit **domain** since if the domain is inferred, no values will be outside the domain. For continuous scales only. `color_n` float \| [Param](inspect_viz.qmd#param) \| None For a *quantile* scale, the number of quantiles (creates *n* - 1 thresholds); for a *quantize* scale, the approximate number of thresholds; defaults to 5. `color_nice` bool \| float \| Interval \| [Param](inspect_viz.qmd#param) \| None If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for *linear* scales, and nice time intervals for *utc* and *time* scales. Pass an interval such as *minute*, *wednesday* or *month* to specify what constitutes a nice interval. For continuous scales only. `color_scheme` [ColorScheme](inspect_viz.plot.qmd#colorscheme) \| [Param](inspect_viz.qmd#param) \| None If specified, shorthand for setting the **color_range** or **color_interpolate** option of a *color* scale. `color_interpolate` [Interpolate](inspect_viz.mark.qmd#interpolate) \| [Param](inspect_viz.qmd#param) \| None How to interpolate color range values. For quantitative scales only. This attribute can be used to specify a color space for interpolating colors specified in the **color_range**. `color_pivot` Any \| [Param](inspect_viz.qmd#param) \| None For a diverging color scale, the input value (abstract value) that divides the domain into two parts; defaults to 0 for *diverging* scales, dividing the domain into negative and positive parts; defaults to 1 for *diverging-log* scales. By default, diverging scales are symmetric around the pivot; see the **symmetric** option. `color_symmetric` bool \| [Param](inspect_viz.qmd#param) \| None For a diverging color scale, if true (the default), extend the domain to ensure that the lower part of the domain (below the **pivot**) is commensurate with the upper part of the domain (above the **pivot**). A symmetric diverging color scale may not use all of its output **range**; this reduces contrast but ensures that deviations both below and above the **pivot** are represented proportionally. Otherwise if false, the full output **range** will be used; this increases contrast but values on opposite sides of the **pivot** may not be meaningfully compared. `color_label` str \| None \| [Param](inspect_viz.qmd#param) \| None A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. For axes and legends only. `color_percent` bool \| [Param](inspect_viz.qmd#param) \| None If true, shorthand for a transform suitable for percentages, mapping proportions in \[0, 1\] to \[0, 100\]. `color_reverse` bool \| [Param](inspect_viz.qmd#param) \| None Whether to reverse the scale’s encoding; equivalent to reversing either the **domain** or **range**. `color_zero` bool \| [Param](inspect_viz.qmd#param) \| None Whether the **domain** must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero. For quantitative scales only. `color_tick_format` str \| None \| [Param](inspect_viz.qmd#param) \| None How to format inputs (abstract values) for axis tick labels; one of: - a [d3-format](https://d3js.org/d3-time) string for numeric scales - a [d3-time-format](https://d3js.org/d3-time-format) string for temporal scales `color_exponent` float \| [Param](inspect_viz.qmd#param) \| None A power scale’s exponent (*e.g.*, 0.5 for sqrt); defaults to 1 for a linear scale. For *pow* and *diverging-pow* scales only. `color_base` float \| [Param](inspect_viz.qmd#param) \| None A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For *log* and *diverging-log* scales only. `color_constant` float \| [Param](inspect_viz.qmd#param) \| None A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For *symlog* and *diverging-symlog* scales only. `opacity_scale` [ContinuousScale](inspect_viz.plot.qmd#continuousscale) \| None \| [Param](inspect_viz.qmd#param) \| None The *opacity* scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. The opacity scale defaults to *linear*; this scales is intended for quantitative data. `opacity_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. Opacity scales have a default domain from 0 to the maximum value of associated channels. `opacity_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). Opacity scales have a default range of \[0, 1\]. `opacity_clamp` bool \| [Param](inspect_viz.qmd#param) \| None If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum. Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit **domain** since if the domain is inferred, no values will be outside the domain. For continuous scales only. `opacity_nice` bool \| float \| Interval \| [Param](inspect_viz.qmd#param) \| None If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for *linear* scales, and nice time intervals for *utc* and *time* scales. Pass an interval such as *minute*, *wednesday* or *month* to specify what constitutes a nice interval. For continuous scales only. `opacity_label` str \| None \| [Param](inspect_viz.qmd#param) \| None A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. For axes and legends only. `opacity_percent` bool \| [Param](inspect_viz.qmd#param) \| None If true, shorthand for a transform suitable for percentages, mapping proportions in \[0, 1\] to \[0, 100\]. `opacity_reverse` bool \| [Param](inspect_viz.qmd#param) \| None Whether to reverse the scale’s encoding; equivalent to reversing either the **domain** or **range**. `opacity_zero` bool \| [Param](inspect_viz.qmd#param) \| None Whether the **domain** must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero. For quantitative scales only. `opacity_tick_format` str \| None \| [Param](inspect_viz.qmd#param) \| None How to format inputs (abstract values) for axis tick labels; one of: - a [d3-format](https://d3js.org/d3-time) string for numeric scales - a [d3-time-format](https://d3js.org/d3-time-format) string for temporal scales `opacity_exponent` float \| [Param](inspect_viz.qmd#param) \| None A power scale’s exponent (*e.g.*, 0.5 for sqrt); defaults to 1 for a linear scale. For *pow* scales only. `opacity_base` float \| [Param](inspect_viz.qmd#param) \| None A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For *log* scales only. `opacity_constant` float \| [Param](inspect_viz.qmd#param) \| None A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For *symlog* scales only. `symbol_scale` Literal\['ordinal', 'categorical', 'threshold', 'quantile', 'quantize'\] \| None \| [Param](inspect_viz.qmd#param) The *symbol* scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. Defaults to an *ordinal* scale type. `symbol_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. As symbol scales are discrete, the domain is an array (or iterable) of values is the desired order, defaulting to natural ascending order. `symbol_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (*point* and *band*), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For other ordinal data, such as for a *color* scale, it is an array (or iterable) of output values in the same order as the **domain**. Symbol scales have a default range of categorical symbols; the choice of symbols depends on whether the associated dot mark is filled or stroked. `r_scale` [ContinuousScale](inspect_viz.plot.qmd#continuousscale) \| None \| [Param](inspect_viz.qmd#param) \| None The *r* (radius) scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. The radius scale defaults to *sqrt*; this scale is intended for quantitative data. `r_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. Radius scales have a default domain from 0 to the median first quartile of associated channels. `r_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (*point* and *band*), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For other ordinal data, such as for a *color* scale, it is an array (or iterable) of output values in the same order as the **domain**. Radius scales have a default range of \[0, 3\]. `r_clamp` Any \| None If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum. Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit **domain** since if the domain is inferred, no values will be outside the domain. For continuous scales only. `r_nice` bool \| float \| Interval \| [Param](inspect_viz.qmd#param) \| None If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for *linear* scales, and nice time intervals for *utc* and *time* scales. Pass an interval such as *minute*, *wednesday* or *month* to specify what constitutes a nice interval. For continuous scales only. `r_label` str \| None \| [Param](inspect_viz.qmd#param) \| None A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. `r_percent` bool \| [Param](inspect_viz.qmd#param) \| None If true, shorthand for a transform suitable for percentages, mapping proportions in \[0, 1\] to \[0, 100\]. `r_zero` bool \| [Param](inspect_viz.qmd#param) \| None Whether the **domain** must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero. For quantitative scales only. `r_exponent` float \| [Param](inspect_viz.qmd#param) \| None A power scale’s exponent (*e.g.*, 0.5 for sqrt); defaults to 1 for a linear scale. For *pow* scales only. `r_base` float \| [Param](inspect_viz.qmd#param) \| None A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For *log* scales only. `r_constant` float \| [Param](inspect_viz.qmd#param) \| None A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For *symlog* scales only. `length_scale` [ContinuousScale](inspect_viz.plot.qmd#continuousscale) \| None \| [Param](inspect_viz.qmd#param) \| None The *length* scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. The length scale defaults to *linear*, as this scale is intended for quantitative data. `length_domain` Literal\['fixed'\] \| Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order. Linear scales have a default domain of \[0, 1\]. Log scales have a default domain of \[1, 10\] and cannot include zero. Radius scales have a default domain from 0 to the median first quartile of associated channels. Length have a default domain from 0 to the median median of associated channels. Opacity scales have a default domain from 0 to the maximum value of associated channels. `length_range` Sequence\[str \| float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The extent of the scale’s outputs (visual values). By default inferred from the scale’s **type** and **domain**, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (*point* and *band*), it is typically \[*min*, *max*\]; it can be \[*max*, *min*\] to reverse the scale. For other ordinal data, such as for a *color* scale, it is an array (or iterable) of output values in the same order as the **domain**. Length scales have a default range of \[0, 12\]. `length_clamp` Any \| None If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum. Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit **domain** since if the domain is inferred, no values will be outside the domain. For continuous scales only. `length_nice` bool \| float \| Interval \| [Param](inspect_viz.qmd#param) \| None If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for *linear* scales, and nice time intervals for *utc* and *time* scales. Pass an interval such as *minute*, *wednesday* or *month* to specify what constitutes a nice interval. For continuous scales only. `length_percent` bool \| [Param](inspect_viz.qmd#param) \| None If true, shorthand for a transform suitable for percentages, mapping proportions in \[0, 1\] to \[0, 100\]. `length_zero` bool \| [Param](inspect_viz.qmd#param) \| None Whether the **domain** must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero. For quantitative scales only. `length_exponent` float \| [Param](inspect_viz.qmd#param) \| None A power scale’s exponent (*e.g.*, 0.5 for sqrt); defaults to 1 for a linear scale. For *pow* scales only. `length_base` float \| [Param](inspect_viz.qmd#param) \| None A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For *log* scales only. `length_constant` float \| [Param](inspect_viz.qmd#param) \| None A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For *symlog* scales only. `projection_type` [Projection](inspect_viz.plot.qmd#projection) \| None \| [Param](inspect_viz.qmd#param) \| None The desired projection; one of: - a named built-in projection such as *albers-usa* - null, for no projection Named projections are scaled and translated to fit the **domain** to the plot’s frame (minus insets). `projection_domain` object \| [Param](inspect_viz.qmd#param) \| None A GeoJSON object to fit to the plot’s frame (minus insets); defaults to a Sphere for spherical projections (outline of the the whole globe). `projection_rotate` Sequence\[float \| [Param](inspect_viz.qmd#param)\] \| [Param](inspect_viz.qmd#param) \| None A rotation of the sphere before projection; defaults to \[0, 0, 0\]. Specified as Euler angles λ (yaw, or reference longitude), φ (pitch, or reference latitude), and optionally γ (roll), in degrees. `projection_parallels` Sequence\[float \| [Param](inspect_viz.qmd#param)\] \| [Param](inspect_viz.qmd#param) \| None The [standard parallels](https://d3js.org/d3-geo/conic#conic_parallels). For conic projections only. `projection_precision` float \| [Param](inspect_viz.qmd#param) \| None The projection’s [sampling threshold](https://d3js.org/d3-geo/projection#projection_precision). `projection_clip` bool \| float \| Literal\['frame'\] \| None \| [Param](inspect_viz.qmd#param) \| None The projection’s clipping method; one of: - *frame* or true (default) - clip to the plot’s frame (including margins but not insets) - a number - clip to a circle of the given radius in degrees centered around the origin - null or false - do not clip Some projections (such as [*armadillo*](https://observablehq.com/@d3/armadillo) and [*berghaus*](https://observablehq.com/@d3/berghaus-star)) require spherical clipping: in that case set the marks’ **clip** option to *sphere*. `projection_inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four projection insets. All insets typically default to zero, though not always. A positive inset reduces effective area, while a negative inset increases it. `projection_inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge of the projection by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it). `projection_inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge of the projection by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it). `projection_inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge of the projection by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it). `projection_inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge of the projection by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it). ## Legend ### legend Create a legend. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_legend.py#L54) ``` python def legend( legend: Literal["color", "opacity", "symbol"], *, columns: Literal["auto"] | int | None = "auto", label: str | None = None, target: Selection | None = None, field: str | None = None, width: float | None = None, height: float | None = None, tick_size: float | None = None, margin_bottom: float | None = None, margin_left: float | None = None, margin_right: float | None = None, margin_top: float | None = None, for_plot: str | None = None, frame_anchor: FrameAnchor | None = None, inset: float | None = None, inset_x: float | None = None, inset_y: float | None = None, border: str | bool = True, background: str | bool = True, ) -> Legend ``` `legend` Literal\['color', 'opacity', 'symbol'\] Legend type (`"color"`, `"opacity"`, or `"symbol"`). `columns` Literal\['auto'\] \| int \| None The number of columns to use to layout a discrete legend (defaults to “auto”, which uses 1 column for location “left” or “right”) `label` str \| None The legend label. `target` [Selection](inspect_viz.qmd#selection) \| None The target selection. If specified, the legend is interactive, using a `toggle` interaction for discrete legends or an `intervalX` interaction for continuous legends. `field` str \| None The data field over which to generate output selection clauses. If unspecified, a matching field is retrieved from existing plot marks. `width` float \| None Width of the legend in pixels. `height` float \| None Height of the legend in pixels. `tick_size` float \| None The size of legend ticks in a continuous legend, in pixels. `margin_bottom` float \| None The bottom margin of the legend component, in pixels. `margin_left` float \| None The left margin of the legend component, in pixels. `margin_right` float \| None The right margin of the legend component, in pixels. `margin_top` float \| None The top margin of the legend component, in pixels. `for_plot` str \| None The name of the plot this legend applies to. A plot must include a `name` attribute to be referenced. Note that this is not use when passing a legend to the `plot()` function. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| None Where to position the relative the plot frame. Defaults to “right”. `inset` float \| None The inset of the legend from the plot frame, in pixels. If no inset is specified, the legend will be positioned outside the plot frame. `inset_x` float \| None The horizontal inset of the legend from the plot frame, in pixels. `inset_y` float \| None The vertical inset of the legend from the plot frame, in pixels. `border` str \| bool The border color for the legend. Pass ‘True’ to use the default border color, or a string to specify a custom color. Pass ‘False’ to disable the border. Defaults to `True`. `background` str \| bool The background color for the legend. Pass ‘True’ to use the default background color, or a string to specify a custom color. Pass ‘False’ to disable the background. Defaults to `True`. ### Legend Plot legend (create legends using the `legend()` function). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_legend.py#L11) ``` python class Legend(Component) ``` #### Attributes `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) The frame anchor for the legend. ## Export ### to_html Genreate an HTML snippet for a plot or other component. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_write.py#L21) ``` python def to_html(component: Component, dependencies: bool = True) -> str ``` `component` [Component](inspect_viz.qmd#component) Compontent to export. `dependencies` bool Include JavaScript dependencies required for Jupyter widget rendering. Dependencies should only be included once per web-page, so if you already have them on a page you might want to disable including them when generating HTML. ### write_html Write an HTML file for a plot or other component. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_write.py#L77) ``` python def write_html( file: str | Path, component: Component, dependencies: bool = True ) -> None ``` `file` str \| Path Target filename. `component` [Component](inspect_viz.qmd#component) Compontent to export. `dependencies` bool Include JavaScript dependencies required for Jupyter widget rendering. Dependencies should only be included once per web-page, so if you already have them on a page you might want to disable including them when generating HTML. ### write_png Export a plot or table to a PNG. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_write.py#L105) ``` python def write_png( file: str | Path | None, component: Component, scale: int = 2, padding: int = 8 ) -> tuple[bytes, int, int] | tuple[int, int] | None ``` `file` str \| Path \| None Target filename (pass `None` to return the image as bytes) `component` [Component](inspect_viz.qmd#component) Component to export. `scale` int Device scale to capture plot at. Use 2 (the default) for retina quality images suitable for high resolution displays or print output) `padding` int Padding (in pixels) around plot. ## Defaults ### plot_defaults Set global plot defaults. Note that this function should be called once at the outset (subsequent calls to it do not reset the defaults). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_defaults.py#L42) ``` python def plot_defaults(**defaults: Unpack[PlotDefaults]) -> None ``` `**defaults` Unpack\[[PlotDefaults](inspect_viz.plot.qmd#plotdefaults)\] Keyword args from `PlotDefaults` ### PlotDefaults Default options for plots. Use the `plot_defaults()` function to set global defaults for plot options. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_defaults.py#L9) ``` python class PlotDefaults(PlotAttributes, total=False) ``` #### Attributes `x_label` str \| [Param](inspect_viz.qmd#param) A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. `fx_label` str \| [Param](inspect_viz.qmd#param) A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. For axes and legends only. `y_label` str \| [Param](inspect_viz.qmd#param) A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. `fy_label` str \| [Param](inspect_viz.qmd#param) A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. For axes and legends only. `width` float \| [Param](inspect_viz.qmd#param) The outer width of the plot in pixels, including margins. Defaults to 640. `height` float \| [Param](inspect_viz.qmd#param) The outer height of the plot in pixels, including margins. The default depends on the plot’s scales, and the plot’s width if an aspectRatio is specified. For example, if the *y* scale is linear and there is no *fy* scale, it might be 396. ## Types ### PositionScale How a scale encodes abstract data, say by applying a mathematical transformation. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L7) ``` python PositionScale: TypeAlias = Literal[ "linear", "log", "pow", "sqrt", "symlog", "utc", "time", "point", "band", "ordinal", "threshold", "quantile", "quantize", "identity", ] ``` ### Projection Built-in projection types. Named projections are scaled and translated to fit the **domain** to the plot’s frame (minus insets). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L25) ``` python Projection: TypeAlias = Literal[ "albers", "albers-usa", "azimuthal-equal-area", "azimuthal-equidistant", "conic-conformal", "conic-equal-area", "conic-equidistant", "equal-earth", "equirectangular", "gnomonic", "identity", "mercator", "natural-earth1", "orthographic", "stereographic", "transverse-mercator", ] ``` ### ContinuousScale Continuous scaling transformations. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L48) ``` python ContinuousScale: TypeAlias = Literal[ "linear", "log", "pow", "sqrt", "symlog", "utc", "time", "identity", ] ``` ### ColorScale Color scale tranformations. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L60) ``` python ColorScale: TypeAlias = Literal[ "linear", "log", "pow", "sqrt", "symlog", "utc", "time", "ordinal", "categorical", "threshold", "quantile", "quantize", "diverging", "diverging-log", "diverging-pow", "diverging-symlog", "cyclical", "sequential", "rainbow", "sinebow", ] ``` ### ColorScheme Color schemes. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L84) ``` python ColorScheme: TypeAlias = Literal[ "accent", "blues", "brbg", "bugn", "bupu", "category10", "dark2", "gnbu", "greens", "greys", "magma", "oranges", "orrd", "paired", "pastel1", "pastel2", "piyg", "plasma", "prgn", "pubu", "pubugn", "puor", "purd", "purples", "rdbu", "rdgy", "rdpu", "rdylbu", "rdylgn", "reds", "set1", "set2", "set3", "spectral", "tableau10", "turbo", "viridis", "warm", "cool", "cubehelix", "rainbow", "sinebow", ] ``` ### Interpolate How to interpolate color range values. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L130) ``` python Interpolate: TypeAlias = Literal[ "rgb", "hsl", "lab", "hcl", "cubehelix", ] ``` ### LabelArrow Whether to apply a directional arrow to an axis scale label. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/plot/_attributes.py#L140) ``` python LabelArrow = ( Literal[ "auto", "up", "right", "down", "left", "none", ] | bool | None ) ``` # inspect_viz.mark ## Basic ### dot A dot mark that draws circles, or other symbols, as in a scatterplot. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_dot.py#L15) ``` python def dot( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, r: ChannelSpec | float | Param | None = None, filter_by: Selection | None = None, rotate: Channel | float | Param | None = None, symbol: ChannelSpec | Param | Symbol | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) Horizontal position channel specifying the dot’s center. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel specifying the dot’s center. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius of dots; either a channel or constant. When a number, it is interpreted as a constant radius in pixels. Otherwise it is interpreted as a channel, typically bound to the *r* channel, which defaults to the *sqrt* type for proportional symbols. The radius defaults to 4.5 pixels when using the **symbol** channel, and otherwise 3 pixels. Dots with a nonpositive radius are not drawn. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of dots in degrees clockwise; either a channel or a constant. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. Defaults to 0°, pointing up. `symbol` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| [Symbol](inspect_viz.mark.qmd#symbol) \| None Categorical column to bind symbols to or CSS color string. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### dot_x A horizontal dot mark that draws circles, or other symbols. Like dot, except that **y** defaults to the identity function, assuming that *data* = \[*y₀*, *y₁*, *y₂*, …\]. If an **interval** is specified, such as *day*, **y** is transformed to the middle of the interval. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_dot.py#L62) ``` python def dot_x( data: Data, x: ChannelSpec | Param, y: ChannelIntervalSpec | None = None, z: Channel | Param | None = None, r: ChannelSpec | float | Param | None = None, interval: Interval | None = None, filter_by: Selection | None = None, rotate: Channel | float | Param | None = None, symbol: ChannelSpec | Param | Symbol | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel specifying the dot’s center. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| None The vertical position of the dot’s center,typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius of dots; either a channel or constant. When a number, it is interpreted as a constant radius in pixels. Otherwise it is interpreted as a channel, typically bound to the *r* channel, which defaults to the *sqrt* type for proportional symbols. The radius defaults to 4.5 pixels when using the **symbol** channel, and otherwise 3 pixels. Dots with a nonpositive radius are not drawn. `interval` Interval \| None An interval (such as *day* or a number), to transform **y** values to the middle of the interval. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of dots in degrees clockwise; either a channel or a constant. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. Defaults to 0°, pointing up. `symbol` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| [Symbol](inspect_viz.mark.qmd#symbol) \| None Categorical column to bind symbols to or CSS color string. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### dot_y A vertical dot mark that draws circles, or other symbols. Like dot, except that **x** defaults to the identity function, assuming that *data* = \[*x₀*, *x₁*, *x₂*, …\]. If an **interval** is specified, such as *day*, **x** is transformed to the middle of the interval. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_dot.py#L117) ``` python def dot_y( data: Data, y: ChannelSpec | Param, x: ChannelIntervalSpec | None = None, z: Channel | Param | None = None, r: ChannelSpec | float | Param | None = None, interval: Interval | None = None, filter_by: Selection | None = None, rotate: Channel | float | Param | None = None, symbol: ChannelSpec | Param | Symbol | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel specifying the dot’s center. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| None The horizontal position of the dot’s center, typically bound to the *x* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius of dots; either a channel or constant. When a number, it is interpreted as a constant radius in pixels. Otherwise it is interpreted as a channel, typically bound to the *r* channel, which defaults to the *sqrt* type for proportional symbols. The radius defaults to 4.5 pixels when using the **symbol** channel, and otherwise 3 pixels. Dots with a nonpositive radius are not drawn. `interval` Interval \| None An interval (such as *day* or a number), to transform **x** values to the middle of the interval. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of dots in degrees clockwise; either a channel or a constant. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. Defaults to 0°, pointing up. `symbol` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| [Symbol](inspect_viz.mark.qmd#symbol) \| None Categorical column to bind symbols to or CSS color string. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### circle A circle mark that draws circles as in a scatterplot. Like dot, but with the symbol fixed to be a circle. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_dot.py#L172) ``` python def circle( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: ChannelSpec | Param | None = None, r: ChannelSpec | float | Param | None = None, filter_by: Selection | None = None, rotate: ChannelSpec | float | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) Horizontal position channel specifying the circle’s center. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel specifying the circle’s center. `z` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius of circles; either a channel or constant. When a number, it is interpreted as a constant radius in pixels. Otherwise it is interpreted as a channel, typically bound to the *r* channel, which defaults to the *sqrt* type for proportional symbols. The radius defaults to 3 pixels. Circles with a nonpositive radius are not drawn. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `rotate` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of circles in degrees clockwise; either a channel or a constant. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. Defaults to 0°, pointing up. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### hexagon A hexagon mark that draws hexagons as in a scatterplot. Like dot, but with the symbol fixed to be a hexagon. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_dot.py#L218) ``` python def hexagon( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: ChannelSpec | Param | None = None, r: ChannelSpec | float | Param | None = None, filter_by: Selection | None = None, rotate: ChannelSpec | float | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) Horizontal position channel specifying the hexagon’s center. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel specifying the hexagon’s center. `z` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius of hexagons; either a channel or constant. When a number, it is interpreted as a constant radius in pixels. Otherwise it is interpreted as a channel, typically bound to the *r* channel, which defaults to the *sqrt* type for proportional symbols. The radius defaults to 4.5 pixels. Hexagons with a nonpositive radius are not drawn. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `rotate` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of hexagons in degrees clockwise; either a channel or a constant. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. Defaults to 0°, pointing up. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### line A line mark that connects control points. Points along the line are connected in input order. If there are multiple series via the **z**, **fill**, or **stroke** channel, series are drawn in input order such that the last series is drawn on top. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_line.py#L14) ``` python def line( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The required horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The required vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve (interpolation) method for connecting adjacent points. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option for bundle, cardinal and Catmull-Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### line_x A horizontal line mark that connects control points. Like line, except that **y** defaults to the zero-based index of the data \[0, 1, 2, …\]. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_line.py#L64) ``` python def line_x( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The required horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve (interpolation) method for connecting adjacent points. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option for bundle, cardinal and Catmull-Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### line_y A vertical line mark that connects control points. Like line, except that **x** defaults to the zero-based index of the data \[0, 1, 2, …\]. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_line.py#L114) ``` python def line_y( data: Data, y: ChannelSpec | Param, x: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The required vertical position channel, typically bound to the *y* scale. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve (interpolation) method for connecting adjacent points. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option for bundle, cardinal and Catmull-Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### area An area mark defined by a baseline (*x1*, *y1*) and a topline (*x2*, *y2*). The **x1** and **y1** channels specify the area’s baseline; the **x2** and **y2** channels specify the area’s topline. Both the baseline and topline are typically bound to the same scales as their respective dimensions. If **x2** is not specified, it defaults to **x1**. If **y2** is not specified, it defaults to **y1**. Typically either **x2** or **y2** is unspecified, creating either a horizontal or vertical area. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_area.py#L14) ``` python def area( data: Data, x1: ChannelSpec | Param, y1: ChannelSpec | Param, x2: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, curve: Curve | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The required primary (starting, often left) horizontal position channel, representing the area’s baseline, typically bound to the *x* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The required primary (starting, often bottom) vertical position channel, representing the area’s baseline, typically bound to the *y* scale. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The optional secondary (ending, often right) horizontal position channel, representing the area’s topline, typically bound to the *x* scale; if not specified, **x1** is used. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The optional secondary (ending, often top) vertical position channel, representing the area’s topline, typically bound to the *y* scale; if not specified, **y1** is used. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into (possibly stacked) series to be drawn as separate areas; defaults to **fill** if a channel, or **stroke** if a channel. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks, say to produce a streamgraph; defaults to null for a zero baseline (**y** = 0 for stackY, and **x** = 0 for stackX). If the *wiggle* offset is used, the default **order** changes to *inside-out*. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order If the *wiggle* **offset** is used, as for a streamgraph, the default changes to *inside-out*. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve (interpolation) method for connecting adjacent points. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### area_x A horizontal area mark. The **x** channel specifies the area’s length (or width); it is typically bound to the *x* scale. The **y** channel specifies the area’s vertical position; it is typically bound to the *y* scale and defaults to the zero-based index of the data \[0, 1, 2, …\]. If neither **x1** nor **x2** is specified, an implicit stackX transform is applied and **x** defaults to the identity function, assuming that *data* = \[*x₀*, *x₁*, *x₂*, …\]. Otherwise, if only one of **x1** or **x2** is specified, the other defaults to **x**, which defaults to zero. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_area.py#L74) ``` python def area_x( data: Data, x: ChannelSpec | Param, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, curve: Curve | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position (or length) channel, typically bound to the *x* scale. If neither **x1** nor **x2** is specified, an implicit stackX transform is applied and **x** defaults to the identity function, assuming that *data* = \[*x₀*, *x₁*, *x₂*, …\]. Otherwise, if only one of **x1** or **x2** is specified, the other defaults to **x**, which defaults to zero. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The required primary (starting, often left) horizontal position channel, representing the area’s baseline, typically bound to the *x* scale. For areaX, setting this option disables the implicit stackX transform. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The optional secondary (ending, often right) horizontal position channel, representing the area’s topline, typically bound to the *x* scale; if not specified, **x1** is used. For areaX, setting this option disables the implicit stackX transform. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into (possibly stacked) series to be drawn as separate areas; defaults to **fill** if a channel, or **stroke** if a channel. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks, say to produce a streamgraph; defaults to null for a zero baseline (**y** = 0 for stackY, and **x** = 0 for stackX). If the *wiggle* offset is used, the default **order** changes to *inside-out*. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order If the *wiggle* **offset** is used, as for a streamgraph, the default changes to *inside-out*. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve (interpolation) method for connecting adjacent points. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### area_y A vertical area mark. The **y** channel specifies the area’s height (or length); it is typically bound to the *y* scale. The **x** channel specifies the area’s horizontal position; it is typically bound to the *x* scale and defaults to the zero-based index of the data \[0, 1, 2, …\]. If neither **y1** nor **y2** is specified, an implicit stackY transform is applied and **y** defaults to the identity function, assuming that *data* = \[*y₀*, *y₁*, *y₂*, …\]. Otherwise, if only one of **y1** or **y2** is specified, the other defaults to **y**, which defaults to zero. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_area.py#L135) ``` python def area_y( data: Data, y: ChannelSpec | Param, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, x: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, curve: Curve | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position (or length) channel, typically bound to the *y* scale. If neither **y1** nor **y2** is specified, an implicit stackY transform is applied and **y** defaults to the identity function, assuming that *data* = \[*y₀*, *y₁*, *y₂*, …\]. Otherwise, if only one of **y1** or **y2** is specified, the other defaults to **y**, which defaults to zero. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The required primary (starting, often bottom) vertical position channel, representing the area’s baseline, typically bound to the *y* scale. For areaY, setting this option disables the implicit stackY transform. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The optional secondary (ending, often top) vertical position channel, representing the area’s topline, typically bound to the *y* scale; if not specified, **y1** is used. For areaY, setting this option disables the implicit stackY transform. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into (possibly stacked) series to be drawn as separate areas; defaults to **fill** if a channel, or **stroke** if a channel. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks, say to produce a streamgraph; defaults to null for a zero baseline (**y** = 0 for stackY, and **x** = 0 for stackX). If the *wiggle* offset is used, the default **order** changes to *inside-out*. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order If the *wiggle* **offset** is used, as for a streamgraph, the default changes to *inside-out*. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve (interpolation) method for connecting adjacent points. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### bar_x A horizontal bar mark. The required *x* values should be quantitative or temporal, and the optional *y* values should be ordinal. If neither **x1** nor **x2** nor **interval** is specified, an implicit stackX transform is applied and **x** defaults to the identity function, assuming that *data* = \[*x₀*, *x₁*, *x₂*, …\]. Otherwise if an **interval** is specified, then **x1** and **x2** are derived from **x**, representing the lower and upper bound of the containing interval, respectively. Otherwise, if only one of **x1** or **x2** is specified, the other defaults to **x**, which defaults to zero. The optional **y** ordinal channel specifies the vertical position; it is typically bound to the *y* scale, which must be a *band* scale. If the **y** channel is not specified, the bar will span the vertical extent of the plot’s frame. If *y* is quantitative, use the rectX mark instead. If *x* is ordinal, use the cell mark instead.” [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_bar.py#L14) ``` python def bar_x( data: Data, x: ChannelIntervalSpec | Param, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y: ChannelIntervalSpec | Param | None = None, interval: Interval | None = None, filter_by: Selection | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, z: Channel | Param | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: str | float | Param | None = None, ry: str | float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) The horizontal position (or length/width) channel, typically bound to the *x* scale. If neither **x1** nor **x2** nor **interval** is specified, an implicit stackX transform is applied and **x** defaults to the identity function, assuming that *data* = \[*x₀*, *x₁*, *x₂*, …\]. Otherwise if an **interval** is specified, then **x1** and **x2** are derived from **x**, representing the lower and upper bound of the containing interval, respectively. Otherwise, if only one of **x1** or **x2** is specified, the other defaults to **x**, which defaults to zero. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The required primary (starting, often left) horizontal position channel, typically bound to the *x* scale. Setting this option disables the implicit stackX transform. If *x* represents ordinal values, use a cell mark instead. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The required secondary (ending, often right) horizontal position channel, typically bound to the *x* scale. Setting this option disables the implicit stackX transform. If *x* represents ordinal values, use a cell mark instead. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The optional vertical position of the bar; a ordinal channel typically bound to the *y* scale. If not specified, the bar spans the vertical extent of the frame; otherwise the *y* scale must be a *band* scale. If *y* represents quantitative or temporal values, use a rectX mark instead. `interval` Interval \| None How to convert a continuous value (**x** for barX, or **y** for barY) into an interval (**x1** and **x2** for barX, or **y1** and **y2** for barY); one of: - a named time interval such as *day* (for date intervals) - a number (for number intervals), defining intervals at integer multiples of *n* Setting this option disables the implicit stack transform (stackX for barX, or stackY for barY). `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks, say to produce a streamgraph; defaults to null for a zero baseline (**y** = 0 for stackY, and **x** = 0 for stackX). If the *wiggle* offset is used, the default **order** changes to *inside-out*. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order If the *wiggle* **offset** is used, as for a streamgraph, the default changes to *inside-out*. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The **z** channel defines the series of each value in the stack. Used when the **order** is *sum*, *appearance*, *inside-out*, or an explicit array of **z** values. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it). `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it). `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it). `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it). `rx` str \| float \| [Param](inspect_viz.qmd#param) \| None The rounded corner [*x*-radius](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/rx), either in pixels or as a percentage of the rect width. If **rx** is not specified, it defaults to **ry** if present, and otherwise draws square corners. `ry` str \| float \| [Param](inspect_viz.qmd#param) \| None The rounded corner \[*y*-radius\]\[\], either in pixels or as a percentage of the rect height. If **ry** is not specified, it defaults to **rx** if present, and otherwise draws square corners. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### bar_y A vertical bar mark. The required *y* values should be quantitative or temporal, and the optional *x* values should be ordinal. If neither **y1** nor **y2** nor **interval** is specified, an implicit stackY transform is applied and **y** defaults to the identity function, assuming that *data* = \[*y₀*, *y₁*, *y₂*, …\]. Otherwise if an **interval** is specified, then **y1** and **y2** are derived from **y**, representing the lower and upper bound of the containing interval, respectively. Otherwise, if only one of **y1** or **y2** is specified, the other defaults to **y**, which defaults to zero. The optional **x** ordinal channel specifies the horizontal position; it is typically bound to the *x* scale, which must be a *band* scale. If the **x** channel is not specified, the bar will span the horizontal extent of the plot’s frame. If *x* is quantitative, use the rectY mark instead. If *y* is ordinal, use the cell mark instead. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_bar.py#L105) ``` python def bar_y( data: Data, y: ChannelSpec | Param, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, x: ChannelSpec | Param | None = None, interval: Interval | None = None, filter_by: Selection | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, z: Channel | Param | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: str | float | Param | None = None, ry: str | float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position (or length/height) channel, typically bound to the *y* scale. If neither **y1** nor **y2** nor **interval** is specified, an implicit stackY transform is applied and **y** defaults to the identity function, assuming that *data* = \[*y₀*, *y₁*, *y₂*, …\]. Otherwise if an **interval** is specified, then **y1** and **y2** are derived from **y**, representing the lower and upper bound of the containing interval, respectively. Otherwise, if only one of **y1** or **y2** is specified, the other defaults to **y**, which defaults to zero. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The required primary (starting, often bottom) vertical position channel, typically bound to the *y* scale. Setting this option disables the implicit stackY transform. If *y* represents ordinal values, use a cell mark instead. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The required secondary (ending, often top) vertical position channel, typically bound to the *y* scale. Setting this option disables the implicit stackY transform. If *y* represents ordinal values, use a cell mark instead. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The optional horizontal position of the bar; a ordinal channel typically bound to the *x* scale. If not specified, the bar spans the horizontal extent of the frame; otherwise the *x* scale must be a *band* scale. If *x* represents quantitative or temporal values, use a rectY mark instead. `interval` Interval \| None How to convert a continuous value (**x** for barX, or **y** for barY) into an interval (**x1** and **x2** for barX, or **y1** and **y2** for barY); one of: - a named time interval such as *day* (for date intervals) - a number (for number intervals), defining intervals at integer multiples of *n* Setting this option disables the implicit stack transform (stackX for barX, or stackY for barY). `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks, say to produce a streamgraph; defaults to null for a zero baseline (**y** = 0 for stackY, and **x** = 0 for stackX). If the *wiggle* offset is used, the default **order** changes to *inside-out*. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order If the *wiggle* **offset** is used, as for a streamgraph, the default changes to *inside-out*. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The **z** channel defines the series of each value in the stack. Used when the **order** is *sum*, *appearance*, *inside-out*, or an explicit array of **z** values. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it). `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it). `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it). `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it). `rx` str \| float \| [Param](inspect_viz.qmd#param) \| None The rounded corner [*x*-radius](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/rx), either in pixels or as a percentage of the rect width. If **rx** is not specified, it defaults to **ry** if present, and otherwise draws square corners. `ry` str \| float \| [Param](inspect_viz.qmd#param) \| None The rounded corner \[*y*-radius\]\[\], either in pixels or as a percentage of the rect height. If **ry** is not specified, it defaults to **rx** if present, and otherwise draws square corners. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### heatmap Create a heatmap mark for density visualization with optimized defaults. The heatmap mark is essentially a raster mark with different default options optimized for density visualization. It bins spatial data into a raster grid and applies kernel density smoothing to create smooth density surfaces from point data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_raster.py#L79) ``` python def heatmap( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, filter_by: Selection | None = None, width: float | Param | None = None, height: float | Param | None = None, pixel_size: float | Param | None = None, pad: float | Param | None = None, interpolate: Interpolate | Param | None = None, bandwidth: float | Param | None = None, image_rendering: str | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. Domain values are binned into a grid with *width* horizontal bins. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. Domain values are binned into a grid with *height* vertical bins. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `width` float \| [Param](inspect_viz.qmd#param) \| None The width (number of columns) of the grid, in actual pixels. `height` float \| [Param](inspect_viz.qmd#param) \| None The height (number of rows) of the grid, in actual pixels. `pixel_size` float \| [Param](inspect_viz.qmd#param) \| None The effective screen size of a raster pixel, used to determine the height and width of the raster from the frame’s dimensions; defaults to 1. `pad` float \| [Param](inspect_viz.qmd#param) \| None The bin padding, one of 1 (default) to include extra padding for the final bin, or 0 to make the bins flush with the maximum domain value. `interpolate` [Interpolate](inspect_viz.mark.qmd#interpolate) \| [Param](inspect_viz.qmd#param) \| None The spatial interpolation method; one of: - *none* - do not perform interpolation (the default) - *linear* - apply proportional linear interpolation across adjacent bins - *nearest* - assign each pixel to the closest sample’s value (Voronoi diagram) - *barycentric* - apply barycentric interpolation over the Delaunay triangulation - *random-walk* - apply a random walk from each pixel `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels; defaults to 20. `image_rendering` str \| [Param](inspect_viz.qmd#param) \| None The image-rendering attribute; defaults to *auto* (bilinear). May be set to *pixelated* to disable bilinear interpolation for a sharper image. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ## Statistical ### density Create a 2D density mark that shows smoothed point cloud densities. The density mark bins the data, counts the number of records that fall into each bin, and smooths the resulting counts, then plots the smoothed distribution, by default using a circular dot mark. The density mark calculates density values that can be mapped to encoding channels such as fill or r using the special field name “density”. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_density.py#L17) ``` python def density( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, type: Literal["dot", "circle", "hexagon", "cell", "text"] | Param | None = None, width: float | Param | None = None, height: float | Param | None = None, pixel_size: float | Param | None = None, pad: float | Param | None = None, bandwidth: float | Param | None = None, interpolate: Interpolate | Param | None = None, symbol: Symbol | Param | None = None, r: ChannelSpec | float | Param | None = None, rotate: Channel | float | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, styles: TextStyles | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. Domain values are binned into a grid with *width* horizontal bins. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. Domain values are binned into a grid with *height* vertical bins. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `type` Literal\['dot', 'circle', 'hexagon', 'cell', 'text'\] \| [Param](inspect_viz.qmd#param) \| None The base mark type to use for rendering; defaults to “dot”. `width` float \| [Param](inspect_viz.qmd#param) \| None The number of horizontal bins for density calculation. `height` float \| [Param](inspect_viz.qmd#param) \| None The number of vertical bins for density calculation. `pixel_size` float \| [Param](inspect_viz.qmd#param) \| None The size of each pixel for the grid, in data units. `pad` float \| [Param](inspect_viz.qmd#param) \| None The bin padding, one of 1 (default) to include extra padding for the final bin, or 0 to make the bins flush with the maximum domain value. `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels. `interpolate` [Interpolate](inspect_viz.mark.qmd#interpolate) \| [Param](inspect_viz.qmd#param) \| None The spatial interpolation method; one of: - *none* - do not perform interpolation (the default) - *linear* - apply proportional linear interpolation across adjacent bins - *nearest* - assign each pixel to the closest sample’s value (Voronoi diagram) - *barycentric* - apply barycentric interpolation over the Delaunay triangulation - *random-walk* - apply a random walk from each pixel `symbol` [Symbol](inspect_viz.mark.qmd#symbol) \| [Param](inspect_viz.qmd#param) \| None The symbol type for dots; defaults to “circle”. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius channel, typically bound to the *radius* scale. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor position for legend placement. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None Text styles to apply. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### density_x A densityX mark that visualizes smoothed point cloud densities along the **x** dimension. The mark bins the data, counts the number of records that fall into each bin, smooths the resulting counts, and then plots the smoothed distribution, by default using an areaX mark. Set the *type* property to use a different base mark type. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_density.py#L100) ``` python def density_x( data: Data, y: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, type: Literal["areaX", "lineX", "dotX", "textX"] | Param | None = None, stack: bool | Param | None = None, bandwidth: float | Param | None = None, bins: float | Param | None = None, normalize: bool | Literal["max", "sum", "none"] | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `type` Literal\['areaX', 'lineX', 'dotX', 'textX'\] \| [Param](inspect_viz.qmd#param) \| None The basic mark type to use to render 1D density values. Defaults to an areaX mark; lineX, dotX, and textX marks are also supported. `stack` bool \| [Param](inspect_viz.qmd#param) \| None Flag indicating if densities should be stacked. Defaults to `False`. `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels. `bins` float \| [Param](inspect_viz.qmd#param) \| None The number of bins over which to discretize the data prior to smoothing. Defaults to 1024. `normalize` bool \| Literal\['max', 'sum', 'none'\] \| [Param](inspect_viz.qmd#param) \| None Normalization method for density estimates. If `False` or `'none'` (the default), the density estimates are smoothed weighted counts. If `True` or `'sum'`, density estimates are divided by the sum of the total point mass. If `'max'`, estimates are divided by the maximum smoothed value. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### density_y A densityY mark that visualizes smoothed point cloud densities along the **y** dimension. The mark bins the data, counts the number of records that fall into each bin, smooths the resulting counts, and then plots the smoothed distribution, by default using an areaY mark. Set the *type* property to use a different base mark type. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_density.py#L156) ``` python def density_y( data: Data, x: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, type: Literal["areaY", "lineY", "dotY", "circle", "hexagon", "textY"] | Param | None = None, stack: bool | Param | None = None, bandwidth: float | Param | None = None, bins: float | Param | None = None, normalize: bool | Literal["max", "sum", "none"] | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `type` Literal\['areaY', 'lineY', 'dotY', 'circle', 'hexagon', 'textY'\] \| [Param](inspect_viz.qmd#param) \| None The basic mark type to use to render 1D density values. Defaults to an areaY mark; lineY, dotY, circle, hexagon, and textY marks are also supported. `stack` bool \| [Param](inspect_viz.qmd#param) \| None Flag indicating if densities should be stacked. Defaults to `False`. `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels. `bins` float \| [Param](inspect_viz.qmd#param) \| None The number of bins over which to discretize the data prior to smoothing. Defaults to 1024. `normalize` bool \| Literal\['max', 'sum', 'none'\] \| [Param](inspect_viz.qmd#param) \| None Normalization method for density estimates. If `False` or `'none'` (the default), the density estimates are smoothed weighted counts. If `True` or `'sum'`, density estimates are divided by the sum of the total point mass. If `'max'`, estimates are divided by the maximum smoothed value. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### contour Create a contour mark that draws contour lines of equal value. The contour mark creates isolines showing contours of equal value. It bins the given data into a 2D grid, computes density estimates, and draws contour lines at specified threshold levels. The contour mark is useful for visualizing the density or distribution of 2D point data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_contour.py#L14) ``` python def contour( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, filter_by: Selection | None = None, thresholds: float | list[float] | Param | None = None, bandwidth: float | Param | None = None, width: float | Param | None = None, height: float | Param | None = None, pixel_size: float | Param | None = None, pad: float | Param | None = None, interpolate: Interpolate | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. Domain values are binned into a grid with *width* horizontal bins. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. Domain values are binned into a grid with *height* vertical bins. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `thresholds` float \| list\[float\] \| [Param](inspect_viz.qmd#param) \| None The number of contour thresholds to subdivide the domain into discrete level sets; defaults to 10. Can be a count or an array of threshold values. `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels. `width` float \| [Param](inspect_viz.qmd#param) \| None The width (number of columns) of the grid, in actual pixels. `height` float \| [Param](inspect_viz.qmd#param) \| None The height (number of rows) of the grid, in actual pixels. `pixel_size` float \| [Param](inspect_viz.qmd#param) \| None The effective screen size of a raster pixel, used to determine the height and width of the raster from the frame’s dimensions; defaults to 1. `pad` float \| [Param](inspect_viz.qmd#param) \| None The bin padding, one of 1 (default) to include extra padding for the final bin, or 0 to make the bins flush with the maximum domain value. `interpolate` [Interpolate](inspect_viz.mark.qmd#interpolate) \| [Param](inspect_viz.qmd#param) \| None The spatial interpolation method; one of: - *none* - do not perform interpolation (the default) - *linear* - apply proportional linear interpolation across adjacent bins - *nearest* - assign each pixel to the closest sample’s value (Voronoi diagram) - *barycentric* - apply barycentric interpolation over the Delaunay triangulation - *random-walk* - apply a random walk from each pixel `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### regression_y A vertical regression mark. The regressionY mark draws a regression line with optional confidence bands showing the relationship between variables. The x variable is the independent variable and y is the dependent variable. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_regression.py#L13) ``` python def regression_y( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, ci: float | Param | None = None, precision: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The independent variable horizontal position channel (defaults to zero-based index). `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The dependent variable vertical position channel (defaults to identity function). `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series, producing independent regressions for each group. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `ci` float \| [Param](inspect_viz.qmd#param) \| None The confidence interval in (0, 1), or 0 to hide bands; defaults to 0.95. `precision` float \| [Param](inspect_viz.qmd#param) \| None The distance in pixels between samples of the confidence band; defaults to 4. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### error_bar_x A horizontal error bar mark. The errorBarX mark draws horizontal error bars showing confidence intervals or uncertainty around data points. The error bars extend horizontally from the central value. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_error_bar.py#L14) ``` python def error_bar_x( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param | None = None, ci: float | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The dependent variable horizontal position channel (required). `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The independent variable vertical position channel (optional). `ci` float \| [Param](inspect_viz.qmd#param) \| None The confidence interval in (0, 1); defaults to 0.95. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at all positions along the error bar. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the start of the error bar. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the middle of the error bar. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the end of the error bar. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### error_bar_y A vertical error bar mark. The errorBarY mark draws vertical error bars showing confidence intervals or uncertainty around data points. The error bars extend vertically from the central value. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_error_bar.py#L62) ``` python def error_bar_y( data: Data, y: ChannelSpec | Param, x: ChannelSpec | Param | None = None, ci: float | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The dependent variable vertical position channel (required). `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The independent variable horizontal position channel (optional). `ci` float \| [Param](inspect_viz.qmd#param) \| None The confidence interval in (0, 1); defaults to 0.95. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at all positions along the error bar. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the start of the error bar. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the middle of the error bar. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the end of the error bar. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ## Grid ### cell A cell mark that draws axis-aligned rectangles for categorical data. Cells are typically used to create heatmaps and other grid-based visualizations where both x and y represent categorical or ordinal data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_cell.py#L13) ``` python def cell( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, filter_by: Selection | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage of the cell width. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage of the cell height. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### cell_x A cellX mark that draws axis-aligned rectangles with ordinal positioning. The *x* values should be ordinal (categories), and the optional *y* values should also be ordinal. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_cell.py#L67) ``` python def cell_x( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, filter_by: Selection | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage of the cell width. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage of the cell height. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### cell_y A cellY mark that draws axis-aligned rectangles with ordinal positioning. The *y* values should be ordinal (categories), and the optional *x* values should also be ordinal. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_cell.py#L120) ``` python def cell_y( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, filter_by: Selection | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage of the cell width. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage of the cell height. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### grid_x A horizontal grid mark. The gridX mark draws horizontal grid lines across the plot area. It is primarily used for adding visual reference lines along the x-axis. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_grid.py#L14) ``` python def grid_x( x: ChannelSpec | Param | None = None, y: ChannelIntervalSpec | None = None, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, interval: Interval | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| None Shorthand for specifying both the primary and secondary vertical position of the tick as the bounds of the containing interval; can only be used in conjunction with the **interval** option. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The primary (starting, often bottom) vertical position of the grid line. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The secondary (ending, often top) vertical position of the grid line. `interval` Interval \| None How to convert a continuous value into an interval. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the grid (*top* or *bottom*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions` (including stroke, stroke_width, stroke_opacity, stroke_dasharray). ### grid_y A vertical grid mark. The gridY mark draws vertical grid lines across the plot area. It is primarily used for adding visual reference lines along the y-axis. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_grid.py#L60) ``` python def grid_y( y: ChannelSpec | Param | None = None, x: ChannelIntervalSpec | None = None, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, interval: Interval | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, inset_left: float | Param | None = None, inset_right: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| None Shorthand for specifying both the primary and secondary horizontal position of the tick as the bounds of the containing interval; can only be used in conjunction with the **interval** option. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The primary (starting, often left) horizontal position of the grid line. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The secondary (ending, often right) horizontal position of the grid line. `interval` Interval \| None How to convert a continuous value into an interval. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the grid (*left* or *right*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions` (including stroke, stroke_width, stroke_opacity, stroke_dasharray). ### grid_fx A horizontal facet grid mark. The gridFx mark draws horizontal grid lines for faceted plots. It is primarily used for adding visual reference lines along the fx-axis in faceted visualizations. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_grid.py#L112) ``` python def grid_fx( x: ChannelSpec | Param | None = None, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, interval: Interval | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The primary (starting, often bottom) vertical position of the grid line. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The secondary (ending, often top) vertical position of the grid line. `interval` Interval \| None How to convert a continuous value into an interval. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the grid (*top* or *bottom*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions` (including stroke, stroke_width, stroke_opacity, stroke_dasharray). ### grid_fy A vertical facet grid mark. The gridFy mark draws vertical grid lines for faceted plots. It is primarily used for adding visual reference lines along the fy-axis in faceted visualizations. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_grid.py#L155) ``` python def grid_fy( y: ChannelSpec | Param | None = None, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, interval: Interval | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, inset_left: float | Param | None = None, inset_right: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The primary (starting, often left) horizontal position of the grid line. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The secondary (ending, often right) horizontal position of the grid line. `interval` Interval \| None How to convert a continuous value into an interval. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the grid (*left* or *right*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions` (including stroke, stroke_width, stroke_opacity, stroke_dasharray). ### hexbin Create a hexbin mark for hexagonal binning of point data. The hexbin mark bins two-dimensional point data into hexagonal bins and displays aggregated values for each bin. This is useful for visualizing density patterns in large datasets and for creating hexagonal heatmaps. The mark creates a hexagonal grid and counts or aggregates data points within each hexagon, then renders the results using the specified mark type. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_hexbin.py#L15) ``` python def hexbin( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, bin_width: float | Param | None = None, type: Literal["hexagon", "dot", "text"] | Param | None = None, r: ChannelSpec | float | Param | None = None, rotate: ChannelSpec | float | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, styles: TextStyles | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. Specifies the data to be binned horizontally. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. Specifies the data to be binned vertically. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None How to subdivide bins. Defaults to the *fill* channel, if any, or the *stroke* channel, if any. If null, bins will not be subdivided. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `bin_width` float \| [Param](inspect_viz.qmd#param) \| None The distance between centers of neighboring hexagons, in pixels; defaults to 20. `type` Literal\['hexagon', 'dot', 'text'\] \| [Param](inspect_viz.qmd#param) \| None The basic mark type to use for hex-binned values. Defaults to a hexagon mark; dot and text marks are also supported. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius of dots or hexagons; either a channel or constant. `rotate` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor position for legend placement. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None Text styles to apply when using text mark type. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### hexgrid Create a hexgrid mark that displays a hexagonal grid overlay. The hexgrid mark creates a hexagonal grid pattern, typically used as a background or reference grid for hexbin visualizations. This is a decoration mark that shows the underlying hexagonal structure without requiring data. The hexgrid mark is designed to complement hexbin marks by showing the grid structure. It’s a stroke-only mark where fill is not supported. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_hexgrid.py#L11) ``` python def hexgrid( bin_width: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `bin_width` float \| [Param](inspect_viz.qmd#param) \| None The distance between centers of neighboring hexagons, in pixels; defaults to 20. Should match the bin_width of any corresponding hexbin mark for proper alignment. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. Note that this is a stroke-only mark, so fill options will not be effective. ### waffle_x A waffleX mark that creates horizontal waffle charts. Waffle charts are a form of unit chart where data is represented as a grid of small squares or rectangles, useful for showing part-to-whole relationships and making proportions more tangible. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_waffle.py#L14) ``` python def waffle_x( data: Data, x: ChannelIntervalSpec | Param, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y: ChannelIntervalSpec | Param | None = None, z: ChannelSpec | Param | None = None, filter_by: Selection | None = None, multiple: float | Param | None = None, unit: float | Param | None = None, gap: float | Param | None = None, round: bool | Param | None = None, interval: Interval | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting horizontal position channel, typically bound to the *x* scale. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending horizontal position channel, typically bound to the *x* scale. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `z` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The **z** channel defines the series of each value in the stack. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `multiple` float \| [Param](inspect_viz.qmd#param) \| None The number of units per tile; defaults to 1. `unit` float \| [Param](inspect_viz.qmd#param) \| None The size of each unit in the waffle; defaults to 1. `gap` float \| [Param](inspect_viz.qmd#param) \| None The gap between waffle units; defaults to 1. `round` bool \| [Param](inspect_viz.qmd#param) \| None Whether to round values to the nearest unit; defaults to false. `interval` Interval \| None How to convert a continuous value into an interval. `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### waffle_y A waffleY mark that creates vertical waffle charts. Waffle charts are a form of unit chart where data is represented as a grid of small squares or rectangles, useful for showing part-to-whole relationships and making proportions more tangible. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_waffle.py#L103) ``` python def waffle_y( data: Data, y: ChannelSpec | Param, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, x: ChannelSpec | Param | None = None, z: ChannelSpec | Param | None = None, filter_by: Selection | None = None, multiple: float | Param | None = None, unit: float | Param | None = None, gap: float | Param | None = None, round: bool | Param | None = None, interval: Interval | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting vertical position channel, typically bound to the *y* scale. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending vertical position channel, typically bound to the *y* scale. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `z` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The **z** channel defines the series of each value in the stack. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `multiple` float \| [Param](inspect_viz.qmd#param) \| None The number of units per tile; defaults to 1. `unit` float \| [Param](inspect_viz.qmd#param) \| None The size of each unit in the waffle; defaults to 1. `gap` float \| [Param](inspect_viz.qmd#param) \| None The gap between waffle units; defaults to 1. `round` bool \| [Param](inspect_viz.qmd#param) \| None Whether to round values to the nearest unit; defaults to false. `interval` Interval \| None How to convert a continuous value into an interval. `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ## Specialized ### raster Create a raster mark for spatial samples with optional interpolation and smoothing. The raster mark bins spatial data into a raster grid and optionally applies spatial interpolation and kernel density smoothing. The raster mark is useful for visualizing continuous spatial phenomena from discrete sample points. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_raster.py#L14) ``` python def raster( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, filter_by: Selection | None = None, width: float | Param | None = None, height: float | Param | None = None, pixel_size: float | Param | None = None, pad: float | Param | None = None, interpolate: Interpolate | Param | None = None, bandwidth: float | Param | None = None, image_rendering: str | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. Domain values are binned into a grid with *width* horizontal bins. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. Domain values are binned into a grid with *height* vertical bins. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `width` float \| [Param](inspect_viz.qmd#param) \| None The width (number of columns) of the grid, in actual pixels. `height` float \| [Param](inspect_viz.qmd#param) \| None The height (number of rows) of the grid, in actual pixels. `pixel_size` float \| [Param](inspect_viz.qmd#param) \| None The effective screen size of a raster pixel, used to determine the height and width of the raster from the frame’s dimensions; defaults to 1. `pad` float \| [Param](inspect_viz.qmd#param) \| None The bin padding, one of 1 (default) to include extra padding for the final bin, or 0 to make the bins flush with the maximum domain value. `interpolate` [Interpolate](inspect_viz.mark.qmd#interpolate) \| [Param](inspect_viz.qmd#param) \| None The spatial interpolation method; one of: - *none* - do not perform interpolation (the default) - *linear* - apply proportional linear interpolation across adjacent bins - *nearest* - assign each pixel to the closest sample’s value (Voronoi diagram) - *barycentric* - apply barycentric interpolation over the Delaunay triangulation - *random-walk* - apply a random walk from each pixel `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels. `image_rendering` str \| [Param](inspect_viz.qmd#param) \| None The image-rendering attribute; defaults to *auto* (bilinear). May be set to *pixelated* to disable bilinear interpolation for a sharper image. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### raster_tile Create an experimental raster tile mark with tiling and prefetching for scalable rasters. The rasterTile mark is an experimental version of the raster mark that supports tiling and prefetching for better performance with large datasets. It provides scalable raster visualization with efficient memory usage. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_raster.py#L144) ``` python def raster_tile( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, filter_by: Selection | None = None, origin: list[float] | Param | None = None, width: float | Param | None = None, height: float | Param | None = None, pixel_size: float | Param | None = None, pad: float | Param | None = None, interpolate: Interpolate | Param | None = None, bandwidth: float | Param | None = None, image_rendering: str | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. Domain values are binned into a grid with *width* horizontal bins. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. Domain values are binned into a grid with *height* vertical bins. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `origin` list\[float\] \| [Param](inspect_viz.qmd#param) \| None The coordinates of the tile origin in the x and y data domains; defaults to \[0, 0\]. `width` float \| [Param](inspect_viz.qmd#param) \| None The width (number of columns) of the grid, in actual pixels. `height` float \| [Param](inspect_viz.qmd#param) \| None The height (number of rows) of the grid, in actual pixels. `pixel_size` float \| [Param](inspect_viz.qmd#param) \| None The effective screen size of a raster pixel, used to determine the height and width of the raster from the frame’s dimensions; defaults to 1. `pad` float \| [Param](inspect_viz.qmd#param) \| None The bin padding, one of 1 (default) to include extra padding for the final bin, or 0 to make the bins flush with the maximum domain value. `interpolate` [Interpolate](inspect_viz.mark.qmd#interpolate) \| [Param](inspect_viz.qmd#param) \| None The spatial interpolation method; one of: - *none* - do not perform interpolation (the default) - *linear* - apply proportional linear interpolation across adjacent bins - *nearest* - assign each pixel to the closest sample’s value (Voronoi diagram) - *barycentric* - apply barycentric interpolation over the Delaunay triangulation - *random-walk* - apply a random walk from each pixel `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels. `image_rendering` str \| [Param](inspect_viz.qmd#param) \| None The image-rendering attribute; defaults to *auto* (bilinear). May be set to *pixelated* to disable bilinear interpolation for a sharper image. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### vector A vector mark that draws arrows or other directional shapes. Vectors are typically used to represent direction and magnitude in data, such as wind vectors, force fields, or gradients. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_vector.py#L14) ``` python def vector( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, r: ChannelSpec | float | Param | None = None, filter_by: Selection | None = None, length: ChannelSpec | float | Param | None = None, rotate: Channel | float | Param | None = None, shape: Literal["arrow", "spike"] | Param | None = None, anchor: Literal["start", "middle", "end"] | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius or magnitude channel; either a constant or a channel. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `length` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The length of the vector; either a constant or a channel. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise; either a constant or a channel. `shape` Literal\['arrow', 'spike'\] \| [Param](inspect_viz.qmd#param) \| None The shape of the vector; one of “arrow” or “spike”. `anchor` Literal\['start', 'middle', 'end'\] \| [Param](inspect_viz.qmd#param) \| None The anchor position; one of “start”, “middle”, or “end”. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor position for legend placement. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### vector_x A vectorX mark that draws horizontal directional vectors. VectorX marks are oriented primarily along the x-axis and are useful for showing horizontal flow or direction. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_vector.py#L65) ``` python def vector_x( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, r: ChannelSpec | float | Param | None = None, filter_by: Selection | None = None, length: ChannelSpec | float | Param | None = None, rotate: Channel | float | Param | None = None, shape: Literal["arrow", "spike"] | Param | None = None, anchor: Literal["start", "middle", "end"] | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius or magnitude channel; either a constant or a channel. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `length` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The length of the vector; either a constant or a channel. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise; either a constant or a channel. `shape` Literal\['arrow', 'spike'\] \| [Param](inspect_viz.qmd#param) \| None The shape of the vector; one of “arrow” or “spike”. `anchor` Literal\['start', 'middle', 'end'\] \| [Param](inspect_viz.qmd#param) \| None The anchor position; one of “start”, “middle”, or “end”. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor position for legend placement. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### vector_y A vectorY mark that draws vertical directional vectors. VectorY marks are oriented primarily along the y-axis and are useful for showing vertical flow or direction. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_vector.py#L116) ``` python def vector_y( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, r: ChannelSpec | float | Param | None = None, filter_by: Selection | None = None, length: ChannelSpec | float | Param | None = None, rotate: Channel | float | Param | None = None, shape: Literal["arrow", "spike"] | Param | None = None, anchor: Literal["start", "middle", "end"] | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius or magnitude channel; either a constant or a channel. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `length` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The length of the vector; either a constant or a channel. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise; either a constant or a channel. `shape` Literal\['arrow', 'spike'\] \| [Param](inspect_viz.qmd#param) \| None The shape of the vector; one of “arrow” or “spike”. `anchor` Literal\['start', 'middle', 'end'\] \| [Param](inspect_viz.qmd#param) \| None The anchor position; one of “start”, “middle”, or “end”. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor position for legend placement. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### spike A spike mark that draws spike-shaped directional indicators. Spikes are a specialized type of vector that typically appear as thin lines or needles, useful for showing precise directional data or impulses. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_vector.py#L167) ``` python def spike( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, r: ChannelSpec | float | Param | None = None, length: ChannelSpec | float | Param | None = None, rotate: Channel | float | Param | None = None, shape: Literal["arrow", "spike"] | Param | None = None, anchor: Literal["start", "middle", "end"] | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, filter_by: Selection | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius or magnitude channel; either a constant or a channel. `length` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The length of the spike; either a constant or a channel. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise; either a constant or a channel. `shape` Literal\['arrow', 'spike'\] \| [Param](inspect_viz.qmd#param) \| None The shape of the spike; one of “arrow” or “spike”. `anchor` Literal\['start', 'middle', 'end'\] \| [Param](inspect_viz.qmd#param) \| None The anchor position; one of “start”, “middle”, or “end”. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor position for legend placement. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### arrow An arrow mark. The arrow mark draws arrows between two points, with customizable arrowheads and curved paths. It is useful for indicating direction, flow, or relationships between data points. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_arrow.py#L13) ``` python def arrow( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, x1: ChannelSpec | Param | None = None, y1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, filter_by: Selection | None = None, bend: float | bool | Param | None = None, head_angle: float | Param | None = None, head_length: float | Param | None = None, inset: float | Param | None = None, inset_start: float | Param | None = None, inset_end: float | Param | None = None, sweep: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, shorthand for both x1 and x2. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, shorthand for both y1 and y2. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting horizontal position of the arrow. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting vertical position of the arrow. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending horizontal position of the arrow. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending vertical position of the arrow. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `bend` float \| bool \| [Param](inspect_viz.qmd#param) \| None The angle between straight line and outgoing tangent (±90°, use True for 22.5°). `head_angle` float \| [Param](inspect_viz.qmd#param) \| None How pointy the arrowhead is in degrees (0°-180°, defaults to 60°). `head_length` float \| [Param](inspect_viz.qmd#param) \| None Size of arrowhead relative to stroke width. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand for both inset_start and inset_end. `inset_start` float \| [Param](inspect_viz.qmd#param) \| None Starting inset in pixels (defaults to 0). `inset_end` float \| [Param](inspect_viz.qmd#param) \| None Ending inset in pixels (defaults to 0). `sweep` float \| [Param](inspect_viz.qmd#param) \| None Sweep order (1=clockwise, -1=anticlockwise, 0=no bend). `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### link Create a link mark that draws line segments between pairs of points. The link mark connects pairs of points with line segments. It supports both simple positioning using x and y (which serve as shorthand for x1/x2 and y1/y2), and explicit positioning using x1/y1 and x2/y2 coordinates for full control over link endpoints. For vertical links, specify **x** (or **x1** and **x2**) for the horizontal position and **y1** and **y2** for the vertical endpoints. For horizontal links, specify **y** (or **y1** and **y2**) for the vertical position and **x1** and **x2** for the horizontal endpoints. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_link.py#L14) ``` python def link( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, x1: ChannelSpec | Param | None = None, y1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position for vertical links; shorthand for x1 and x2. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position for horizontal links; shorthand for y1 and y2. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting horizontal position; also sets default for x2. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting vertical position; also sets default for y2. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending horizontal position; also sets default for x1. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending vertical position; also sets default for y1. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve interpolation method for connecting adjacent points. Recommended for links: *linear*, *step*, *step-after*, *step-before*, *bump-x*, *bump-y*. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option only has an effect on bundle, cardinal and Catmull–Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### delaunay_link Create a Delaunay link mark that draws links for each edge of the Delaunay triangulation. The delaunayLink mark computes the Delaunay triangulation of the data and draws a line segment for each edge of the triangulation. This is useful for visualizing spatial relationships and adjacencies in scattered point data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_delaunay.py#L14) ``` python def delaunay_link( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping to produce multiple (possibly overlapping) triangulations. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve interpolation method; defaults to *linear*. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option only has an effect on bundle, cardinal and Catmull–Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### delaunay_mesh Create a Delaunay mesh mark that draws a mesh of the Delaunay triangulation. The delaunayMesh mark computes the Delaunay triangulation of the data and draws filled triangular polygons for each triangle in the triangulation. This creates a continuous mesh surface useful for spatial interpolation and surface visualization. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_delaunay.py#L70) ``` python def delaunay_mesh( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping to produce multiple (possibly overlapping) triangulations. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve interpolation method; defaults to *linear*. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option only has an effect on bundle, cardinal and Catmull–Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### voronoi Create a Voronoi mark that draws polygons for each cell of the Voronoi tessellation. The voronoi mark computes the Voronoi tessellation (also known as Thiessen polygons) of the data points and draws filled polygons for each cell. Each cell contains all points that are closer to the cell’s generator point than to any other generator. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_delaunay.py#L182) ``` python def voronoi( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping to produce multiple tessellations. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve interpolation method; defaults to *linear*. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option only has an effect on bundle, cardinal and Catmull–Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### voronoi_mesh Create a Voronoi mesh mark that draws a mesh for the cell boundaries of the Voronoi tessellation. The voronoiMesh mark computes the Voronoi tessellation of the data points and draws line segments for the boundaries between cells. This creates a mesh of cell edges useful for visualizing the spatial partitioning without filled polygons. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_delaunay.py#L237) ``` python def voronoi_mesh( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping to produce multiple tessellations. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve interpolation method; defaults to *linear*. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option only has an effect on bundle, cardinal and Catmull–Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### hull Create a hull mark that draws a convex hull around points. The hull mark computes the convex hull of the data points and draws a polygon representing the smallest convex shape that contains all the points. This is useful for showing the overall extent or boundary of a point cloud. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_delaunay.py#L126) ``` python def hull( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param, z: Channel | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, curve: Curve | Param | None = None, tension: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping to produce multiple hulls; defaults to fill or stroke channel if not specified. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for marker_start, marker_mid, and marker_end. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the starting point of a line segment. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for any middle (interior) points of a line segment. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker for the ending point of a line segment. `curve` [Curve](inspect_viz.mark.qmd#curve) \| [Param](inspect_viz.qmd#param) \| None The curve interpolation method; defaults to *linear*. `tension` float \| [Param](inspect_viz.qmd#param) \| None The tension option only has an effect on bundle, cardinal and Catmull–Rom splines. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### dense_line Create a dense line mark that plots line densities rather than point densities. The denseLine mark forms a binned raster grid and “draws” straight lines into it, creating a density visualization of line segments rather than individual points. This is useful for visualizing the density of linear features, trajectories, or paths in spatial data. The mark bins the data into a 2D grid and renders density values as a raster image. Unlike traditional line marks that use curve interpolation, dense lines operate on a pixel grid to accumulate line density information. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_dense.py#L14) ``` python def dense_line( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, bandwidth: float | Param | None = None, normalize: bool | Param | None = None, interpolate: Interpolate | Param | None = None, width: float | Param | None = None, height: float | Param | None = None, pixel_size: float | Param | None = None, pad: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. Domain values are binned into a grid with *width* horizontal bins. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. Domain values are binned into a grid with *height* vertical bins. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An ordinal channel for grouping data into series to be drawn as separate lines. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `bandwidth` float \| [Param](inspect_viz.qmd#param) \| None The kernel density bandwidth for smoothing, in pixels. `normalize` bool \| [Param](inspect_viz.qmd#param) \| None Flag to perform approximate arc length normalization of line segments to prevent artifacts due to overcounting steep lines; defaults to True. `interpolate` [Interpolate](inspect_viz.mark.qmd#interpolate) \| [Param](inspect_viz.qmd#param) \| None The spatial interpolation method; one of: - *none* - do not perform interpolation (the default) - *linear* - apply proportional linear interpolation across adjacent bins - *nearest* - assign each pixel to the closest sample’s value (Voronoi diagram) - *barycentric* - apply barycentric interpolation over the Delaunay triangulation - *random-walk* - apply a random walk from each pixel `width` float \| [Param](inspect_viz.qmd#param) \| None The width (number of columns) of the grid, in actual pixels. `height` float \| [Param](inspect_viz.qmd#param) \| None The height (number of rows) of the grid, in actual pixels. `pixel_size` float \| [Param](inspect_viz.qmd#param) \| None The effective screen size of a raster pixel, used to determine the height and width of the raster from the frame’s dimensions; defaults to 1. `pad` float \| [Param](inspect_viz.qmd#param) \| None The bin padding, one of 1 (default) to include extra padding for the final bin, or 0 to make the bins flush with the maximum domain value. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. Note that fill and fillOpacity can use the special value “density” to map computed density values to visual properties. ## Decoration ### title Create a plot title mark. Adds a title at the top of the plot frame. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_title.py#L29) ``` python def title( title: str, margin_top: int = 15, font_size: float | None = 16, font_family: str | None = None, font_weight: float | None = None, ) -> Title ``` `title` str Title text. `margin_top` int Top margin fot title (defaults to 10 pixels). You may need to increase this if there are facet labels on the x-axis that the title needs to be placed above. `font_size` float \| None The font size in pixels (defaults to 14) `font_family` str \| None The font-family (defaults to the plot’s font family, which is typically *system-ui*”) `font_weight` float \| None The font weight (defaults to the plot’s font weight, which is typically 400.” ### frame Create a frame mark that draws a rectangular outline around the plot area. The frame mark draws a rectangular border around the plot’s frame area. By default, it draws a complete rectangular outline, but when an anchor is specified, it draws only a line on the given side (ignoring rx, ry, fill, and fillOpacity). The frame mark is commonly used for visual separation of facets, providing backgrounds for plot areas, or creating borders around visualizations. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_frame.py#L11) ``` python def frame( anchor: Literal["top", "right", "bottom", "left"] | Param | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: str | float | Param | None = None, ry: str | float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `anchor` Literal\['top', 'right', 'bottom', 'left'\] \| [Param](inspect_viz.qmd#param) \| None Controls how the frame is drawn. If null (default), draws a complete rectangular outline. If specified, draws a line only on the given side (*top*, *right*, *bottom*, or *left*), ignoring rx, ry, fill, and fillOpacity. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it). `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it). `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it). `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it). `rx` str \| float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage of the frame width. If rx is not specified, it defaults to ry if present, and otherwise draws square corners. `ry` str \| float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage of the frame height. If ry is not specified, it defaults to rx if present, and otherwise draws square corners. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### axis_x A horizontal axis mark. The axisX mark draws a horizontal axis at the bottom or top of the plot (or both). It is primarily used for displaying scales and reference lines along the x-axis. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_axis.py#L16) ``` python def axis_x( x: ChannelSpec | Param | None = None, interval: Interval | None = None, text: ChannelSpec | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, line_anchor: str | Param | None = None, rotate: ChannelSpec | float | Param | None = None, text_stroke: ChannelSpec | Param | None = None, text_stroke_opacity: ChannelSpec | float | Param | None = None, text_stroke_width: ChannelSpec | float | Param | None = None, styles: TextStyles | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, tick_size: float | Param | None = None, tick_padding: float | Param | None = None, tick_format: str | Param | None = None, tick_rotate: float | Param | None = None, label: str | Param | None = None, label_offset: float | Param | None = None, label_anchor: str | Param | None = None, label_arrow: str | bool | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `interval` Interval \| None How to convert a continuous value into an interval. `text` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The text channel for tick labels. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame. `line_anchor` str \| [Param](inspect_viz.qmd#param) \| None The line anchor controls how text is aligned relative to its anchor point. `rotate` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of the axis in degrees clockwise. `text_stroke` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The stroke color for text labels. `text_stroke_opacity` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke opacity for text labels. `text_stroke_width` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke width for text labels. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None `TextStyles` to apply to axis text. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the axis (*top* or *bottom*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of tick marks in pixels. `tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between the tick mark and its label in pixels. `tick_format` str \| [Param](inspect_viz.qmd#param) \| None A d3-format string for formatting tick labels. `tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of tick labels in degrees clockwise. `label` str \| [Param](inspect_viz.qmd#param) \| None The axis label text. `label_offset` float \| [Param](inspect_viz.qmd#param) \| None The distance between the axis and its label in pixels. `label_anchor` str \| [Param](inspect_viz.qmd#param) \| None The label anchor position. `label_arrow` str \| bool \| [Param](inspect_viz.qmd#param) \| None Whether to show an arrow on the axis label. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### axis_y A vertical axis mark. The axisY mark draws a vertical axis at the left or right of the plot (or both). It is primarily used for displaying scales and reference lines along the y-axis. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_axis.py#L101) ``` python def axis_y( y: ChannelSpec | Param | None = None, interval: Interval | None = None, text: ChannelSpec | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, line_anchor: str | Param | None = None, rotate: ChannelSpec | float | Param | None = None, text_stroke: ChannelSpec | Param | None = None, text_stroke_opacity: ChannelSpec | float | Param | None = None, text_stroke_width: ChannelSpec | float | Param | None = None, styles: TextStyles | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, tick_size: float | Param | None = None, tick_padding: float | Param | None = None, tick_format: str | Param | None = None, tick_rotate: float | Param | None = None, label: str | Param | None = None, label_offset: float | Param | None = None, label_anchor: str | Param | None = None, label_arrow: str | bool | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `interval` Interval \| None How to convert a continuous value into an interval. `text` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The text channel for tick labels. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame. `line_anchor` str \| [Param](inspect_viz.qmd#param) \| None The line anchor controls how text is aligned relative to its anchor point. `rotate` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of the axis in degrees clockwise. `text_stroke` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The stroke color for text labels. `text_stroke_opacity` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke opacity for text labels. `text_stroke_width` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke width for text labels. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None `TextStyles` to apply to axis text. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the axis (*left* or *right*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of tick marks in pixels. `tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between the tick mark and its label in pixels. `tick_format` str \| [Param](inspect_viz.qmd#param) \| None A d3-format string for formatting tick labels. `tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of tick labels in degrees clockwise. `label` str \| [Param](inspect_viz.qmd#param) \| None The axis label text. `label_offset` float \| [Param](inspect_viz.qmd#param) \| None The distance between the axis and its label in pixels. `label_anchor` str \| [Param](inspect_viz.qmd#param) \| None The label anchor position. `label_arrow` str \| bool \| [Param](inspect_viz.qmd#param) \| None Whether to show an arrow on the axis label. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### axis_fx A horizontal facet axis mark. The axisFx mark draws a horizontal axis for faceted plots. It is primarily used for displaying scales and reference lines along the fx-axis in faceted visualizations. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_axis.py#L186) ``` python def axis_fx( x: ChannelSpec | Param | None = None, interval: Interval | None = None, text: ChannelSpec | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, line_anchor: str | Param | None = None, rotate: ChannelSpec | float | Param | None = None, text_stroke: ChannelSpec | Param | None = None, text_stroke_opacity: ChannelSpec | float | Param | None = None, text_stroke_width: ChannelSpec | float | Param | None = None, styles: TextStyles | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, tick_size: float | Param | None = None, tick_padding: float | Param | None = None, tick_format: str | Param | None = None, tick_rotate: float | Param | None = None, label: str | Param | None = None, label_offset: float | Param | None = None, label_anchor: str | Param | None = None, label_arrow: str | bool | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `interval` Interval \| None How to convert a continuous value into an interval. `text` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The text channel for tick labels. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame. `line_anchor` str \| [Param](inspect_viz.qmd#param) \| None The line anchor controls how text is aligned relative to its anchor point. `rotate` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of the axis in degrees clockwise. `text_stroke` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The stroke color for text labels. `text_stroke_opacity` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke opacity for text labels. `text_stroke_width` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke width for text labels. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None `TextStyles` to apply to axis text. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the axis (*top* or *bottom*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of tick marks in pixels. `tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between the tick mark and its label in pixels. `tick_format` str \| [Param](inspect_viz.qmd#param) \| None A d3-format string for formatting tick labels. `tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of tick labels in degrees clockwise. `label` str \| [Param](inspect_viz.qmd#param) \| None The axis label text. `label_offset` float \| [Param](inspect_viz.qmd#param) \| None The distance between the axis and its label in pixels. `label_anchor` str \| [Param](inspect_viz.qmd#param) \| None The label anchor position. `label_arrow` str \| bool \| [Param](inspect_viz.qmd#param) \| None Whether to show an arrow on the axis label. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### axis_fy A vertical facet axis mark. The axisFy mark draws a vertical axis for faceted plots. It is primarily used for displaying scales and reference lines along the fy-axis in faceted visualizations. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_axis.py#L271) ``` python def axis_fy( y: ChannelSpec | Param | None = None, interval: Interval | None = None, text: ChannelSpec | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, line_anchor: str | Param | None = None, rotate: ChannelSpec | float | Param | None = None, text_stroke: ChannelSpec | Param | None = None, text_stroke_opacity: ChannelSpec | float | Param | None = None, text_stroke_width: ChannelSpec | float | Param | None = None, styles: TextStyles | None = None, anchor: str | Param | None = None, color: ChannelSpec | str | Param | None = None, ticks: int | Sequence[Any] | Param | None = None, tick_spacing: float | Param | None = None, tick_size: float | Param | None = None, tick_padding: float | Param | None = None, tick_format: str | Param | None = None, tick_rotate: float | Param | None = None, label: str | Param | None = None, label_offset: float | Param | None = None, label_anchor: str | Param | None = None, label_arrow: str | bool | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `interval` Interval \| None How to convert a continuous value into an interval. `text` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The text channel for tick labels. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y** based on the plot’s frame. `line_anchor` str \| [Param](inspect_viz.qmd#param) \| None The line anchor controls how text is aligned relative to its anchor point. `rotate` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of the axis in degrees clockwise. `text_stroke` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The stroke color for text labels. `text_stroke_opacity` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke opacity for text labels. `text_stroke_width` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The stroke width for text labels. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None `TextStyles` to apply to axis text. `anchor` str \| [Param](inspect_viz.qmd#param) \| None The side of the frame on which to place the axis (*left* or *right*). `color` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| str \| [Param](inspect_viz.qmd#param) \| None Shorthand for setting both fill and stroke color. `ticks` int \| Sequence\[Any\] \| [Param](inspect_viz.qmd#param) \| None The desired number of ticks, or an array of tick values, or null to disable ticks. `tick_spacing` float \| [Param](inspect_viz.qmd#param) \| None The desired spacing between ticks in pixels. `tick_size` float \| [Param](inspect_viz.qmd#param) \| None The length of tick marks in pixels. `tick_padding` float \| [Param](inspect_viz.qmd#param) \| None The distance between the tick mark and its label in pixels. `tick_format` str \| [Param](inspect_viz.qmd#param) \| None A d3-format string for formatting tick labels. `tick_rotate` float \| [Param](inspect_viz.qmd#param) \| None The rotation angle of tick labels in degrees clockwise. `label` str \| [Param](inspect_viz.qmd#param) \| None The axis label text. `label_offset` float \| [Param](inspect_viz.qmd#param) \| None The distance between the axis and its label in pixels. `label_anchor` str \| [Param](inspect_viz.qmd#param) \| None The label anchor position. `label_arrow` str \| bool \| [Param](inspect_viz.qmd#param) \| None Whether to show an arrow on the axis label. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### rule_x A ruleX mark that draws horizontal rule lines. RuleX marks are horizontal lines that span the full extent of the plot area, typically used for reference lines, grid lines, or highlighting specific values. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_rule.py#L15) ``` python def rule_x( data: Data | None = None, x: ChannelSpec | Param | None = None, y: ChannelIntervalSpec | Param | None = None, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, filter_by: Selection | None = None, interval: Interval | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, inset: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) \| None The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The primary (starting, often bottom) vertical position of the tick; a channel bound to the *y* scale. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The secondary (ending, often top) vertical position of the tick; a channel bound to the *y* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `interval` Interval \| None How to convert a continuous value into an interval. `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at all positions along the rule. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the start of the rule. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the middle of the rule. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the end of the rule. `inset` float \| [Param](inspect_viz.qmd#param) \| None Set top and bottom insets. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### rule_y A ruleY mark that draws vertical rule lines. RuleY marks are vertical lines that span the full extent of the plot area, typically used for reference lines, grid lines, or highlighting specific values. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_rule.py#L72) ``` python def rule_y( data: Data | None = None, y: ChannelSpec | Param | None = None, x: ChannelIntervalSpec | Param | None = None, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, filter_by: Selection | None = None, interval: Interval | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, inset: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) \| None The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The primary (starting, often left) horizontal position of the tick; a channel bound to the *x* scale. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The secondary (ending, often right) horizontal position of the tick; a channel bound to the *x* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `interval` Interval \| None How to convert a continuous value into an interval. `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at all positions along the rule. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the start of the rule. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the middle of the rule. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the end of the rule. `inset` float \| [Param](inspect_viz.qmd#param) \| None Set left and right insets. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### tick_x A tickX mark that draws horizontal tick marks. TickX marks are horizontal lines typically used for marking positions along the x-axis or creating horizontal reference lines. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_tick.py#L15) ``` python def tick_x( data: Data, x: ChannelSpec | Param, y: ChannelSpec | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_bottom: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at all positions along the tick. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the start of the tick. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the middle of the tick. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the end of the tick. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for top and bottom insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### tick_y A tickY mark that draws vertical tick marks. TickY marks are vertical lines typically used for marking positions along the y-axis or creating vertical reference lines. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_tick.py#L69) ``` python def tick_y( data: Data, y: ChannelSpec | Param, x: ChannelSpec | Param | None = None, filter_by: Selection | None = None, marker: Marker | bool | Param | None = None, marker_start: Marker | bool | Param | None = None, marker_mid: Marker | bool | Param | None = None, marker_end: Marker | bool | Param | None = None, inset: float | Param | None = None, inset_left: float | Param | None = None, inset_right: float | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel, typically bound to the *y* scale. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `marker` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at all positions along the tick. `marker_start` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the start of the tick. `marker_mid` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the middle of the tick. `marker_end` [Marker](inspect_viz.mark.qmd#marker) \| bool \| [Param](inspect_viz.qmd#param) \| None The marker symbol to use at the end of the tick. `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for left and right insets. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### rect A rect mark that draws axis-aligned rectangles. Both *x* and *y* should be quantitative or temporal; rect does not perform grouping, so use rectX or rectY for ordinal data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_rect.py#L15) ``` python def rect( data: Data, x: ChannelIntervalSpec | Param | None = None, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y: ChannelIntervalSpec | Param | None = None, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, interval: Interval | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting horizontal position channel, typically bound to the *x* scale. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending horizontal position channel, typically bound to the *x* scale. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting vertical position channel, typically bound to the *y* scale. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The **z** channel defines the series of each value in the stack `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `interval` Interval \| None How to convert a continuous value into an interval; one of: - a named time interval such as *day* (for date intervals) - a number (for number intervals), defining intervals at integer multiples of *n* `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage of the rect width. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage of the rect height. `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### rect_x A rectX mark that draws axis-aligned rectangles. The *x* values should be quantitative or temporal, and the optional *y* values should be ordinal. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_rect.py#L104) ``` python def rect_x( data: Data, x: ChannelSpec | Param | None = None, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y: ChannelIntervalSpec | Param | None = None, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, interval: Interval | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting horizontal position channel, typically bound to the *x* scale. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending horizontal position channel, typically bound to the *x* scale. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting vertical position channel, typically bound to the *y* scale. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The **z** channel defines the series of each value in the stack. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `interval` Interval \| None How to convert a continuous value into an interval; one of: - a named time interval such as *day* (for date intervals) - a number (for number intervals), defining intervals at integer multiples of *n* `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage of the rect width. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage of the rect height. `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### rect_y A rectY mark that draws axis-aligned rectangles. The *y* values should be quantitative or temporal, and the optional *x* values should be ordinal. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_rect.py#L192) ``` python def rect_y( data: Data, x: ChannelIntervalSpec | Param | None = None, x1: ChannelSpec | Param | None = None, x2: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, y1: ChannelSpec | Param | None = None, y2: ChannelSpec | Param | None = None, z: Channel | Param | None = None, filter_by: Selection | None = None, interval: Interval | None = None, inset: float | Param | None = None, inset_top: float | Param | None = None, inset_right: float | Param | None = None, inset_bottom: float | Param | None = None, inset_left: float | Param | None = None, rx: float | Param | None = None, ry: float | Param | None = None, offset: Literal["center", "normalize", "wiggle"] | Param | None = None, order: Literal["value", "x", "y", "z", "sum", "appearance", "inside-out"] | str | Sequence[float | bool] | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting horizontal position channel, typically bound to the *x* scale. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The starting vertical position channel, typically bound to the *y* scale. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The ending vertical position channel, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The **z** channel defines the series of each value in the stack. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data. `interval` Interval \| None How to convert a continuous value into an interval; one of: - a named time interval such as *day* (for date intervals) - a number (for number intervals), defining intervals at integer multiples of *n* `inset` float \| [Param](inspect_viz.qmd#param) \| None Shorthand to set the same default for all four insets. `inset_top` float \| [Param](inspect_viz.qmd#param) \| None Insets the top edge by the specified number of pixels. `inset_right` float \| [Param](inspect_viz.qmd#param) \| None Insets the right edge by the specified number of pixels. `inset_bottom` float \| [Param](inspect_viz.qmd#param) \| None Insets the bottom edge by the specified number of pixels. `inset_left` float \| [Param](inspect_viz.qmd#param) \| None Insets the left edge by the specified number of pixels. `rx` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner x-radius, either in pixels or as a percentage of the rect width. `ry` float \| [Param](inspect_viz.qmd#param) \| None The rounded corner y-radius, either in pixels or as a percentage of the rect height. `offset` Literal\['center', 'normalize', 'wiggle'\] \| [Param](inspect_viz.qmd#param) \| None After stacking, an optional **offset** can be applied to translate and scale stacks. `order` Literal\['value', 'x', 'y', 'z', 'sum', 'appearance', 'inside-out'\] \| str \| Sequence\[float \| bool\] \| [Param](inspect_viz.qmd#param) \| None The order in which stacks are layered; one of: - null (default) for input order - a named stack order method such as *inside-out* or *sum* - a field name, for natural order of the corresponding values - a function of data, for natural order of the corresponding values - an array of explicit **z** values in the desired order `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ### text A text mark that displays textual labels. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_text.py#L18) ``` python def text( data: Data | None = None, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, z: Channel | Param | None = None, text: Channel | Param | None = None, filter_by: Selection | None = None, frame_anchor: FrameAnchor | Param | None = None, line_anchor: LineAnchor | Param | None = None, rotate: Channel | float | Param | None = None, styles: TextStyles | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) \| None The data source for the mark (not required if not binding `text` to a column). `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel specifying the text’s anchor point, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel specifying the text’s anchor point, typically bound to the *y* scale. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `text` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The text contents channel, possibly with line breaks (, , or . To place a single piece of text specify the text as a string\[\] (e.g. `["My Text"]`). `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y**, along with **textAnchor** and **lineAnchor**, based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `line_anchor` [LineAnchor](inspect_viz.mark.qmd#lineanchor) \| [Param](inspect_viz.qmd#param) \| None The line anchor controls how text is aligned (typically vertically) relative to its anchor point; it is one of *top*, *bottom*, or *middle*. If the frame anchor is *top*, *top-left*, or *top-right*, the default line anchor is *top*; if the frame anchor is *bottom*, *bottom-right*, or *bottom-left*, the default is *bottom*; otherwise it is *middle*. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise; a constant or a channel; defaults to 0°. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None `TextStyles` to apply. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### text_x A horizontal text mark that displays textual labels. Like text, except that **y** defaults to the zero-based index of the data \[0, 1, 2, …\]. If an **interval** is specified, such as *day*, **y** is transformed to the middle of the interval. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_text.py#L63) ``` python def text_x( data: Data | None, x: ChannelSpec | Param, y: ChannelIntervalSpec | Param | None = None, z: Channel | Param | None = None, text: Channel | Param | None = None, interval: Interval | Param | None = None, filter_by: Selection | None = None, frame_anchor: FrameAnchor | Param | None = None, line_anchor: LineAnchor | Param | None = None, rotate: Channel | float | Param | None = None, styles: TextStyles | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) \| None The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The horizontal position channel specifying the text’s anchor point, typically bound to the *x* scale. `y` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel specifying the text’s anchor point, typically bound to the *y* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `text` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The text contents channel, possibly with line breaks (, , or . If not specified, defaults to the zero-based index \[0, 1, 2, …\]. `interval` Interval \| [Param](inspect_viz.qmd#param) \| None An interval (such as *day* or a number), to transform **y** values to the middle of the interval. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y**, along with **textAnchor** and **lineAnchor**, based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `line_anchor` [LineAnchor](inspect_viz.mark.qmd#lineanchor) \| [Param](inspect_viz.qmd#param) \| None The line anchor controls how text is aligned (typically vertically) relative to its anchor point; it is one of *top*, *bottom*, or *middle*. If the frame anchor is *top*, *top-left*, or *top-right*, the default line anchor is *top*; if the frame anchor is *bottom*, *bottom-right*, or *bottom-left*, the default is *bottom*; otherwise it is *middle*. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise; a constant or a channel; defaults to 0°. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None `TextStyles` to apply. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### text_y A vertical text mark that displays textual labels. Like text, except that **x** defaults to the zero-based index of the data \[0, 1, 2, …\]. If an **interval** is specified, such as *day*, **x** is transformed to the middle of the interval. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_text.py#L115) ``` python def text_y( data: Data | None, y: ChannelSpec | Param, x: ChannelIntervalSpec | Param | None = None, z: Channel | Param | None = None, text: Channel | Param | None = None, interval: Interval | Param | None = None, filter_by: Selection | None = None, frame_anchor: FrameAnchor | Param | None = None, line_anchor: LineAnchor | Param | None = None, rotate: Channel | float | Param | None = None, styles: TextStyles | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) \| None The data source for the mark. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) The vertical position channel specifying the text’s anchor point, typically bound to the *y* scale. `x` [ChannelIntervalSpec](inspect_viz.mark.qmd#channelintervalspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel specifying the text’s anchor point, typically bound to the *x* scale; defaults to the zero-based index of the data \[0, 1, 2, …\]. `z` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None An optional ordinal channel for grouping data into series. `text` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None The text contents channel, possibly with line breaks (, , or . If not specified, defaults to the zero-based index \[0, 1, 2, …\]. `interval` Interval \| [Param](inspect_viz.qmd#param) \| None An interval (such as *day* or a number), to transform **x** values to the middle of the interval. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor specifies defaults for **x** and **y**, along with **textAnchor** and **lineAnchor**, based on the plot’s frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `line_anchor` [LineAnchor](inspect_viz.mark.qmd#lineanchor) \| [Param](inspect_viz.qmd#param) \| None The line anchor controls how text is aligned (typically vertically) relative to its anchor point; it is one of *top*, *bottom*, or *middle*. If the frame anchor is *top*, *top-left*, or *top-right*, the default line anchor is *top*; if the frame anchor is *bottom*, *bottom-right*, or *bottom-left*, the default is *bottom*; otherwise it is *middle*. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise; a constant or a channel; defaults to 0°. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. `styles` [TextStyles](inspect_viz.mark.qmd#textstyles) \| None `TextStyles` to apply. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional `MarkOptions`. ### image Create an image mark for displaying images in visualizations. The image mark displays raster images (PNG, JPEG, etc.) at specified positions and sizes. Images can be positioned using x/y coordinates, sized with width/height, and styled with various options including aspect ratio preservation and rendering modes. This mark is useful for: - Adding logos, icons, or other imagery to visualizations - Creating image-based scatter plots or dashboards - Displaying photographs or other raster content within plots [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_image.py#L15) ``` python def image( data: Data, x: ChannelSpec | Param | None = None, y: ChannelSpec | Param | None = None, filter_by: Selection | None = None, width: Channel | float | Param | None = None, height: Channel | float | Param | None = None, r: Channel | float | Param | None = None, rotate: Channel | float | Param | None = None, src: Channel | str | Param | None = None, preserve_aspect_ratio: str | Param | None = None, cross_origin: str | Param | None = None, frame_anchor: FrameAnchor | Param | None = None, image_rendering: str | Param | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The horizontal position channel, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) \| None The vertical position channel, typically bound to the *y* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `width` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The image width in pixels. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. Defaults to 16 if neither width nor height are set. `height` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The image height in pixels. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. Defaults to 16 if neither width nor height are set. `r` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The image clip radius for circular images. If null (default), images are not clipped; when a number, it is interpreted as a constant in pixels; otherwise it is interpreted as a channel. `rotate` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) \| None The rotation angle in degrees clockwise. `src` [Channel](inspect_viz.mark.qmd#channel) \| str \| [Param](inspect_viz.qmd#param) \| None The required image URL (or relative path). If a string that starts with a dot, slash, or URL protocol it is assumed to be a constant; otherwise it is interpreted as a channel. `preserve_aspect_ratio` str \| [Param](inspect_viz.qmd#param) \| None The image aspect ratio; defaults to “xMidYMid meet”. To crop the image instead of scaling it to fit, use “xMidYMid slice”. `cross_origin` str \| [Param](inspect_viz.qmd#param) \| None The cross-origin behavior for loading images from external domains. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) \| None The frame anchor position for legend placement. `image_rendering` str \| [Param](inspect_viz.qmd#param) \| None The image-rendering attribute; defaults to “auto” (bilinear). May be set to “pixelated” to disable bilinear interpolation for a sharper image. `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. ## Geographic ### geo Create a geo mark for rendering geographic data. The geo mark renders geographic data, typically GeoJSON objects, with support for map projections and geographic styling. It’s designed for displaying geographic features like countries, states, cities, or any spatial geometry. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_geo.py#L13) ``` python def geo( data: Data, geometry: Channel | Param | None = None, r: ChannelSpec | float | Param | None = None, filter_by: Selection | None = None, **options: Unpack[MarkOptions], ) -> Mark ``` `data` [Data](inspect_viz.qmd#data) The data source for the mark. `geometry` [Channel](inspect_viz.mark.qmd#channel) \| [Param](inspect_viz.qmd#param) \| None A channel for the geometry to render; defaults to identity, assuming data is a GeoJSON object or iterable of GeoJSON objects. Supports various geographic data types and transformations. `r` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| float \| [Param](inspect_viz.qmd#param) \| None The radius channel for point geometries, typically bound to the *radius* scale. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Additional mark options from MarkOptions. Note that clip can be set to “sphere” for projection-aware clipping when using spherical projections. ### graticule Create a graticule mark that renders a global coordinate grid. The graticule mark renders a 10° global graticule (coordinate grid) showing lines of longitude and latitude. This provides a reference grid for geographic visualizations and helps users understand the projection and scale. This mark is particularly useful for: - Adding coordinate reference lines to world maps - Showing distortion in map projections - Providing spatial reference for geographic data [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_geo.py#L77) ``` python def graticule( **options: Unpack[MarkOptions], ) -> Mark ``` `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Options from MarkOptions. Note that this mark is designed for use with spherical projections only. ### sphere Create a sphere mark that renders the outline of the projection sphere. The sphere mark renders the outline of the sphere on the projection’s plane. This is typically used with spherical projections to show the boundary of the projected world. The sphere mark automatically generates the appropriate geometry for the current projection. This mark is particularly useful for: - Adding a border around world maps with spherical projections - Showing the extent of the projection - Creating a background for geographic visualizations [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_geo.py#L52) ``` python def sphere( **options: Unpack[MarkOptions], ) -> Mark ``` `**options` Unpack\[[MarkOptions](inspect_viz.mark.qmd#markoptions)\] Options from MarkOptions. Note that this mark is designed for use with spherical projections only. ## Types ### Mark Plot mark (create marks using mark functions, e.g. `dot()`, `bar_x()`, etc.). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_mark.py#L15) ``` python class Mark(Component) ``` ### MarkOptions Shared options for all marks. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_options.py#L8) ``` python class MarkOptions(TypedDict, total=False) ``` #### Attributes `filter` [Channel](inspect_viz.mark.qmd#channel) Applies a transform to filter the mark’s index according to the given channel values; only truthy values are retained. `select` Literal\['first', 'last', 'maxX', 'maxY', 'minX', 'minY', 'nearest', 'nearestX', 'nearestY'\] Applies a filter transform after data is loaded to highlight selected values only. For example, `first` and `last` select the first or last values of series only (using the *z* channel to separate series). Meanwhile, `nearestX` and `nearestY` select the point nearest to the pointer along the *x* or *y* channel dimension. Unlike Mosaic selections, a mark level *select* is internal to the mark only, and does not populate a param or selection value to be shared across clients. `reverse` bool \| [Param](inspect_viz.qmd#param) Applies a transform to reverse the order of the mark’s index, say for reverse input order. `sort` SortOrder Sort order for a plot mark’s index. `fx` [Channel](inspect_viz.mark.qmd#channel) The horizontal facet position channel, for mark-level faceting, bound to the *fx* scale `fy` [Channel](inspect_viz.mark.qmd#channel) The vertical facet position channel, for mark-level faceting, bound to the *fy* scale. `facet` Literal\['auto', 'include', 'exclude', 'super'\] \| bool \| None \| [Param](inspect_viz.qmd#param) Whether to enable or disable faceting. - *auto* (default) - automatically determine if this mark should be faceted - *include* (or `True`) - draw the subset of the mark’s data in the current facet - *exclude* - draw the subset of the mark’s data *not* in the current facet - *super* - draw this mark in a single frame that covers all facets - null (or `False`) - repeat this mark’s data across all facets (*i.e.*, no faceting) When a mark uses *super* faceting, it is not allowed to use position scales (*x*, *y*, *fx*, or *fy*); *super* faceting is intended for decorations, such as labels and legends. When top-level faceting is used, the default *auto* setting is equivalent to *include* when the mark data is strictly equal to the top-level facet data; otherwise it is equivalent to null. When the *include* or *exclude* facet mode is chosen, the mark data must be parallel to the top-level facet data: the data must have the same length and order. If the data are not parallel, then the wrong data may be shown in each facet. The default *auto* therefore requires strict equality for safety, and using the facet data as mark data is recommended when using the *exclude* facet mode. When mark-level faceting is used, the default *auto* setting is equivalent to *include*: the mark will be faceted if either the **fx** or **fy** channel option (or both) is specified. The null or false option will disable faceting, while *exclude* draws the subset of the mark’s data *not* in the current facet. `facet_anchor` Literal\['top', 'right', 'bottom', 'left', 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'top-empty', 'right-empty', 'bottom-empty', 'left-empty', 'empty'\] \| None \| [Param](inspect_viz.qmd#param) How to place the mark with respect to facets. - `None` (default for most marks) - display the mark in each non-empty facet - *top*, *right*, *bottom*, or *left* - display the mark only in facets on the given side - *top-empty*, *right-empty*, *bottom-empty*, or *left-empty* (default for axis marks) - display the mark only in facets that have empty space on the given side: either the margin, or an empty facet - *empty* - display the mark in empty facets only `margin` float \| [Param](inspect_viz.qmd#param) Shorthand to set the same default for all four mark margins. `margin_top` float \| [Param](inspect_viz.qmd#param) The mark’s top margin. `margin_right` float \| [Param](inspect_viz.qmd#param) The mark’s right margin. `margin_bottom` float \| [Param](inspect_viz.qmd#param) The mark’s bottom margin. `margin_left` float \| [Param](inspect_viz.qmd#param) The mark’s left margin. `aria_description` str \| [Param](inspect_viz.qmd#param) ARIA description (). `aria_hidden` str \| [Param](inspect_viz.qmd#param) ARIA hidden (). `aria_label` [Channel](inspect_viz.mark.qmd#channel) ARIA label (). `pointer_events` str \| [Param](inspect_viz.qmd#param) Pointer events (). `title` [Channel](inspect_viz.mark.qmd#channel) The title; a channel specifying accessible, short textual descriptions as strings (possibly with newlines). If the `tip` option is specified, the title will be displayed with an interactive tooltip instead of using the SVG title element. `tip` Union\[bool, [TipPointer](inspect_viz.mark.qmd#tippointer), [TipOptions](inspect_viz.mark.qmd#tipoptions), [Param](inspect_viz.qmd#param)\] Whether to generate a tooltip for this mark, and any tip options. `channels` dict\[str, str\] Additional named channels, for example to include in a tooltip. Consists of (channel name, data field name) key-value pairs. `clip` Literal\['frame', 'sphere'\] \| bool \| None \| [Param](inspect_viz.qmd#param) How to clip the mark. - *frame* or `True` - clip to the plot’s frame (inner area) - *sphere* - clip to the projected sphere (*e.g.*, front hemisphere) - `None` or `False` - do not clip The *sphere* clip option requires a geographic projection. `dx` float \| [Param](inspect_viz.qmd#param) The horizontal offset in pixels; a constant option. On low-density screens, an additional 0.5px offset may be applied for crisp edges. `dy` float \| [Param](inspect_viz.qmd#param) The vertical offset in pixels; a constant option. On low-density screens, an additional 0.5px offset may be applied for crisp edges. `fill` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) A constant CSS color string, or a channel typically bound to the *color* scale. If all channel values are valid CSS colors, by default the channel will not be bound to the *color* scale, interpreting the colors literally. `fill_opacity` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) A constant number between 0 and 1, or a channel typically bound to the *opacity* scale. If all channel values are numbers in \[0, 1\], by default the channel will not be bound to the *opacity* scale, interpreting the opacities literally. `stroke` [ChannelSpec](inspect_viz.mark.qmd#channelspec) \| [Param](inspect_viz.qmd#param) A constant CSS color string, or a channel typically bound to the *color* scale. If all channel values are valid CSS colors, by default the channel will not be bound to the *color* scale, interpreting the colors literally. `stroke_dasharray` str \| float \| [Param](inspect_viz.qmd#param) A constant number indicating the length in pixels of alternating dashes and gaps, or a constant string of numbers separated by spaces or commas (*e.g.*, *10 2* for dashes of 10 pixels separated by gaps of 2 pixels), or *none* (the default) for no dashing. `stroke_dashoffset` str \| float \| [Param](inspect_viz.qmd#param) A constant indicating the offset in pixels of the first dash along the stroke; defaults to zero. `stroke_linecap` str \| [Param](inspect_viz.qmd#param) A constant specifying how to cap stroked paths, such as *butt*, *round*, or *square* (). `stroke_linejoin` str \| [Param](inspect_viz.qmd#param) A constant specifying how to join stroked paths, such as *bevel*, *miter*, *miter-clip*, or *round* () `stroke_miterlimit` float \| [Param](inspect_viz.qmd#param) A constant number specifying how to limit the length of *miter* joins on stroked paths. `stroke_opacity` [ChannelSpec](inspect_viz.mark.qmd#channelspec) A constant between 0 and 1, or a channel typically bound to the *opacity* scale. If all channel values are numbers in \[0, 1\], by default the channel will not be bound to the *opacity* scale, interpreting the opacities literally. `stroke_width` [ChannelSpec](inspect_viz.mark.qmd#channelspec) A constant number in pixels, or a channel. `opacity` [ChannelSpec](inspect_viz.mark.qmd#channelspec) A constant between 0 and 1, or a channel typically bound to the *opacity* scale. If all channel values are numbers in \[0, 1\], by default the channel will not be bound to the *opacity* scale, interpreting the opacities literally. For faster rendering, prefer the **stroke_opacity** or **fill_opacity** option. `mix_blend_mode` str \| [Param](inspect_viz.qmd#param) A constant string specifying how to blend content such as *multiply* (). `image_filter` str \| [Param](inspect_viz.qmd#param) A constant string used to adjust the rendering of images, such as *blur(5px)* (). `paint_order` str \| [Param](inspect_viz.qmd#param) A constant string specifying the order in which the \* **fill**, **stroke**, and any markers are drawn; defaults to *normal*, which draws the fill, then stroke, then markers; defaults to *stroke* for the text mark to create a “halo” around text to improve legibility. `shape_rendering` str \| [Param](inspect_viz.qmd#param) A constant string such as *crispEdges* (). `href` [Channel](inspect_viz.mark.qmd#channel) a channel specifying URLs for clickable links. May be used in conjunction with the **target** option to open links in another window. `target` str \| [Param](inspect_viz.qmd#param) A constant string specifying the target window (\_e.g. \*\_blank\*) for clickable links; used in conjunction with the **href** option (). `shift_overlapping_text` bool \| [Param](inspect_viz.qmd#param) Whether to shift overlapping text marks to avoid collisions; defaults to `False`. If `True`, text marks will be shifted to avoid collisions with other text marks, but not with other marks. ### Marks Set of marks to add to a plot. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_mark.py#L74) ``` python Marks: TypeAlias = Mark | Sequence[Mark | Sequence[Mark]] ``` ### Title Plot title mark. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_title.py#L8) ``` python class Title(Mark) ``` ### Channel Data channel for visualization. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_channel.py#L42) ``` python Channel: TypeAlias = ( str | Transform | Sequence[int | float | bool | str] | int | float | bool | None ) ``` ### ChannelSpec Data channel spec for visualization. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_channel.py#L80) ``` python ChannelSpec: TypeAlias = Channel | ChannelWithScale ``` ### ChannelIntervalSpec In some contexts, when specifying a mark channel’s value, you can provide a {value, interval} object to specify an associated interval. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_channel.py#L100) ``` python ChannelIntervalSpec: TypeAlias = ChannelSpec | ChannelWithInterval ``` ### ChannelWithInterval Channel with associated interval. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_channel.py#L93) ``` python class ChannelWithInterval(TypedDict) ``` ### ChannelWithScale Channel with label and scale to override the scale that would normally be associated with the channel. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_channel.py#L56) ``` python class ChannelWithScale(TypedDict) ``` ### ChannelName Known channel names. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_channel.py#L7) ``` python ChannelName: TypeAlias = Literal[ "ariaLabel", "fill", "fillOpacity", "fontSize", "fx", "fy", "geometry", "height", "href", "length", "opacity", "path", "r", "rotate", "src", "stroke", "strokeOpacity", "strokeWidth", "symbol", "text", "title", "weight", "width", "x", "x1", "x2", "y", "y1", "y2", "z", ] ``` ### TipOptions Options for the tip mark. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_options.py#L214) ``` python class TipOptions(TypedDict, total=False) ``` #### Attributes `pointer` [TipPointer](inspect_viz.mark.qmd#tippointer) The pointer mode for the tip (x, y, or xy) `x` [ChannelSpec](inspect_viz.mark.qmd#channelspec) The horizontal position channel specifying the tip’s anchor, typically bound to the *x* scale. `x1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) The starting horizontal position channel specifying the tip’s anchor, typically bound to the *x* scale. `x2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) The ending horizontal position channel specifying the tip’s anchor, typically bound to the *x* scale. `y` [ChannelSpec](inspect_viz.mark.qmd#channelspec) The vertical position channel specifying the tip’s anchor, typically bound to the *y* scale. `y1` [ChannelSpec](inspect_viz.mark.qmd#channelspec) The starting vertical position channel specifying the tip’s anchor, typically bound to the *y* scale. `y2` [ChannelSpec](inspect_viz.mark.qmd#channelspec) The ending vertical position channel specifying the tip’s anchor, typically bound to the *y* scale. `frame_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) The frame anchor specifies defaults for **x** and **y** based on the plot’s frame. It may be one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame. `anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) The tip anchor specifies how to orient the tip box relative to its anchor position. The tip anchor refers to the part of the tip box that is attached to the anchor point. For example, the *top-left* anchor places the top-left corner of tip box near the anchor position, hence placing the tip box below and to the right of the anchor position. `preferred_anchor` [FrameAnchor](inspect_viz.mark.qmd#frameanchor) \| [Param](inspect_viz.qmd#param) If an explicit tip anchor is not specified, an anchor is chosen automatically such that the tip fits within the plot’s frame. If the preferred anchor fits, it is chosen. `format` dict\[[ChannelName](inspect_viz.mark.qmd#channelname), bool \| str \| [Param](inspect_viz.qmd#param)\] How channel values are formatted for display. If a format is a string, it is interpreted as a (UTC) time format for temporal channels, and otherwise a number format. ### TipPointer The pointer mode for the tip; corresponds to pointerX, pointerY, and pointer. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_options.py#L210) ``` python TipPointer: TypeAlias = Literal["x", "y", "xy"] ``` ### Curve The curve (interpolation) method for connecting adjacent points. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L7) ``` python Curve: TypeAlias = Literal[ "basis", "basis-closed", "basis-open", "bundle", "bump-x", "bump-y", "cardinal", "cardinal-closed", "cardinal-open", "catmull-rom", "catmull-rom-closed", "catmull-rom-open", "linear", "linear-closed", "monotone-x", "monotone-y", "natural", "step", "step-after", "step-before", ] ``` ### Symbol Symbol type for dot or density plot. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L45) ``` python Symbol: TypeAlias = Literal[ "asterisk", "circle", "cross", "diamond", "diamond2", "hexagon", "plus", "square", "square2", "star", "times", "triangle", "triangle2", "wye", ] ``` ### Marker Symbols used as plot markers. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L76) ``` python Marker: TypeAlias = Literal[ "arrow", "arrow-reverse", "dot", "circle", "circle-fill", "circle-stroke", "tick", "tick-x", "tick-y", ] ``` ### Interpolate The spatial interpolation method. - *none* - do not perform interpolation (the default) - *linear* - apply proportional linear interpolation across adjacent bins - *nearest* - assign each pixel to the closest sample’s value (Voronoi diagram) - *barycentric* - apply barycentric interpolation over the Delaunay triangulation - *random-walk* - apply a random walk from each pixel [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L32) ``` python Interpolate: TypeAlias = Literal[ "none", "linear", "nearest", "barycentric", "random-walk" ] ``` ### FrameAnchor Defaults for **x** and **y** based on the plot’s frame. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L63) ``` python FrameAnchor: TypeAlias = Literal[ "middle", "top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", ] ``` ### LineAnchor The line anchor controls how text is aligned (typically vertically) relative to its anchor point. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L112) ``` python LineAnchor = Literal["top", "bottom", "middle"] ``` ### TextOverflow How to truncate (or wrap) lines of text longer than the given **line_width**; one of: - null (default) preserve overflowing characters (and wrap if needed); - *clip* or *clip-end* remove characters from the end; - *clip-start* remove characters from the start; - *ellipsis* or *ellipsis-end* replace characters from the end with an ellipsis (…); - *ellipsis-start* replace characters from the start with an ellipsis (…); - *ellipsis-middle* replace characters from the middle with an ellipsis (…). If no **title** was specified, if text requires truncation, a title containing the non-truncated text will be implicitly added. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L89) ``` python TextOverflow: TypeAlias = ( Literal[ "clip", "ellipsis", "clip-start", "clip-end", "ellipsis-start", "ellipsis-middle", "ellipsis-end", ] | None ) ``` ### TextStyles Text styling options. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/mark/_types.py#L116) ``` python class TextStyles(TypedDict, total=False) ``` #### Attributes `text_anchor` Literal\['start', 'middle', 'end'\] \| [Param](inspect_viz.qmd#param) The text anchor controls how text is aligned (typically horizontally) relative to its anchor point; it is one of *start*, *end*, or *middle*. If the frame anchor is *left*, *top-left*, or *bottom-left*, the default text anchor is *start*; if the frame anchor is *right*, *top-right*, or *bottom-right*, the default is *end*; otherwise it is *middle*. `line_height` float \| [Param](inspect_viz.qmd#param) The line height in ems; defaults to 1. The line height affects the (typically vertical) separation between adjacent baselines of text, as well as the separation between the text and its anchor point. `line_width` float \| [Param](inspect_viz.qmd#param) The line width in ems (e.g., 10 for about 20 characters); defaults to infinity, disabling wrapping and clipping. If **text_overflow** is null, lines will be wrapped at the specified length. If a line is split at a soft hyphen (­), a hyphen (-) will be displayed at the end of the line. If **text_overflow** is not null, lines will be clipped according to the given strategy. `text_overflow` [TextOverflow](inspect_viz.mark.qmd#textoverflow) \| [Param](inspect_viz.qmd#param) Text overflow behavior. `monospace` bool \| [Param](inspect_viz.qmd#param) If `True`, changes the default **font_family** to *monospace*, and uses simplified monospaced text metrics calculations. `font_family` str \| [Param](inspect_viz.qmd#param) The font-family; a constant; defaults to the plot’s font family, which is typically *system-ui* `font_size` [Channel](inspect_viz.mark.qmd#channel) \| float \| [Param](inspect_viz.qmd#param) The font size in pixels; either a constant or a channel; defaults to the plot’s font size, which is typically 10. When a number, it is interpreted as a constant; otherwise it is interpreted as a channel. `font_variant` str \| [Param](inspect_viz.qmd#param) The font variant; a constant; if the **text** channel contains numbers or dates, defaults to *tabular-nums* to facilitate comparing numbers; otherwise defaults to the plot’s font style, which is typically *normal*. `font_weight` float \| [Param](inspect_viz.qmd#param) The font weight; a constant; defaults to the plot’s font weight, which is typically *normal*. # inspect_viz.interactor ## Selection ### interval_x Select a continuous 1D interval selection over the `x` scale domain. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L56) ``` python def interval_x( target: Selection, field: str | None = None, pixel_size: float | None = None, peers: bool | None = None, brush: Brush | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `field BETWEEN lo AND hi` is added for the currently selected interval \[lo, hi\]. `field` str \| None The name of the field (database column) over which the interval selection should be defined. If unspecified, the channel field of the first valid prior mark definition is used. `pixel_size` float \| None The size of an interative pixel (default `1`). Larger pixel sizes reduce the brush resolution, which can reduce the size of pre-aggregated materialized views. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. `brush` [Brush](inspect_viz.interactor.qmd#brush) \| None CSS styles for the brush (SVG `rect`) element. ### interval_y Select a continuous 1D interval selection over the `y` scale domain. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L123) ``` python def interval_y( target: Selection, field: str | None = None, pixel_size: float | None = None, peers: bool | None = None, brush: Brush | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `field BETWEEN lo AND hi` is added for the currently selected interval \[lo, hi\]. `field` str \| None The name of the field (database column) over which the interval selection should be defined. If unspecified, the channel field of the first valid prior mark definition is used. `pixel_size` float \| None The size of an interative pixel (default `1`). Larger pixel sizes reduce the brush resolution, which can reduce the size of pre-aggregated materialized views. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. `brush` [Brush](inspect_viz.interactor.qmd#brush) \| None CSS styles for the brush (SVG `rect`) element. ### interval_xy Select a continuous 2D interval selection over the `x` and `y` scale domains. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L91) ``` python def interval_xy( target: Selection, xfield: str | None = None, yfield: str | None = None, pixel_size: float | None = None, peers: bool | None = None, brush: Brush | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `(xfield BETWEEN x1 AND x2) AND (yfield BETWEEN y1 AND y2)` is added for the currently selected intervals. `xfield` str \| None The name of the field (database column) over which the `x`-component of the interval selection should be defined. If unspecified, the `x` channel field of the first valid prior mark definition is used. `yfield` str \| None The name of the field (database column) over which the `y`-component of the interval selection should be defined. If unspecified, the `y` channel field of the first valid prior mark definition is used. `pixel_size` float \| None The size of an interative pixel (default `1`). Larger pixel sizes reduce the brush resolution, which can reduce the size of pre-aggregated materialized views. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. `brush` [Brush](inspect_viz.interactor.qmd#brush) \| None CSS styles for the brush (SVG `rect`) element. ### nearest_x Select values from the mark closest to the pointer *x* location. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L227) ``` python def nearest_x( target: Selection, channels: list[str] | None = None, fields: list[str] | None = None, max_radius: float | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `field = value` is added for the currently nearest value. `channels` list\[str\] \| None The encoding channels whose domain values should be selected. For example, a setting of `['color']` selects the data value backing the color channel, whereas `['x', 'z']` selects both x and z channel domain values. If unspecified, the selected channels default to match the current pointer settings: a `nearestX` interactor selects the `['x']` channels, while a `nearest` interactor selects the `['x', 'y']` channels. `fields` list\[str\] \| None The fields (database column names) to use in generated selection clause predicates. If unspecified, the fields backing the selected *channels* in the first valid prior mark definition are used by default. `max_radius` float \| None The maximum radius of a nearest selection (default 40). Marks with (x, y) coordinates outside this radius will not be selected as nearest points. ### nearest_y Select values from the mark closest to the pointer *y* location. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L253) ``` python def nearest_y( target: Selection, channels: list[str] | None = None, fields: list[str] | None = None, max_radius: float | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `field = value` is added for the currently nearest value. `channels` list\[str\] \| None The encoding channels whose domain values should be selected. For example, a setting of `['color']` selects the data value backing the color channel, whereas `['x', 'z']` selects both x and z channel domain values. If unspecified, the selected channels default to match the current pointer settings: a `nearestX` interactor selects the `['x']` channels, while a `nearest` interactor selects the `['x', 'y']` channels. `fields` list\[str\] \| None The fields (database column names) to use in generated selection clause predicates. If unspecified, the fields backing the selected *channels* in the first valid prior mark definition are used by default. `max_radius` float \| None The maximum radius of a nearest selection (default 40). Marks with (x, y) coordinates outside this radius will not be selected as nearest points. ### toggle Select individal values. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L158) ``` python def toggle( target: Selection, channels: list[str], peers: bool | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `(field = value1) OR (field = value2) ...` is added for the currently selected values. `channels` list\[str\] The encoding channels over which to select values. For a selected mark, selection clauses will cover the backing data fields for each channel. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. ### toggle_x Select individal values in the `x` scale domain. Clicking or touching a mark toggles its selection status. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L183) ``` python def toggle_x( target: Selection, peers: bool | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `(field = value1) OR (field = value2) ...` is added for the currently selected values. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. ### toggle_y Toggle interactor over the `"y"` encoding channel only. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L307) ``` python def toggle_y( target: Selection, peers: bool | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `(field = value1) OR (field = value2) ...` is added for the currently selected values. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. ### toggle_color Select individal values in the `color` scale domain. Clicking or touching a mark toggles its selection status. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L205) ``` python def toggle_color( target: Selection, peers: bool | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `(field = value1) OR (field = value2) ...` is added for the currently selected values. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. ### region Select aspects of individual marks within a 2D range. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L279) ``` python def region( target: Selection, channels: list[str], peers: bool | None = None, brush: Brush | None = None, ) -> Interactor ``` `target` [Selection](inspect_viz.qmd#selection) The target selection. A clause of the form `(field = value1) OR (field = value2) ...` is added for the currently selected values. `channels` list\[str\] The encoding channels over which to select values (e.g. “x”, “y”, “color”, etc.). For a selected mark, selection clauses will cover the backing data fields for each channel. `peers` bool \| None A flag indicating if peer (sibling) marks are excluded when cross-filtering (default `true`). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups. `brush` [Brush](inspect_viz.interactor.qmd#brush) \| None CSS styles for the brush (SVG `rect`) element. ### highlight Highlight individual visualized data points based on a `Selection`. Selected values keep their normal appearance. Unselected values are deemphasized. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L17) ``` python def highlight( by: Selection, opacity: float | None = None, fill_opacity: float | None = None, stroke_opacity: float | None = None, fill: str | None = None, stroke: str | None = None, ) -> Interactor ``` `by` [Selection](inspect_viz.qmd#selection) The input selection. Unselected marks are deemphasized. `opacity` float \| None The overall opacity of deemphasized marks. By default the opacity is set to 0.2. `fill_opacity` float \| None The fill opacity of deemphasized marks. By default the fill opacity is unchanged. `stroke_opacity` float \| None The stroke opacity of deemphasized marks. By default the stroke opacity is unchanged. `fill` str \| None The fill color of deemphasized marks. By default the fill is unchanged. `stroke` str \| None The stroke color of deemphasized marks. By default the stroke is unchanged. ## Navigation ### pan Pan a plot along both the `x` and `y` scales. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L328) ``` python def pan( x: Selection | None = None, y: Selection | None = None, xfield: str | None = None, yfield: str | None = None, ) -> Interactor ``` `x` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `x` domain. A clause of the form `field BETWEEN x1 AND x2` is added for the current pan/zom interval \[x1, x2\]. `y` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `y` domain. A clause of the form `field BETWEEN y1 AND y2` is added for the current pan/zom interval \[y1, y2\]. `xfield` str \| None The name of the field (database column) over which the `x`-component of the pan/zoom interval should be defined. If unspecified, the `x` channel field of the first valid prior mark definition is used. `yfield` str \| None The name of the field (database column) over which the `y`-component of the pan/zoom interval should be defined. If unspecified, the `y` channel field of the first valid prior mark definition is used. ### pan_x Pan a plot along the `x` scale only. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L353) ``` python def pan_x( x: Selection | None = None, y: Selection | None = None, xfield: str | None = None, yfield: str | None = None, ) -> Interactor ``` `x` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `x` domain. A clause of the form `field BETWEEN x1 AND x2` is added for the current pan/zom interval \[x1, x2\]. `y` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `y` domain. A clause of the form `field BETWEEN y1 AND y2` is added for the current pan/zom interval \[y1, y2\]. `xfield` str \| None The name of the field (database column) over which the `x`-component of the pan/zoom interval should be defined. If unspecified, the `x` channel field of the first valid prior mark definition is used. `yfield` str \| None The name of the field (database column) over which the `y`-component of the pan/zoom interval should be defined. If unspecified, the `y` channel field of the first valid prior mark definition is used. ### pan_y Pan a plot along the `y` scale only. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L378) ``` python def pan_y( x: Selection | None = None, y: Selection | None = None, xfield: str | None = None, yfield: str | None = None, ) -> Interactor ``` `x` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `x` domain. A clause of the form `field BETWEEN x1 AND x2` is added for the current pan/zom interval \[x1, x2\]. `y` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `y` domain. A clause of the form `field BETWEEN y1 AND y2` is added for the current pan/zom interval \[y1, y2\]. `xfield` str \| None The name of the field (database column) over which the `x`-component of the pan/zoom interval should be defined. If unspecified, the `x` channel field of the first valid prior mark definition is used. `yfield` str \| None The name of the field (database column) over which the `y`-component of the pan/zoom interval should be defined. If unspecified, the `y` channel field of the first valid prior mark definition is used. ### pan_zoom Pan and zoom a plot along both the `x` and `y` scales. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L403) ``` python def pan_zoom( x: Selection | None = None, y: Selection | None = None, xfield: str | None = None, yfield: str | None = None, ) -> Interactor ``` `x` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `x` domain. A clause of the form `field BETWEEN x1 AND x2` is added for the current pan/zom interval \[x1, x2\]. `y` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `y` domain. A clause of the form `field BETWEEN y1 AND y2` is added for the current pan/zom interval \[y1, y2\]. `xfield` str \| None The name of the field (database column) over which the `x`-component of the pan/zoom interval should be defined. If unspecified, the `x` channel field of the first valid prior mark definition is used. `yfield` str \| None The name of the field (database column) over which the `y`-component of the pan/zoom interval should be defined. If unspecified, the `y` channel field of the first valid prior mark definition is used. ### pan_zoom_x Pan and zoom a plot along the `x` scale only. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L428) ``` python def pan_zoom_x( x: Selection | None = None, y: Selection | None = None, xfield: str | None = None, yfield: str | None = None, ) -> Interactor ``` `x` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `x` domain. A clause of the form `field BETWEEN x1 AND x2` is added for the current pan/zom interval \[x1, x2\]. `y` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `y` domain. A clause of the form `field BETWEEN y1 AND y2` is added for the current pan/zom interval \[y1, y2\]. `xfield` str \| None The name of the field (database column) over which the `x`-component of the pan/zoom interval should be defined. If unspecified, the `x` channel field of the first valid prior mark definition is used. `yfield` str \| None The name of the field (database column) over which the `y`-component of the pan/zoom interval should be defined. If unspecified, the `y` channel field of the first valid prior mark definition is used. ### pan_zoom_y Pan and zoom a plot along the `y` scale only. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L453) ``` python def pan_zoom_y( x: Selection | None = None, y: Selection | None = None, xfield: str | None = None, yfield: str | None = None, ) -> Interactor ``` `x` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `x` domain. A clause of the form `field BETWEEN x1 AND x2` is added for the current pan/zom interval \[x1, x2\]. `y` [Selection](inspect_viz.qmd#selection) \| None The output selection for the `y` domain. A clause of the form `field BETWEEN y1 AND y2` is added for the current pan/zom interval \[y1, y2\]. `xfield` str \| None The name of the field (database column) over which the `x`-component of the pan/zoom interval should be defined. If unspecified, the `x` channel field of the first valid prior mark definition is used. `yfield` str \| None The name of the field (database column) over which the `y`-component of the pan/zoom interval should be defined. If unspecified, the `y` channel field of the first valid prior mark definition is used. ## Types ### Interactor Interactors imbue plots with interactive behavior, such as selecting or highlighting values, and panning or zooming the display. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_interactors.py#L9) ``` python class Interactor(Component) ``` ### Brush Brush options. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/interactor/_brush.py#L6) ``` python class Brush(TypedDict, total=False) ``` #### Attributes `fill` str The fill color of the brush rectangle. `fill_opacity` float The fill opacity of the brush rectangle. `opacity` float The overall opacity of the brush rectangle. `stroke` str The stroke color of the brush rectangle. `stroke_dasharray` str The stroke dash array of the brush rectangle. `stroke_opacity` float The stroke opacity of the brush rectangle. # inspect_viz.transform ## SQL ### sql SQL transform for a column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_sql.py#L6) ``` python def sql(sql: str, label: str | None = None) -> Transform ``` `sql` str A SQL expression string to derive a new column value. Embedded Param references, such as `f"{param} + 1"`, are supported. For expressions with aggregate functions, use `agg()` instead. `label` str \| None A label for this expression, for example to label a plot axis. ### agg Aggregation transform for a column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_agg.py#L6) ``` python def agg(agg: str, label: str | None = None) -> Transform ``` `agg` str A SQL expression string to calculate an aggregate value. Embedded Param references, such as `f"SUM({param} + 1)"`, are supported. For expressions without aggregate functions, use `sql()` instead.” `label` str \| None A label for this expression, for example to label a plot axis. ## Column ### column Intpret a string or param-value as a column reference. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_column.py#L75) ``` python def column(column: str | Param) -> Transform ``` `column` str \| [Param](inspect_viz.qmd#param) Column name or paramameter. ### bin Bin a continuous variable into discrete intervals. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_column.py#L12) ``` python def bin( bin: str | float | bool | Param | Sequence[str | float | bool | Param], interval: Literal[ "date", "number", "millisecond", "second", "minute", "hour", "day", "month", "year", ] | None = None, step: float | None = None, steps: float | None = None, minstep: float | None = None, nice: bool | None = None, offset: float | None = None, ) -> Transform ``` `bin` str \| float \| bool \| [Param](inspect_viz.qmd#param) \| Sequence\[str \| float \| bool \| [Param](inspect_viz.qmd#param)\] specifies a data column or expression to bin. Both numerical and temporal (date/time) values are supported. `interval` Literal\['date', 'number', 'millisecond', 'second', 'minute', 'hour', 'day', 'month', 'year'\] \| None The interval bin unit to use, typically used to indicate a date/time unit for binning temporal values, such as `hour`, `day`, or `month`. If `date`, the extent of data values is used to automatically select an interval for temporal data. The value `number` enforces normal numerical binning, even over temporal data. If unspecified, defaults to `number` for numerical data and `date` for temporal data. `step` float \| None The step size to use between bins. When binning numerical values (or interval type `number`), this setting specifies the numerical step size. For data/time intervals, this indicates the number of steps of that unit, such as hours, days, or years. `steps` float \| None The target number of binning steps to use. To accommodate human-friendly (“nice”) bin boundaries, the actual number of bins may diverge from this exact value. This option is ignored when step is specified. `minstep` float \| None The minimum allowed bin step size (default 0) when performing numerical binning. For example, a setting of 1 prevents step sizes less than 1. This option is ignored when step is specified. `nice` bool \| None A flag (default true) requesting “nice” human-friendly end points and step sizes when performing numerical binning. When step is specified, this option affects the binning end points (e.g., origin) only. `offset` float \| None Offset for computed bins (default 0). For example, a value of 1 will result in using the next consecutive bin boundary. ### date_day Transform a Date value to a day of the month for cyclic comparison. Year and month values are collapsed to enable comparison over days only. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_column.py#L97) ``` python def date_day(expr: str | Param) -> Transform ``` `expr` str \| [Param](inspect_viz.qmd#param) Expression or parameter. ### date_month Transform a Date value to a month boundary for cyclic comparison. Year values are collapsed to enable comparison over months only. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_column.py#L109) ``` python def date_month(expr: str | Param) -> Transform ``` `expr` str \| [Param](inspect_viz.qmd#param) Expression or parameter. ### date_month_day Map date/times to a month and day value, all within the same year for comparison. The resulting value is still date-typed. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_column.py#L85) ``` python def date_month_day(expr: str | Param) -> Transform ``` `expr` str \| [Param](inspect_viz.qmd#param) Expression or parameter. ### epoch_ms Transform a Date value to epoch milliseconds. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_column.py#L121) ``` python def epoch_ms(expr: str | Param) -> Transform ``` `expr` str \| [Param](inspect_viz.qmd#param) Expression or parameter. ## Aggregate ### avg Compute the average (mean) value of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L47) ``` python def avg( col: TransformArg | None = None, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg \| None Column to compute the mean for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### count A count aggregate transform. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L63) ``` python def count( col: TransformArg | None = None, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg \| None Compute the count of records in an aggregation group. If specified, only non-null expression values are counted. If omitted, all rows within a group are counted. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### sum Compute the sum of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L207) ``` python def sum( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the sum for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### min Compute the minimum value of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L127) ``` python def min( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the minimum for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### max Compute the maximum value of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L111) ``` python def max( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the maximum for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### median Compute the median value of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L143) ``` python def median( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the median for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### mode Compute the mode value of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L159) ``` python def mode( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the mode for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### first Return the first column value found in an aggregation group. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L79) ``` python def first( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to get the first value from. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### last Return the last column value found in an aggregation group. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L95) ``` python def last( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to get the last value from. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### product Compute the product of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L175) ``` python def product( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the product for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### quantile Compute the quantile value of the given column at the provided probability threshold. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L271) ``` python def quantile( col: TransformArg, threshold: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the quantile for. `threshold` TransformArg Probability threshold (e.g., 0.5 for median). `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### stddev Compute the standard deviation of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L191) ``` python def stddev( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the standard deviation for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### stddev_pop Compute the population standard deviation of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L239) ``` python def stddev_pop( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the population standard deviation for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### variance Compute the sample variance of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L223) ``` python def variance( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the variance for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### var_pop Compute the population variance of the given column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L255) ``` python def var_pop( col: TransformArg, distinct: bool | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to compute the population variance for. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### argmin Find a value of the first column that minimizes the second column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L29) ``` python def argmin( col1: TransformArg, col2: TransformArg, distinct: bool | None, **options: Unpack[WindowOptions], ) -> Transform ``` `col1` TransformArg Column to yield the value from. `col2` TransformArg Column to check for minimum corresponding value of `col1`. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### argmax Find a value of the first column that maximizes the second column. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_aggregate.py#L11) ``` python def argmax( col1: TransformArg, col2: TransformArg, distinct: bool | None, **options: Unpack[WindowOptions], ) -> Transform ``` `col1` TransformArg Column to yield the value from. `col2` TransformArg Column to check for maximum corresponding value of `col1`. `distinct` bool \| None Aggregate distinct. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### ci_bounds Compute a confidence interval boundary. Returns a tuple of two `Transform` objects corresponding to the lower and upper bounds of the confidence interval. Specify the confidence interval either as: 1. A `level` and `stderr` column (where a z-score for level will be offset from the `stderr`); or 2. Explicit `lower` and `upper` columns which should already be on the desired scale (e.g., z\*stderr, bootstrap deltas, HDIs from bayesian posterior distributions, etc.). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_ci.py#L8) ``` python def ci_bounds( score: str | Param, *, level: float | None = None, stderr: str | Param | None = None, lower: str | Param | None = None, upper: str | Param | None = None, ) -> tuple[Transform, Transform] ``` `score` str \| [Param](inspect_viz.qmd#param) Column name for score. `level` float \| None Confidence level (e.g. 0.95) `stderr` str \| [Param](inspect_viz.qmd#param) \| None Column name for stderr. `lower` str \| [Param](inspect_viz.qmd#param) \| None Column name for lower bound. `upper` str \| [Param](inspect_viz.qmd#param) \| None Column name for upper bound. ## Window ### row_number Compute the 1-based row number over an ordered window partition. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L25) ``` python def row_number(**options: Unpack[WindowOptions]) -> Transform ``` `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### rank Compute the row rank over an ordered window partition. Sorting ties result in gaps in the rank numbers (\[1, 1, 3, …\]). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L35) ``` python def rank(**options: Unpack[WindowOptions]) -> Transform ``` `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### dense_rank Compute the dense row rank (no gaps) over an ordered window partition. Sorting ties do not result in gaps in the rank numbers ( \[1, 1, 2, …\]). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L47) ``` python def dense_rank(**options: Unpack[WindowOptions]) -> Transform ``` `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### percent_rank Compute the percetange rank over an ordered window partition. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L59) ``` python def percent_rank(**options: Unpack[WindowOptions]) -> Transform ``` `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### cume_dist Compute the cumulative distribution value over an ordered window partition. Equals the number of partition rows preceding or peer with the current row, divided by the total number of partition rows. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L69) ``` python def cume_dist(**options: Unpack[WindowOptions]) -> Transform ``` `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### n_tile Compute an n-tile integer ranging from 1 to `num_buckets` dividing the partition as equally as possible. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L81) ``` python def n_tile(num_buckets: int, **options: Unpack[WindowOptions]) -> Transform ``` `num_buckets` int Number of buckets. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### lag Compute lagging values in a column. Returns the value at the row that is at `offset` rows (default `1`) before the current row within the window frame. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L92) ``` python def lag( col: TransformArg, offset: int = 1, default: TransformArg | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to take value from. `offset` int Rows to offset. `default` TransformArg \| None Default value if thre is no such row. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### lead Compute leading values in a column. Returns the value at the row that is at `offset` rows (default `1`) after the current row within the window frame. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L112) ``` python def lead( col: TransformArg, offset: int = 1, default: TransformArg | None = None, **options: Unpack[WindowOptions], ) -> Transform ``` `col` TransformArg Column to take value from. `offset` int Rows to offset. `default` TransformArg \| None Default value if thre is no such row. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### first_value Get the first value of the given column in the current window frame. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L132) ``` python def first_value(col: TransformArg, **options: Unpack[WindowOptions]) -> Transform ``` `col` TransformArg Aggregate column to take first value from. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### last_value Get the last value of the given column in the current window frame. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L143) ``` python def last_value(col: TransformArg, **options: Unpack[WindowOptions]) -> Transform ``` `col` TransformArg Aggregate column to take last value from. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ### nth_value Get the nth value of the given column in the current window frame, counting from one. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L154) ``` python def nth_value( col: TransformArg, offset: int, **options: Unpack[WindowOptions] ) -> Transform ``` `col` TransformArg Aggregate column to take nth value from. `offset` int Offset for the nth row. `**options` Unpack\[[WindowOptions](inspect_viz.transform.qmd#windowoptions)\] Window transform options. ## Types ### Transform Column transformation operation. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_transform.py#L7) ``` python Transform: TypeAlias = dict[str, JsonValue] ``` ### WindowOptions Window transform options. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/transform/_window.py#L9) ``` python class WindowOptions(TypedDict, total=False) ``` #### Attributes `orderby` str \| [Param](inspect_viz.qmd#param) \| Sequence\[str \| [Param](inspect_viz.qmd#param)\] One or more expressions by which to sort a windowed version of this aggregate function. `partitionby` str \| [Param](inspect_viz.qmd#param) \| Sequence\[str \| [Param](inspect_viz.qmd#param)\] One or more expressions by which to partition a windowed version of this aggregate function. `rows` Sequence\[float \| None\] \| [Param](inspect_viz.qmd#param) window rows frame specification as an array or array-valued expression. `range` Sequence\[float \| None\] \| [Param](inspect_viz.qmd#param) Window range frame specification as an array or array-valued expression. # inspect_viz.table ### table Tabular display of data. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/table/_table.py#L243) ``` python def table( data: Data, *, columns: Sequence[str | Column] | None = None, filter_by: Selection | None = None, target: Selection | None = None, select: Literal[ "hover", "single_row", "multiple_row", "single_checkbox", "multiple_checkbox", "none", ] | None = None, width: float | None = None, max_width: float | None = None, height: float | Literal["auto"] | None = None, header_height: float | None = None, row_height: float | None = None, sorting: bool | None = None, filtering: bool | Literal["header", "row"] | None = None, pagination: bool | Pagination | None = None, style: TableStyle | None = None, ) -> Component ``` `data` [Data](inspect_viz.qmd#data) The data source for the table. `columns` Sequence\[str \| Column\] \| None A list of column names to include in the table grid. If unspecified, all table columns are included. `filter_by` [Selection](inspect_viz.qmd#selection) \| None Selection to filter by (defaults to data source selection). `target` [Selection](inspect_viz.qmd#selection) \| None The output selection. A selection clause of the form column IN (rows) will be added to the selection for each currently selected table row. `select` Literal\['hover', 'single_row', 'multiple_row', 'single_checkbox', 'multiple_checkbox', 'none'\] \| None The type of selection to use for the table. Valid values are “hover”, “single_checkbox”, “multiple_checkbox”, “single_row”, “multiple_row”, and “none”. Defaults to “single_row”. `width` float \| None The total width of the table widget, in pixels. `max_width` float \| None The maximum width of the table widget, in pixels. `height` float \| Literal\['auto'\] \| None Either the height of the table widget in pixels, or “auto”. If “auto”, the height of the table will fit the content within the table up to the 500px. Defaults to “auto”. `header_height` float \| None The height of the table header, in pixels. `row_height` float \| None The height of each table row, in pixels. `sorting` bool \| None Set whether sorting columns is enabled. `filtering` bool \| Literal\['header', 'row'\] \| None Enable filtering. If set to ‘header’ a filter button is shown in the table header. If set to ‘row’, a filter is shown in a row beneath the header. `pagination` bool \| Pagination \| None Enable pagination. If set to True, default pagination settings are used. If set to a Pagination object, custom pagination settings are used. `style` TableStyle \| None The style configuration for the table display. # inspect_viz.input ### select Select input. Select inputs can be populated either from a database table (via the `data` and `column` parameters) or from a static set of options (via the `options` parameter). Select inputs can produce either a single value or multiple values when `multiple=True` is specified. Select inputs have a `target` which is either a `Param` or `Selection`. In the latter case, the `field` parameter determines the data column name to use within generated selection clause predicates (defaulting to `column`). If no `target` is specified then the data source’s selection is used as the target. The intitial selected value will be “All” when `target` is a `Selection` (indicating select all records) and the param value when `target` is a `Param`. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/input/_select.py#L10) ``` python def select( data: Data | None = None, *, filter_by: Selection | None = None, column: str | None = None, options: Sequence[str | bool | float] | Mapping[str, str | bool | float] | None = None, value: Literal["all", "auto"] | str | list[str] = "all", multiple: bool = False, target: Param | Selection | None = None, field: str | None = None, label: str | None = None, width: float | None = None, ) -> Component ``` `data` [Data](inspect_viz.qmd#data) \| None The data source (used in conjunction with the `column` parameter). If `data` is not specified, you must provide explcit `options`. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data source indicated by the `data` parameter. `column` str \| None The name of a column from which to pull options. The unique column values are used as options. Used in conjunction with the `data` parameter. `options` Sequence\[str \| bool \| float\] \| Mapping\[str, str \| bool \| float\] \| None A `list` or `dict` of options (provide a `dict` if you want values to map to alternate labels). Alternative to populating options from a database column via `data` and `column`. `value` Literal\['all', 'auto'\] \| str \| list\[str\] Initial value for selection. Pass “all” (the default) for no filtering, “auto” to select the first element in the list, or value(s) for an explicit initial selection. Applies only when `target` is a `Selection` (as `Param` carries its own default value). `multiple` bool Enable selection of multiple values (defaults to `False`) `target` [Param](inspect_viz.qmd#param) \| [Selection](inspect_viz.qmd#selection) \| None A `Param` or `Selection` that this select input should update. For a `Param`, the selected value is set to be the new param value. For a `Selection`, a predicate of the form column = value will be added to the selection. `field` str \| None The data column name to use within generated selection clause predicates. Defaults to the `column` parameter. `label` str \| None A text label for the input. If unspecified, the column name (if provided) will be used by default. `width` float \| None Width in pixels (defaults to 150). ### slider Select input widget. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/input/_slider.py#L10) ``` python def slider( data: Data | None = None, *, filter_by: Selection | None = None, label: str | None = None, column: str | None = None, field: str | None = None, target: Param | Selection | None = None, select: Literal["point", "interval"] | None = None, value: float | tuple[float, float] | None = None, min: float | None = None, max: float | None = None, step: float | None = None, width: float = 150, ) -> Component ``` `data` [Data](inspect_viz.qmd#data) \| None The data source for this widget. Used in conjunction with the `column` property. The minimum and maximum values of the column determine the slider range. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data source indicated by the `data` property. `label` str \| None A text label for this input (optional). `column` str \| None The name of a database column whose values determine the slider range. Used in conjunction with the `data` property. The minimum and maximum values of the column determine the slider range. `field` str \| None The database column name to use within generated selection clause predicates. Defaults to the `column` property. `target` [Param](inspect_viz.qmd#param) \| [Selection](inspect_viz.qmd#selection) \| None A `Param` or `Selection` that this select input should update. For a `Param`, the selected value is set to be the new param value. For a `Selection`, a predicate that does an equality check (for `select=="point"`) or range check (for `select=="interval"`). `select` Literal\['point', 'interval'\] \| None The type of selection clause predicate to generate when `selection` is specified. If `'point'` (the default for a single value), the selection predicate is an equality check for the slider value. If `'interval'` (the default for a pair of values), the predicate checks the slider value interval. `value` float \| tuple\[float, float\] \| None The initial slider value. Either a single numeric value or a tuple of two values representing a range. `min` float \| None The minumum slider value. `max` float \| None The maximum slider value. `step` float \| None The slider step, the amount to increment between consecutive values. `width` float The width of the slider in screen pixels (defaults to 200) ### search Text search input widget [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/input/_search.py#L10) ``` python def search( data: Data, *, filter_by: Selection | None = None, column: str | None = None, field: str | None = None, target: Param | Selection | None = None, type: Literal["contains", "prefix", "suffix", "regexp"] | None = None, label: str | None = None, placeholder: str | None = None, width: float | None = None, ) -> Component ``` `data` [Data](inspect_viz.qmd#data) The data source for input selections (used in conjunction with the `column` property). `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data source indicated by the `data` property. `column` str \| None TThe name of a database column from which to pull valid search results. The unique column values are used as search autocomplete values. Used in conjunction with the `data` property. `field` str \| None The data column name to use within generated selection clause predicates. Defaults to the `column` property. `target` [Param](inspect_viz.qmd#param) \| [Selection](inspect_viz.qmd#selection) \| None A `Param` or `Selection` that this search box should update. For a `Param`, the textbox value is set as the new param value. For a `Selection`, a predicate based on the `type` option will be added to the selection. `type` Literal\['contains', 'prefix', 'suffix', 'regexp'\] \| None The type of text search query to perform. One of: - `"contains"` (default): the query string may appear anywhere in the text - `"prefix"`: the query string must appear at the start of the text - `"suffix"`: the query string must appear at the end of the text - `"regexp"`: the query string is a regular expression the text must match `label` str \| None A text label for this input (optional). `placeholder` str \| None Placeholder text for empty search box. `width` float \| None Width in pixels (defaults to 150). ### checkbox Checkbox. Checkboxes have a `target` which is either a `Param` or `Selection`. In the latter case, the `field` parameter determines the data column name to use within generated selection clause predicates (defaulting to `column`). If no `target` is specified then the data source’s selection is used as the target. The `values` tuple enables you to determine what value is communicated to the target for checked and unchecked states (by default, this is `True` and `False`). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/input/_checkbox.py#L8) ``` python def checkbox( data: Data | None = None, *, label: str | None = None, target: Param | Selection | None = None, field: str | None = None, checked: bool = False, values: tuple[str | float | bool | None, str | float | bool | None] = (True, False), ) -> Component ``` `data` [Data](inspect_viz.qmd#data) \| None The data source (required when specifying the `field` parameter to target a data source selection). `label` str \| None A text label for the input (required) `target` [Param](inspect_viz.qmd#param) \| [Selection](inspect_viz.qmd#selection) \| None A `Param` or `Selection` that this checkbox should interact with (use `values` to customize the values that are used in the `target`). `field` str \| None The data column name to use within generated selection clause predicates (required if `target` is not a `Param`). `checked` bool Should the checkbox be in the checked state by default. `values` tuple\[str \| float \| bool \| None, str \| float \| bool \| None\] What value is communicated to the target for checked and unchecked states. ### radio_group Radio group. Radio groups can be populated either from a database table (via the `data` and `column` parameters) or from a static set of options (via the `options` parameter). Radio groups have a `target` which is either a `Param` or `Selection`. In the latter case, the `field` parameter determines the data column name to use within generated selection clause predicates (defaulting to `column`). If no `target` is specified then the data source’s selection is used as the target. The intitial selected value will be “All” when `target` is a `Selection` (indicating select all records) and the param value when `target` is a `Param`. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/input/_radio_group.py#L8) ``` python def radio_group( data: Data | None = None, *, column: str | None = None, options: Sequence[str | bool | float] | Mapping[str, str | bool | float] | None = None, target: Param | Selection | None = None, field: str | None = None, label: str | None = None, filter_by: Selection | None = None, ) -> Component ``` `data` [Data](inspect_viz.qmd#data) \| None The data source (used in conjunction with the `column` parameter). If `data` is not specified, you must provide explcit `options`. `column` str \| None The name of a column from which to pull options. The unique column values are used as options. Used in conjunction with the `data` parameter. `options` Sequence\[str \| bool \| float\] \| Mapping\[str, str \| bool \| float\] \| None A `list` or `dict` of options (provide a `dict` if you want values to map to alternate labels). Alternative to populating options from a database column via `data` and `column`. `target` [Param](inspect_viz.qmd#param) \| [Selection](inspect_viz.qmd#selection) \| None A `Param` or `Selection` that this radio group should update. For a `Param`, the selected value is set to be the new param value. For a `Selection`, a predicate of the form column = value will be added to the selection. `field` str \| None The data column name to use within generated selection clause predicates. Defaults to the `column` parameter. `label` str \| None A text label for the input. If unspecified, the column name (if provided) will be used by default. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data source indicated by the `data` parameter. ### checkbox_group Checkbox group. Radio groups can be populated either from a database table (via the `data` and `column` parameters) or from a static set of options (via the `options` parameter). Checkbox groups have a `target` which is either a `Param` or `Selection`. In the latter case, the `field` parameter determines the data column name to use within generated selection clause predicates (defaulting to `column`). If no `target` is specified then the data source’s selection is used as the target. The intitial selected values will be empty when `target` is a `Selection` (indicating select all records) and the param value(s) when `target` is a `Param` (param values should be an array with one or more checkbox values). [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/input/_checkbox_group.py#L8) ``` python def checkbox_group( data: Data | None = None, *, column: str | None = None, options: Sequence[str | bool | float] | dict[str, str | bool | float] | None = None, target: Param | Selection | None = None, field: str | None = None, label: str | None = None, filter_by: Selection | None = None, ) -> Component ``` `data` [Data](inspect_viz.qmd#data) \| None The data source (used in conjunction with the `column` parameter). If `data` is not specified, you must provide explcit `options`. `column` str \| None The name of a column from which to pull options. The unique column values are used as options. Used in conjunction with the `data` parameter. `options` Sequence\[str \| bool \| float\] \| dict\[str, str \| bool \| float\] \| None A `list` or `dict` of options (provide a `dict` if you want values to map to alternate labels). Alternative to populating options from a database column via `data` and `column`. `target` [Param](inspect_viz.qmd#param) \| [Selection](inspect_viz.qmd#selection) \| None A `Param` or `Selection` that this radio group should update. For a `Param`, the selected value is set to be the new param value. For a `Selection`, a predicate of the form column IN (values) will be added to the selection. `field` str \| None The data column name to use within generated selection clause predicates. Defaults to the `column` parameter. `label` str \| None A text label for the input. If unspecified, the column name (if provided) will be used by default. `filter_by` [Selection](inspect_viz.qmd#selection) \| None A selection to filter the data source indicated by the `data` parameter. # inspect_viz.layout ### hconcat Horizontally concatenate components in a row layout. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/layout/_concat.py#L16) ``` python def hconcat(*component: Component) -> Component ``` `*component` [Component](inspect_viz.qmd#component) Components to concatenate. ### vconcat Vertically concatenate components in a column layout. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/layout/_concat.py#L6) ``` python def vconcat(*component: Component) -> Component ``` `*component` [Component](inspect_viz.qmd#component) Components to concatenate. ### hspace Horizontal space to place between widgets. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/layout/_space.py#L4) ``` python def hspace(hspace: float | str = 10) -> Component ``` `hspace` float \| str Amount of space. Number values indicate screen pixels. String values may use CSS units (em, pt, px, etc). ### vspace Veritcal space to place between widgets. [Source](https://github.com/meridianlabs-ai/inspect_viz/blob/4f22634e35c5dd4410d75f3db2210791c92d61f9/src/inspect_viz/layout/_space.py#L13) ``` python def vspace(vspace: float | str = 10) -> Component ``` `vspace` float \| str Amount of space. Number values indicate screen pixels. String values may use CSS units (em, pt, px, etc).