tanat.visualization.sequence.type package#

Subpackages#

Module contents#

Register BaseSequenceVizBuilder subtypes.

class tanat.visualization.sequence.type.BarplotVizBuilder(settings: dict | BaseVizSettings | None = None, *, allow_large: bool = False)[source]#

Bases: BaseSequenceVizBuilder

Builds bar charts from a SequencePool or an individual Sequence.

Typical usage via SequenceVisualizer:

SequenceVisualizer.barplot(show_as="count") \
    .title("Event counts") \
    .draw(pool, entity_feature="status") \
    .show()
SETTINGS_CLASS[source]#

alias of BarplotSettings

marker(*, alpha: float | None = None, edge_color: str | None = None, bar_width: float | None = None) BarplotVizBuilder[source]#

Configure bar visual properties. Chainable.

Parameters:
  • alpha – Opacity (0–1).

  • edge_color – Bar border color. None means no border.

  • bar_width – Width fraction of available slot, 0–1 (default 0.8).

x_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None) BarplotVizBuilder[source]#

Configure the x (horizontal) axis. Chainable.

Role depends on orientation:

  • "vertical" (default): categories on x, values on y → limit_min/limit_max are not meaningful here.

  • "horizontal": values on x, categories on y → use limit_min/limit_max to constrain the value range.

Parameters:
  • show – Hide the axis entirely when False.

  • label – Axis label text.

  • rotation – Tick label rotation in degrees.

  • limit_min – Minimum x value (meaningful in horizontal orientation only).

  • limit_max – Maximum x value (meaningful in horizontal orientation only).

y_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None) BarplotVizBuilder[source]#

Configure the y (vertical) axis. Chainable.

Role depends on orientation:

  • "vertical" (default): values on y, categories on x → use limit_min/limit_max to constrain the value range (e.g. limit_max=1.0 for rates).

  • "horizontal": categories on y, values on x → limit_min/limit_max are not meaningful here.

Parameters:
  • show – Hide the axis entirely when False.

  • label – Axis label text.

  • rotation – Tick label rotation in degrees.

  • limit_min – Minimum y value (meaningful in vertical orientation only).

  • limit_max – Maximum y value (meaningful in vertical orientation only).

class tanat.visualization.sequence.type.DistributionVizBuilder(settings: Any | None = None, *, allow_large: bool = False)[source]#

Bases: BaseSequenceVizBuilder

Builds state-occupancy distribution charts from a StateSequencePool.

Each time bin on the x-axis counts (or normalises) how many sequences are in each state at that point in time, using occupancy-based binning: a segment contributes to every bin it overlaps, not just the one containing its start.

Only compatible with state sequence types.

Typical usage via SequenceVisualizer:

SequenceVisualizer.distribution(mode="percentage", bin_size="1d") \
    .title("State distribution over time") \
    .colors("Set2") \
    .draw(pool, entity_feature="status") \
    .show()
SETTINGS_CLASS[source]#

alias of DistributionSettings

__init__(settings: Any | None = None, *, allow_large: bool = False) None[source]#
marker(*, alpha: float | None = None, line_width: float | None = None) DistributionVizBuilder[source]#

Configure fill visual properties. Chainable.

Parameters:
  • alpha – Opacity of the filled areas (0-1).

  • line_width – Width of the area boundary line.

x_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None, autofmt_xdate: bool | None = None) DistributionVizBuilder[source]#

Configure the time (x) axis. Chainable.

Parameters:
  • show – Hide the axis entirely when False.

  • label – Axis label text.

  • rotation – Tick label rotation in degrees.

  • limit_min – Left bound (zooms into a time window).

  • limit_max – Right bound (zooms into a time window).

  • autofmt_xdate – Auto-rotate date tick labels.

y_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None) DistributionVizBuilder[source]#

Configure the value (y) axis. Chainable.

Parameters:
  • show – Hide the axis entirely when False.

  • label – Axis label text.

  • rotation – Tick label rotation in degrees.

  • limit_min – Minimum y value.

  • limit_max – Maximum y value.

class tanat.visualization.sequence.type.SpanplotVizBuilder(settings: Any | None = None, *, allow_large: bool = False)[source]#

Bases: BaseSequenceVizBuilder

Builds duration distribution charts from a SequencePool or an individual Sequence.

Each point in the resulting chart represents one segment (interval or state occurrence). Distributions can be grouped by category label or by sequence ID.

Only compatible with state and interval sequence types: duration is undefined for events.

Typical usage via SequenceVisualizer:

SequenceVisualizer.spanplot(kind="violin", display_unit="hours") \
    .title("ICU stay durations by status") \
    .colors("Set2") \
    .draw(pool, entity_feature="status") \
    .show()
MAX_IDS: int = 30[source]#
SETTINGS_CLASS[source]#

alias of SpanplotSettings

__init__(settings: Any | None = None, *, allow_large: bool = False) None[source]#
marker(*, alpha: float | None = None, edge_color: str | None = None, point_size: float | None = None, line_width: float | None = None) SpanplotVizBuilder[source]#

Configure marker visual properties. Chainable.

Parameters:
  • alpha – Opacity (0–1).

  • edge_color – Marker/box border color. None means no border.

  • point_size – Scatter point diameter in points (strip kind only).

  • line_width – Box or violin outline thickness.

x_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None) SpanplotVizBuilder[source]#

Configure the x (horizontal) axis. Chainable.

Role depends on orientation:

  • "vertical" (default): group labels on x, durations on y.

  • "horizontal": durations on x, group labels on y. Use limit_min/limit_max to clip outliers.

Parameters:
  • show – Hide the axis entirely when False.

  • label – Axis label text.

  • rotation – Tick label rotation in degrees.

  • limit_min – Minimum x value (meaningful in horizontal orientation).

  • limit_max – Maximum x value (meaningful in horizontal orientation).

y_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None) SpanplotVizBuilder[source]#

Configure the y (vertical) axis. Chainable.

Role depends on orientation:

  • "vertical" (default): durations on y, group labels on x. Use limit_min/limit_max to clip outliers.

  • "horizontal": group labels on y, durations on x.

Parameters:
  • show – Hide the axis entirely when False.

  • label – Axis label text (e.g. "Duration (hours)")..

  • rotation – Tick label rotation in degrees.

  • limit_min – Minimum y value (meaningful in vertical orientation).

  • limit_max – Maximum y value (meaningful in vertical orientation).

class tanat.visualization.sequence.type.TimelineVizBuilder(settings: Any | None = None, *, allow_large: bool = False)[source]#

Bases: BaseSequenceVizBuilder

Builds timeline charts from a SequencePool or an individual Sequence.

Typical usage via SequenceVisualizer:

SequenceVisualizer.timeline() \
    .title("Status over time") \
    .draw(pool, entity_feature="status") \
    .show()
MAX_IDS: int = 30[source]#
MAX_MARKERS: int = 1000[source]#
SETTINGS_CLASS[source]#

alias of TimelineSettings

__init__(settings: Any | None = None, *, allow_large: bool = False) None[source]#
marker(*, alpha: float | None = None, edge_color: str | None = None, size: float | None = None, bar_height: float | None = None, shape: str | None = None) TimelineVizBuilder[source]#

Configure marker visual properties. Chainable.

Parameters:
  • alpha – Opacity (0–1).

  • edge_color – Marker border color. None means no border.

  • size – Scatter point size (event sequence only).

  • bar_height – Height fraction of each row slot, 0–1 (interval/state pools only).

  • shape – Matplotlib marker string, e.g. "o", "s", "^" (event sequence only).

x_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None, autofmt_xdate: bool | None = None) TimelineVizBuilder[source]#

Configure the time (x) axis. Chainable.

Parameters:
  • show – Hide the axis entirely when False.

  • label – Axis label text.

  • rotation – Tick label rotation in degrees.

  • limit_min – Left bound (zooms into a time window).

  • limit_max – Right bound (zooms into a time window).

  • autofmt_xdate – Auto-rotate date tick labels (useful for dense datetime scales).

y_axis(*, show: bool | None = None, label: str | None = None) TimelineVizBuilder[source]#

Configure the sequence / category (y) axis. Chainable.

rotation and limit_min/limit_max are intentionally not exposed: y-positions are integer ranks managed internally, so rotating string labels or constraining numeric limits is not meaningful here.

Parameters:
  • show – Hide the axis entirely when False (useful when y-axis labels are too dense to read).

  • label – Axis label text.