PlotSpec Schema Reference

This page provides the complete schema reference for the PlotSpec configuration model and its components. All documentation is automatically generated from the Pydantic model definitions to ensure accuracy.

PlotSpec

The main configuration model that defines all aspects of a plot.

class yaml2plot.core.plotspec.PlotSpec(**data)[source]

Pydantic-based plot specification with fluent API.

Replaces PlotConfig with structured validation and composable workflow.

x: XAxisSpec
y: List[YAxisSpec]
title: str | None
raw: str | None
width: int | None
height: int | None
theme: str | None
title_x: float
title_xanchor: str
show_legend: bool
grid: bool
show_rangeslider: bool
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod from_yaml(yaml_str)[source]

Create PlotSpec from YAML string.

Return type:

PlotSpec

classmethod from_file(file_path)[source]

Create PlotSpec from YAML file.

Parameters:

file_path (Union[str, Path]) – Path to YAML configuration file

Return type:

PlotSpec

Returns:

PlotSpec instance

Raises:
to_dict()[source]

Export clean configuration dictionary for v1.0.0 plotting functions.

Return type:

Dict[str, Any]

Returns:

Dict containing clean configuration suitable for standalone plotting functions

XAxisSpec

Defines the X-axis configuration options.

class yaml2plot.core.plotspec.XAxisSpec(**data)[source]

X-axis configuration specification.

signal: str
label: str | None
scale: str | None
unit: str | None
range: List[float] | None
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_scale(value)[source]

Restrict scale values to known Plotly axis scale types.

Return type:

Optional[str]

classmethod validate_range(value)[source]

Validate explicit axis range values.

Return type:

Optional[List[float]]

YAxisSpec

Defines the Y-axis configuration options for each subplot.

class yaml2plot.core.plotspec.YAxisSpec(**data)[source]

Y-axis configuration specification.

label: str
signals: Dict[str, str]
scale: str | None
unit: str | None
range: List[float] | None
color: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_scale(value)[source]

Restrict scale values to known Plotly axis scale types.

Return type:

Optional[str]

classmethod validate_range(value)[source]

Validate explicit axis range values.

Return type:

Optional[List[float]]

Usage Examples

For practical examples of how to use these configuration options, see: