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: Optional[str]
raw: Optional[str]
width: Optional[int]
height: Optional[int]
theme: Optional[str]
title_x: float
title_xanchor: str
show_legend: bool
grid: bool
show_rangeslider: bool
model_config: ClassVar[ConfigDict] = {'extra': 'allow', '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: Optional[str]
scale: Optional[str]
unit: Optional[str]
range: Optional[List[float]]
model_config: ClassVar[ConfigDict] = {}

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

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: Optional[str]
unit: Optional[str]
range: Optional[List[float]]
color: Optional[str]
model_config: ClassVar[ConfigDict] = {}

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

Usage Examples

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