Skip to content

RankAxisConfig

RankAxisConfig dataclass

Configuration for the rank axis of a bar or word shift plot.

The rank axis is the axis along which tokens are listed in order of contribution.

Attributes:

Name Type Description
bar_width float

Amount of space, in pixels, that each rank occupies. This implicitly controls the height/width of the plot, depending on whether it is vertical/horizontal respectively

bar_padding float

Amount of space, given to padding between bars, as a fraction between 0 and 1. When 0, the bars touch; when close to 1, most of the visual space is padding (not bars). The bar thickness is bar_width * (1 - bar_padding)

axis_padding float

Amount of space given to adding space between the first and last bar and the axis. The space is a fraction between 0 and 1 of the bar_width. When 0, the first and last bar sit flush against the rank axis; when 1, padding equivalent to bar_width is added to the ends of the rank axis

title str | None

Label for the rank axis. If None, the title is hidden

title_color str | None

Color of the title. If None, Altair's default is used

title_fontsize float | None

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

label_color str | None

Color of the axis tick labels. If None, Altair's default is used

label_fontsize float | None

Font size of the axis tick labels, in pixels. If None, Altair's default is used

label_tick_values list[int] | None

Explicit list of rank values at which to place ticks. When set, takes precedence over label_tick_step. If None, ticks are placed according to label_tick_step

label_tick_step int | None

Spacing between rank tick marks (e.g. 5 places ticks at 5, 10, 15, …). If None, Altair's default tick placement is used. Ignored when label_tick_values is set

label_first_tick bool

Whether to include a tick at rank 1 in addition to the ticks defined by label_tick_step. Has no effect when label_tick_step is 1 or when label_tick_values is set

tick_color str | None

Color of the axis ticks. For the color of the tick labels, see label_color. If not None, overrides BorderConfig.color

grid bool

Whether to draw grid lines along the rank axis

grid_color str | None

Color of the grid lines

axis_color str | None

Color of the axis line. If not None, overrides BorderConfig.color

width float

Width of the axis, in pixels

Source