Skip to content

format2d

format2d

Format2D pydantic-model

Bases: HashableBase

Formatting data for matplotlib figure and axes

Attributes:

Name Type Description
title_fig Optional[str]
legend Optional[Legend]
title_ax Optional[str]

Sets axis title

label_x Optional[str]
label_y Optional[str]
lim_x_min float | None
lim_x_max float | None
lim_y_min float | None
lim_y_max float | None
grid Grid | None

Sets the grid

scale_x AxisScale

Sets the x axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]

scale_y AxisScale

Sets the y axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]

Show JSON schema:
{
  "$defs": {
    "AxisScale": {
      "enum": [
        "linear",
        "log"
      ],
      "title": "AxisScale",
      "type": "string"
    },
    "Grid": {
      "additionalProperties": false,
      "description": "Container for major and minor grid line configuration.\n\nAttributes:\n    major (GridAxis): Configuration for major grid lines.\n    minor (GridAxis): Configuration for minor grid lines.\n    enable_minor_ticks (bool): Whether to enable minor ticks on the axes.",
      "properties": {
        "major": {
          "$ref": "#/$defs/GridAxis",
          "default": {
            "show": false,
            "pen": {
              "alpha": 1.0,
              "color": "gray",
              "label": null,
              "linestyle": "-",
              "size": 0.75,
              "zorder": 0.0
            }
          }
        },
        "minor": {
          "$ref": "#/$defs/GridAxis",
          "default": {
            "show": false,
            "pen": {
              "alpha": 1.0,
              "color": "gray",
              "label": null,
              "linestyle": "-",
              "size": 0.75,
              "zorder": 0.0
            }
          }
        },
        "enable_minor_ticks": {
          "default": false,
          "title": "Enable Minor Ticks",
          "type": "boolean"
        },
        "zorder": {
          "default": -1,
          "title": "Zorder",
          "type": "number"
        }
      },
      "title": "Grid",
      "type": "object"
    },
    "GridAxis": {
      "additionalProperties": false,
      "description": "Controls styling and visibility for one type of grid (major or minor).\n\nAttributes:\n    show (bool): Whether to display this grid axis.\n    pen (Pen): Style and label information for drawing to matplotlib axes.",
      "properties": {
        "show": {
          "default": false,
          "title": "Show",
          "type": "boolean"
        },
        "pen": {
          "$ref": "#/$defs/Pen",
          "default": {
            "color": "gray",
            "size": 0.75,
            "alpha": 1.0,
            "zorder": 0.0,
            "linestyle": "-",
            "label": null
          }
        }
      },
      "title": "GridAxis",
      "type": "object"
    },
    "Legend": {
      "description": "Configuration container for Matplotlib legend styling and placement.\n\nThe `Legend` class controls the appearance and position of the plot legend.\nPlacement is governed by a combination of the `loc` and `bbox_to_anchor`\nparameters, mirroring Matplotlib's `Axes.legend()`.\n\nAttributes:\n    visible (bool): Whether the legend should be displayed. Defaults to True.\n    title (str | None): Title displayed above the legend entries.\n    framealpha (float): Opacity of the legend background. 1 = fully opaque, 0 = fully transparent.\n    loc (LegendLocation): Anchor point for the legend (e.g., upper right, lower left). See `LegendLocation` enum for options.\n    ncol (int): Number of columns to arrange legend entries into.\n    fancybox (bool): Whether to draw a rounded (True) or square (False) legend frame.\n    edgecolor (str): Color of the legend frame border. Default is \"black\".\n    bbox_to_anchor (tuple[float, float] | None): Offset position of the legend in figure or axes coordinates. If None, the legend is placed inside the axes using `loc`.\n\n        Good starter values for common placements:\n\n        - **Inside (default)**:\n            ```python\n            bbox_to_anchor=None\n            ```\n        - **Outside right**:\n            ```python\n            loc=LegendLocation.CENTER_LEFT\n            bbox_to_anchor=(1.02, 0.5)\n            ```\n        - **Outside left**:\n            ```python\n            loc=LegendLocation.CENTER_RIGHT\n            bbox_to_anchor=(-0.02, 0.5)\n            ```\n        - **Outside top**:\n            ```python\n            loc=LegendLocation.LOWER_CENTER\n            bbox_to_anchor=(0.5, 1.02)\n            ```\n        - **Outside bottom**:\n            ```python\n            loc=LegendLocation.UPPER_CENTER\n            bbox_to_anchor=(0.5, -0.02)\n            ```",
      "properties": {
        "visible": {
          "default": true,
          "title": "Visible",
          "type": "boolean"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title"
        },
        "framealpha": {
          "default": 1,
          "title": "Framealpha",
          "type": "number"
        },
        "loc": {
          "$ref": "#/$defs/LegendLocation",
          "default": "best"
        },
        "ncol": {
          "default": 1,
          "title": "Ncol",
          "type": "integer"
        },
        "fancybox": {
          "default": true,
          "title": "Fancybox",
          "type": "boolean"
        },
        "edgecolor": {
          "default": "black",
          "title": "Edgecolor",
          "type": "string"
        },
        "bbox_to_anchor": {
          "anyOf": [
            {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Bbox To Anchor"
        }
      },
      "title": "Legend",
      "type": "object"
    },
    "LegendLocation": {
      "enum": [
        "best",
        "upper right",
        "upper left",
        "lower left",
        "lower right",
        "right",
        "center left",
        "center right",
        "lower center",
        "upper center",
        "center"
      ],
      "title": "LegendLocation",
      "type": "string"
    },
    "Pen": {
      "additionalProperties": false,
      "description": "Defines the pen drawing to matplotlib.\n\nAttributes:\n    color (str): Color of line\n    size (float): Line width\n    alpha (float): Opacity from 0 to 1 (inclusive)\n    linestyle (Union[str, Tuple[int, Tuple[int, ...]]]): Linestyle to plot. Supports `str` or `tuple` definition ([matplotlib documentation](https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html)).\n    zorder (float): Prioritization\n    label (Union[str, None]): Legend label",
      "properties": {
        "color": {
          "anyOf": [
            {
              "maxItems": 3,
              "minItems": 3,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "maxItems": 4,
              "minItems": 4,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "type": "string"
            }
          ],
          "default": "k",
          "title": "Color"
        },
        "size": {
          "default": 1,
          "title": "Size",
          "type": "number"
        },
        "alpha": {
          "default": 1,
          "title": "Alpha",
          "type": "number"
        },
        "zorder": {
          "default": 0,
          "title": "Zorder",
          "type": "number"
        },
        "linestyle": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "integer"
                },
                {
                  "items": {
                    "type": "integer"
                  },
                  "type": "array"
                }
              ],
              "type": "array"
            }
          ],
          "default": "-",
          "title": "Linestyle"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Label"
        }
      },
      "title": "Pen",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "description": "Formatting data for matplotlib figure and axes\n\nAttributes:\n    title_fig (Optional[str]): Sets [figure title][matplotlib.figure.Figure.suptitle]\n    legend (Optional[Legend]): Sets [legend style][trendify.api.styling.legend.Legend]\n    title_ax (Optional[str]): Sets [axis title][matplotlib.axes.Axes.set_title]\n    label_x (Optional[str]): Sets [x-axis label][matplotlib.axes.Axes.set_xlabel]\n    label_y (Optional[str]): Sets [y-axis label][matplotlib.axes.Axes.set_ylabel]\n    lim_x_min (float | None): Sets [x-axis lower bound][matplotlib.axes.Axes.set_xlim]\n    lim_x_max (float | None): Sets [x-axis upper bound][matplotlib.axes.Axes.set_xlim]\n    lim_y_min (float | None): Sets [y-axis lower bound][matplotlib.axes.Axes.set_ylim]\n    lim_y_max (float | None): Sets [y-axis upper bound][matplotlib.axes.Axes.set_ylim]\n    grid (Grid | None): Sets the [grid][matplotlib.pyplot.grid]\n    scale_x (AxisScale): Sets the x axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]\n    scale_y (AxisScale): Sets the y axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]",
  "properties": {
    "title_fig": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Title Fig"
    },
    "legend": {
      "anyOf": [
        {
          "$ref": "#/$defs/Legend"
        },
        {
          "type": "null"
        }
      ],
      "default": {
        "visible": true,
        "title": null,
        "framealpha": 1.0,
        "loc": "best",
        "ncol": 1,
        "fancybox": true,
        "edgecolor": "black",
        "bbox_to_anchor": null
      }
    },
    "title_ax": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Title Ax"
    },
    "label_x": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Label X"
    },
    "label_y": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Label Y"
    },
    "lim_x_min": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Lim X Min"
    },
    "lim_x_max": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Lim X Max"
    },
    "lim_y_min": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Lim Y Min"
    },
    "lim_y_max": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Lim Y Max"
    },
    "grid": {
      "anyOf": [
        {
          "$ref": "#/$defs/Grid"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "scale_x": {
      "$ref": "#/$defs/AxisScale",
      "default": "linear"
    },
    "scale_y": {
      "$ref": "#/$defs/AxisScale",
      "default": "linear"
    }
  },
  "title": "Format2D",
  "type": "object"
}

Config:

  • extra: 'forbid'

Fields:

union_from_iterable classmethod

union_from_iterable(format2ds: Iterable[Format2D])

Gets the most inclusive format object (in terms of limits) from a list of Format2D objects. Requires that the label and title fields are identical for all format objects in the list.

Parameters:

Name Type Description Default
format2ds Iterable[Format2D]

Iterable of Format2D objects.

required

Returns:

Type Description
Format2D

Single format object from list of objects.

Source code in src/trendify/api/formats/format2d.py
@classmethod
def union_from_iterable(cls, format2ds: Iterable[Format2D]):
    """
    Gets the most inclusive format object (in terms of limits) from a list of `Format2D` objects.
    Requires that the label and title fields are identical for all format objects in the list.

    Args:
        format2ds (Iterable[Format2D]): Iterable of `Format2D` objects.

    Returns:
        (Format2D): Single format object from list of objects.
    """
    formats = list(set(format2ds) - {None})

    [title_fig] = set(i.title_fig for i in formats if i is not None)
    [legend] = set(i.legend for i in formats if i is not None)
    [title_ax] = set(i.title_ax for i in formats if i is not None)
    [label_x] = set(i.label_x for i in formats if i is not None)
    [label_y] = set(i.label_y for i in formats if i is not None)

    x_min = [i.lim_x_min for i in formats if i.lim_x_min is not None]
    x_max = [i.lim_x_max for i in formats if i.lim_x_max is not None]
    y_min = [i.lim_y_min for i in formats if i.lim_y_min is not None]
    y_max = [i.lim_y_max for i in formats if i.lim_y_max is not None]

    lim_x_min = np.min(x_min) if len(x_min) > 0 else None
    lim_x_max = np.max(x_max) if len(x_max) > 0 else None
    lim_y_min = np.min(y_min) if len(y_min) > 0 else None
    lim_y_max = np.max(y_max) if len(y_max) > 0 else None

    grid = Grid.union_from_iterable(f.grid for f in formats if f.grid is not None)

    [scale_x] = set(i.scale_x for i in formats)
    [scale_y] = set(i.scale_y for i in formats)

    return cls(
        title_fig=title_fig,
        legend=legend,
        title_ax=title_ax,
        label_x=label_x,
        label_y=label_y,
        lim_x_min=lim_x_min,
        lim_x_max=lim_x_max,
        lim_y_min=lim_y_min,
        lim_y_max=lim_y_max,
        grid=grid,
        scale_x=scale_x,
        scale_y=scale_y,
    )

PlottableData2D pydantic-model

Bases: DataProduct

Base class for children of DataProduct to be plotted ax xy data on a 2D plot

Attributes:

Name Type Description
format2d Format2D | None

Format to apply to plot

tags Tags

Tags to be used for sorting data.

metadata dict[str, str]

A dictionary of metadata to be used as a tool tip for mousover in grafana

Show JSON schema:
{
  "$defs": {
    "AxisScale": {
      "enum": [
        "linear",
        "log"
      ],
      "title": "AxisScale",
      "type": "string"
    },
    "Format2D": {
      "additionalProperties": false,
      "description": "Formatting data for matplotlib figure and axes\n\nAttributes:\n    title_fig (Optional[str]): Sets [figure title][matplotlib.figure.Figure.suptitle]\n    legend (Optional[Legend]): Sets [legend style][trendify.api.styling.legend.Legend]\n    title_ax (Optional[str]): Sets [axis title][matplotlib.axes.Axes.set_title]\n    label_x (Optional[str]): Sets [x-axis label][matplotlib.axes.Axes.set_xlabel]\n    label_y (Optional[str]): Sets [y-axis label][matplotlib.axes.Axes.set_ylabel]\n    lim_x_min (float | None): Sets [x-axis lower bound][matplotlib.axes.Axes.set_xlim]\n    lim_x_max (float | None): Sets [x-axis upper bound][matplotlib.axes.Axes.set_xlim]\n    lim_y_min (float | None): Sets [y-axis lower bound][matplotlib.axes.Axes.set_ylim]\n    lim_y_max (float | None): Sets [y-axis upper bound][matplotlib.axes.Axes.set_ylim]\n    grid (Grid | None): Sets the [grid][matplotlib.pyplot.grid]\n    scale_x (AxisScale): Sets the x axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]\n    scale_y (AxisScale): Sets the y axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]",
      "properties": {
        "title_fig": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title Fig"
        },
        "legend": {
          "anyOf": [
            {
              "$ref": "#/$defs/Legend"
            },
            {
              "type": "null"
            }
          ],
          "default": {
            "visible": true,
            "title": null,
            "framealpha": 1.0,
            "loc": "best",
            "ncol": 1,
            "fancybox": true,
            "edgecolor": "black",
            "bbox_to_anchor": null
          }
        },
        "title_ax": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title Ax"
        },
        "label_x": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Label X"
        },
        "label_y": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Label Y"
        },
        "lim_x_min": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim X Min"
        },
        "lim_x_max": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim X Max"
        },
        "lim_y_min": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim Y Min"
        },
        "lim_y_max": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim Y Max"
        },
        "grid": {
          "anyOf": [
            {
              "$ref": "#/$defs/Grid"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "scale_x": {
          "$ref": "#/$defs/AxisScale",
          "default": "linear"
        },
        "scale_y": {
          "$ref": "#/$defs/AxisScale",
          "default": "linear"
        }
      },
      "title": "Format2D",
      "type": "object"
    },
    "Grid": {
      "additionalProperties": false,
      "description": "Container for major and minor grid line configuration.\n\nAttributes:\n    major (GridAxis): Configuration for major grid lines.\n    minor (GridAxis): Configuration for minor grid lines.\n    enable_minor_ticks (bool): Whether to enable minor ticks on the axes.",
      "properties": {
        "major": {
          "$ref": "#/$defs/GridAxis",
          "default": {
            "show": false,
            "pen": {
              "alpha": 1.0,
              "color": "gray",
              "label": null,
              "linestyle": "-",
              "size": 0.75,
              "zorder": 0.0
            }
          }
        },
        "minor": {
          "$ref": "#/$defs/GridAxis",
          "default": {
            "show": false,
            "pen": {
              "alpha": 1.0,
              "color": "gray",
              "label": null,
              "linestyle": "-",
              "size": 0.75,
              "zorder": 0.0
            }
          }
        },
        "enable_minor_ticks": {
          "default": false,
          "title": "Enable Minor Ticks",
          "type": "boolean"
        },
        "zorder": {
          "default": -1,
          "title": "Zorder",
          "type": "number"
        }
      },
      "title": "Grid",
      "type": "object"
    },
    "GridAxis": {
      "additionalProperties": false,
      "description": "Controls styling and visibility for one type of grid (major or minor).\n\nAttributes:\n    show (bool): Whether to display this grid axis.\n    pen (Pen): Style and label information for drawing to matplotlib axes.",
      "properties": {
        "show": {
          "default": false,
          "title": "Show",
          "type": "boolean"
        },
        "pen": {
          "$ref": "#/$defs/Pen",
          "default": {
            "color": "gray",
            "size": 0.75,
            "alpha": 1.0,
            "zorder": 0.0,
            "linestyle": "-",
            "label": null
          }
        }
      },
      "title": "GridAxis",
      "type": "object"
    },
    "Legend": {
      "description": "Configuration container for Matplotlib legend styling and placement.\n\nThe `Legend` class controls the appearance and position of the plot legend.\nPlacement is governed by a combination of the `loc` and `bbox_to_anchor`\nparameters, mirroring Matplotlib's `Axes.legend()`.\n\nAttributes:\n    visible (bool): Whether the legend should be displayed. Defaults to True.\n    title (str | None): Title displayed above the legend entries.\n    framealpha (float): Opacity of the legend background. 1 = fully opaque, 0 = fully transparent.\n    loc (LegendLocation): Anchor point for the legend (e.g., upper right, lower left). See `LegendLocation` enum for options.\n    ncol (int): Number of columns to arrange legend entries into.\n    fancybox (bool): Whether to draw a rounded (True) or square (False) legend frame.\n    edgecolor (str): Color of the legend frame border. Default is \"black\".\n    bbox_to_anchor (tuple[float, float] | None): Offset position of the legend in figure or axes coordinates. If None, the legend is placed inside the axes using `loc`.\n\n        Good starter values for common placements:\n\n        - **Inside (default)**:\n            ```python\n            bbox_to_anchor=None\n            ```\n        - **Outside right**:\n            ```python\n            loc=LegendLocation.CENTER_LEFT\n            bbox_to_anchor=(1.02, 0.5)\n            ```\n        - **Outside left**:\n            ```python\n            loc=LegendLocation.CENTER_RIGHT\n            bbox_to_anchor=(-0.02, 0.5)\n            ```\n        - **Outside top**:\n            ```python\n            loc=LegendLocation.LOWER_CENTER\n            bbox_to_anchor=(0.5, 1.02)\n            ```\n        - **Outside bottom**:\n            ```python\n            loc=LegendLocation.UPPER_CENTER\n            bbox_to_anchor=(0.5, -0.02)\n            ```",
      "properties": {
        "visible": {
          "default": true,
          "title": "Visible",
          "type": "boolean"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title"
        },
        "framealpha": {
          "default": 1,
          "title": "Framealpha",
          "type": "number"
        },
        "loc": {
          "$ref": "#/$defs/LegendLocation",
          "default": "best"
        },
        "ncol": {
          "default": 1,
          "title": "Ncol",
          "type": "integer"
        },
        "fancybox": {
          "default": true,
          "title": "Fancybox",
          "type": "boolean"
        },
        "edgecolor": {
          "default": "black",
          "title": "Edgecolor",
          "type": "string"
        },
        "bbox_to_anchor": {
          "anyOf": [
            {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Bbox To Anchor"
        }
      },
      "title": "Legend",
      "type": "object"
    },
    "LegendLocation": {
      "enum": [
        "best",
        "upper right",
        "upper left",
        "lower left",
        "lower right",
        "right",
        "center left",
        "center right",
        "lower center",
        "upper center",
        "center"
      ],
      "title": "LegendLocation",
      "type": "string"
    },
    "Pen": {
      "additionalProperties": false,
      "description": "Defines the pen drawing to matplotlib.\n\nAttributes:\n    color (str): Color of line\n    size (float): Line width\n    alpha (float): Opacity from 0 to 1 (inclusive)\n    linestyle (Union[str, Tuple[int, Tuple[int, ...]]]): Linestyle to plot. Supports `str` or `tuple` definition ([matplotlib documentation](https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html)).\n    zorder (float): Prioritization\n    label (Union[str, None]): Legend label",
      "properties": {
        "color": {
          "anyOf": [
            {
              "maxItems": 3,
              "minItems": 3,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "maxItems": 4,
              "minItems": 4,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "type": "string"
            }
          ],
          "default": "k",
          "title": "Color"
        },
        "size": {
          "default": 1,
          "title": "Size",
          "type": "number"
        },
        "alpha": {
          "default": 1,
          "title": "Alpha",
          "type": "number"
        },
        "zorder": {
          "default": 0,
          "title": "Zorder",
          "type": "number"
        },
        "linestyle": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "integer"
                },
                {
                  "items": {
                    "type": "integer"
                  },
                  "type": "array"
                }
              ],
              "type": "array"
            }
          ],
          "default": "-",
          "title": "Linestyle"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Label"
        }
      },
      "title": "Pen",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "Base class for children of DataProduct to be plotted ax xy data on a 2D plot\n\nAttributes:\n    format2d (Format2D|None): Format to apply to plot\n    tags (Tags): Tags to be used for sorting data.\n    metadata (dict[str, str]): A dictionary of metadata to be used as a tool tip for mousover in grafana",
  "properties": {
    "tags": {
      "items": {
        "anyOf": []
      },
      "title": "Tags",
      "type": "array"
    },
    "metadata": {
      "additionalProperties": {
        "type": "string"
      },
      "default": {},
      "title": "Metadata",
      "type": "object"
    },
    "format2d": {
      "anyOf": [
        {
          "$ref": "#/$defs/Format2D"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "tags"
  ],
  "title": "PlottableData2D",
  "type": "object"
}

Fields:

XYData pydantic-model

Bases: PlottableData2D

Base class for children of DataProduct to be plotted ax xy data on a 2D plot

Show JSON schema:
{
  "$defs": {
    "AxisScale": {
      "enum": [
        "linear",
        "log"
      ],
      "title": "AxisScale",
      "type": "string"
    },
    "Format2D": {
      "additionalProperties": false,
      "description": "Formatting data for matplotlib figure and axes\n\nAttributes:\n    title_fig (Optional[str]): Sets [figure title][matplotlib.figure.Figure.suptitle]\n    legend (Optional[Legend]): Sets [legend style][trendify.api.styling.legend.Legend]\n    title_ax (Optional[str]): Sets [axis title][matplotlib.axes.Axes.set_title]\n    label_x (Optional[str]): Sets [x-axis label][matplotlib.axes.Axes.set_xlabel]\n    label_y (Optional[str]): Sets [y-axis label][matplotlib.axes.Axes.set_ylabel]\n    lim_x_min (float | None): Sets [x-axis lower bound][matplotlib.axes.Axes.set_xlim]\n    lim_x_max (float | None): Sets [x-axis upper bound][matplotlib.axes.Axes.set_xlim]\n    lim_y_min (float | None): Sets [y-axis lower bound][matplotlib.axes.Axes.set_ylim]\n    lim_y_max (float | None): Sets [y-axis upper bound][matplotlib.axes.Axes.set_ylim]\n    grid (Grid | None): Sets the [grid][matplotlib.pyplot.grid]\n    scale_x (AxisScale): Sets the x axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]\n    scale_y (AxisScale): Sets the y axis scale to an option from [AxisScale][trendify.api.formats.format2d.AxisScale]",
      "properties": {
        "title_fig": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title Fig"
        },
        "legend": {
          "anyOf": [
            {
              "$ref": "#/$defs/Legend"
            },
            {
              "type": "null"
            }
          ],
          "default": {
            "visible": true,
            "title": null,
            "framealpha": 1.0,
            "loc": "best",
            "ncol": 1,
            "fancybox": true,
            "edgecolor": "black",
            "bbox_to_anchor": null
          }
        },
        "title_ax": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title Ax"
        },
        "label_x": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Label X"
        },
        "label_y": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Label Y"
        },
        "lim_x_min": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim X Min"
        },
        "lim_x_max": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim X Max"
        },
        "lim_y_min": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim Y Min"
        },
        "lim_y_max": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Lim Y Max"
        },
        "grid": {
          "anyOf": [
            {
              "$ref": "#/$defs/Grid"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "scale_x": {
          "$ref": "#/$defs/AxisScale",
          "default": "linear"
        },
        "scale_y": {
          "$ref": "#/$defs/AxisScale",
          "default": "linear"
        }
      },
      "title": "Format2D",
      "type": "object"
    },
    "Grid": {
      "additionalProperties": false,
      "description": "Container for major and minor grid line configuration.\n\nAttributes:\n    major (GridAxis): Configuration for major grid lines.\n    minor (GridAxis): Configuration for minor grid lines.\n    enable_minor_ticks (bool): Whether to enable minor ticks on the axes.",
      "properties": {
        "major": {
          "$ref": "#/$defs/GridAxis",
          "default": {
            "show": false,
            "pen": {
              "alpha": 1.0,
              "color": "gray",
              "label": null,
              "linestyle": "-",
              "size": 0.75,
              "zorder": 0.0
            }
          }
        },
        "minor": {
          "$ref": "#/$defs/GridAxis",
          "default": {
            "show": false,
            "pen": {
              "alpha": 1.0,
              "color": "gray",
              "label": null,
              "linestyle": "-",
              "size": 0.75,
              "zorder": 0.0
            }
          }
        },
        "enable_minor_ticks": {
          "default": false,
          "title": "Enable Minor Ticks",
          "type": "boolean"
        },
        "zorder": {
          "default": -1,
          "title": "Zorder",
          "type": "number"
        }
      },
      "title": "Grid",
      "type": "object"
    },
    "GridAxis": {
      "additionalProperties": false,
      "description": "Controls styling and visibility for one type of grid (major or minor).\n\nAttributes:\n    show (bool): Whether to display this grid axis.\n    pen (Pen): Style and label information for drawing to matplotlib axes.",
      "properties": {
        "show": {
          "default": false,
          "title": "Show",
          "type": "boolean"
        },
        "pen": {
          "$ref": "#/$defs/Pen",
          "default": {
            "color": "gray",
            "size": 0.75,
            "alpha": 1.0,
            "zorder": 0.0,
            "linestyle": "-",
            "label": null
          }
        }
      },
      "title": "GridAxis",
      "type": "object"
    },
    "Legend": {
      "description": "Configuration container for Matplotlib legend styling and placement.\n\nThe `Legend` class controls the appearance and position of the plot legend.\nPlacement is governed by a combination of the `loc` and `bbox_to_anchor`\nparameters, mirroring Matplotlib's `Axes.legend()`.\n\nAttributes:\n    visible (bool): Whether the legend should be displayed. Defaults to True.\n    title (str | None): Title displayed above the legend entries.\n    framealpha (float): Opacity of the legend background. 1 = fully opaque, 0 = fully transparent.\n    loc (LegendLocation): Anchor point for the legend (e.g., upper right, lower left). See `LegendLocation` enum for options.\n    ncol (int): Number of columns to arrange legend entries into.\n    fancybox (bool): Whether to draw a rounded (True) or square (False) legend frame.\n    edgecolor (str): Color of the legend frame border. Default is \"black\".\n    bbox_to_anchor (tuple[float, float] | None): Offset position of the legend in figure or axes coordinates. If None, the legend is placed inside the axes using `loc`.\n\n        Good starter values for common placements:\n\n        - **Inside (default)**:\n            ```python\n            bbox_to_anchor=None\n            ```\n        - **Outside right**:\n            ```python\n            loc=LegendLocation.CENTER_LEFT\n            bbox_to_anchor=(1.02, 0.5)\n            ```\n        - **Outside left**:\n            ```python\n            loc=LegendLocation.CENTER_RIGHT\n            bbox_to_anchor=(-0.02, 0.5)\n            ```\n        - **Outside top**:\n            ```python\n            loc=LegendLocation.LOWER_CENTER\n            bbox_to_anchor=(0.5, 1.02)\n            ```\n        - **Outside bottom**:\n            ```python\n            loc=LegendLocation.UPPER_CENTER\n            bbox_to_anchor=(0.5, -0.02)\n            ```",
      "properties": {
        "visible": {
          "default": true,
          "title": "Visible",
          "type": "boolean"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title"
        },
        "framealpha": {
          "default": 1,
          "title": "Framealpha",
          "type": "number"
        },
        "loc": {
          "$ref": "#/$defs/LegendLocation",
          "default": "best"
        },
        "ncol": {
          "default": 1,
          "title": "Ncol",
          "type": "integer"
        },
        "fancybox": {
          "default": true,
          "title": "Fancybox",
          "type": "boolean"
        },
        "edgecolor": {
          "default": "black",
          "title": "Edgecolor",
          "type": "string"
        },
        "bbox_to_anchor": {
          "anyOf": [
            {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Bbox To Anchor"
        }
      },
      "title": "Legend",
      "type": "object"
    },
    "LegendLocation": {
      "enum": [
        "best",
        "upper right",
        "upper left",
        "lower left",
        "lower right",
        "right",
        "center left",
        "center right",
        "lower center",
        "upper center",
        "center"
      ],
      "title": "LegendLocation",
      "type": "string"
    },
    "Pen": {
      "additionalProperties": false,
      "description": "Defines the pen drawing to matplotlib.\n\nAttributes:\n    color (str): Color of line\n    size (float): Line width\n    alpha (float): Opacity from 0 to 1 (inclusive)\n    linestyle (Union[str, Tuple[int, Tuple[int, ...]]]): Linestyle to plot. Supports `str` or `tuple` definition ([matplotlib documentation](https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html)).\n    zorder (float): Prioritization\n    label (Union[str, None]): Legend label",
      "properties": {
        "color": {
          "anyOf": [
            {
              "maxItems": 3,
              "minItems": 3,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "maxItems": 4,
              "minItems": 4,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            {
              "type": "string"
            }
          ],
          "default": "k",
          "title": "Color"
        },
        "size": {
          "default": 1,
          "title": "Size",
          "type": "number"
        },
        "alpha": {
          "default": 1,
          "title": "Alpha",
          "type": "number"
        },
        "zorder": {
          "default": 0,
          "title": "Zorder",
          "type": "number"
        },
        "linestyle": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "integer"
                },
                {
                  "items": {
                    "type": "integer"
                  },
                  "type": "array"
                }
              ],
              "type": "array"
            }
          ],
          "default": "-",
          "title": "Linestyle"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Label"
        }
      },
      "title": "Pen",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "Base class for children of DataProduct to be plotted ax xy data on a 2D plot",
  "properties": {
    "tags": {
      "items": {
        "anyOf": []
      },
      "title": "Tags",
      "type": "array"
    },
    "metadata": {
      "additionalProperties": {
        "type": "string"
      },
      "default": {},
      "title": "Metadata",
      "type": "object"
    },
    "format2d": {
      "anyOf": [
        {
          "$ref": "#/$defs/Format2D"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "tags"
  ],
  "title": "XYData",
  "type": "object"
}