Skip to content

plotly

Classes:

Attributes:

figure_serializer module-attribute

figure_serializer = FigureSerializer()

FigureSerializer with default settings.

FigureDumpArgs

Bases: TypedDict

Arguments for dumping a Plotly figure.

Attributes:

  • engine (str | None) –

    JSON encoder to use. Options include "json", "orjson", or "auto". Default is None.

  • pretty (bool) –

    Whether to pretty print the JSON representation (default False).

  • remove_uids (bool) –

    Whether to remove trace UIDs from the JSON representation (default True).

  • validate (bool) –

    Whether to validate the figure before serialization (default True).

engine instance-attribute

engine: str | None

JSON encoder to use. Options include "json", "orjson", or "auto". Default is None.

pretty instance-attribute

pretty: bool

Whether to pretty print the JSON representation (default False).

remove_uids instance-attribute

remove_uids: bool

Whether to remove trace UIDs from the JSON representation (default True).

validate instance-attribute

validate: bool

Whether to validate the figure before serialization (default True).

FigureLoadArgs

Bases: TypedDict

Arguments for loading a Plotly figure.

FigureSerializer

FigureSerializer(
    *,
    dump_args: FigureDumpArgs | None = None,
    load_args: FigureLoadArgs | None = None
)

Bases: Serializer[Figure]

Serializer for Plotly figures.

Parameters:

  • dump_args

    (FigureDumpArgs | None, default: None ) –

    Arguments for dumping a Plotly figure.

  • load_args

    (FigureLoadArgs | None, default: None ) –

    Arguments for loading a Plotly figure.

Methods:

Attributes:

content_types class-attribute instance-attribute

content_types: tuple[str, ...] = ()

The content types that the serializer uses.

Used to get serializers by content type in the registry.

deserialize_config

deserialize_config(config: str) -> C

Deserialize the configuration from a JSON string.

deserialize_data

deserialize_data(content: SerializedData) -> Figure

Deserialize the given figure.

serialize_config

serialize_config(config: C) -> str

Serialize the configuration to a JSON string.

serialize_data

serialize_data(value: Figure) -> SerializedData

Serialize the given figure.