Skip to content

marker

marker

Marker pydantic-model

Bases: HashableBase

Defines marker for scattering to matplotlib

Attributes:

Name Type Description
color str

Color of line

size float

Line width

alpha float

Opacity from 0 to 1 (inclusive)

zorder float

Prioritization

label Union[str, None]

Legend label

symbol str

Matplotlib symbol string

Show JSON schema:
{
  "additionalProperties": false,
  "description": "Defines marker for scattering 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    zorder (float): Prioritization\n    label (Union[str, None]): Legend label\n    symbol (str): Matplotlib symbol string",
  "properties": {
    "color": {
      "default": "k",
      "title": "Color",
      "type": "string"
    },
    "size": {
      "default": 5,
      "title": "Size",
      "type": "number"
    },
    "alpha": {
      "default": 1,
      "title": "Alpha",
      "type": "number"
    },
    "zorder": {
      "default": 0,
      "title": "Zorder",
      "type": "number"
    },
    "label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Label"
    },
    "symbol": {
      "default": ".",
      "title": "Symbol",
      "type": "string"
    }
  },
  "title": "Marker",
  "type": "object"
}

Config:

  • extra: 'forbid'

Fields:

as_scatter_plot_kwargs

as_scatter_plot_kwargs()

Returns:

Type Description
dict

dictionary of kwargs for matplotlib scatter

Source code in src/trendify/api/styling/marker.py
def as_scatter_plot_kwargs(self):
    """
    Returns:
        (dict): dictionary of `kwargs` for [matplotlib scatter][matplotlib.axes.Axes.scatter]
    """
    return {
        "marker": self.symbol,
        "c": self.color,
        "s": self.size,
        "alpha": self.alpha,
        "zorder": self.zorder,
        "label": self.label,
        "marker": self.symbol,
    }

from_pen classmethod

from_pen(pen: Pen, symbol: str = '.')

Converts Pen to marker with the option to specify a symbol

Source code in src/trendify/api/styling/marker.py
@classmethod
def from_pen(
    cls,
    pen: Pen,
    symbol: str = ".",
):
    """
    Converts Pen to marker with the option to specify a symbol
    """
    return cls(symbol=symbol, **pen.model_dump().pop("linestyle"))