Skip to content

LabelConfig

LabelConfig dataclass

Configuration for the token labels of a bar or word shift plot.

Controls how token text is positioned, oriented, and styled relative to its bar.

Attributes:

Name Type Description
pad float

Padding between a label and the end of its bar, in pixels

color str

Font color of the label text

size float | None

Font size of the label text, in pixels. If None, Altair's default is used

weight str | int

Font weight of the label text. Accepts CSS font-weight strings (e.g. "normal", "bold") or numeric weights (e.g. 400, 700)

rotation float | None

Rotation of the label text, in degrees. If None, defaults are chosen based on the chart orientation (0° when the chart is vertical, 270° when horizontal)

mirror_rotation bool

When True, labels on negative-direction bars are rotated by -rotation so they read in a complementary orientation to the positive labels. When False, all labels share the same rotation

on_bar_ends bool

When True, labels sit at the tip of their bar. When False, labels sit at the score-axis baseline (the zero line)

font_width_to_height_ratio float

Assumed ratio of character width to character height for the label font. Used by autoscaling to estimate label widths from font size

borrow_symbol str | None

A symbol appended to the end of a token's label indicating that it "borrowed" a score across corpora. If None, no symbol is appended. For detail on borrowing, see the imputation documentation for lexicon scoring

Source