Axis¶
Axis value class for axis configuration.
Ferrum — a statistical visualization library with a Rust core.
Axis
dataclass
¶
Per-channel axis configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Axis title text. Pass |
_UNSET
|
orient
|
str
|
Axis orientation ("top", "bottom", "left", "right"). |
None
|
ticks
|
bool
|
Show tick marks. |
True
|
tick_count
|
int
|
Suggested number of ticks. |
None
|
tick_extra
|
bool
|
Include extra tick at domain boundary. |
False
|
tick_min_step
|
float
|
Minimum step between ticks. |
None
|
grid
|
bool
|
Show grid lines. |
True
|
grid_dash
|
list[float]
|
Grid line dash pattern. |
None
|
grid_width
|
float
|
Grid line width. |
None
|
grid_color
|
str
|
Grid line color. |
None
|
grid_opacity
|
float
|
Grid line opacity. |
None
|
labels
|
bool
|
Show tick labels. |
True
|
label_angle
|
float
|
Tick label rotation angle. |
None
|
label_flush
|
bool
|
Flush the first and last tick labels against the axis ends so they do
not overhang the plot area. Defaults to |
False
|
label_overlap
|
str
|
Label overlap strategy ("greedy", "parity", "rotate"). Defaults to
|
'greedy'
|
label_format
|
str
|
d3-format string for labels. |
None
|
label_format_type
|
str
|
Format type ("number", "time"). |
None
|
label_font_size
|
float
|
Label font size. |
None
|
label_color
|
str
|
Label color. |
None
|
domain
|
bool
|
Show axis domain line. |
True
|
domain_width
|
float
|
Domain line width. |
None
|
domain_color
|
str
|
Domain line color. |
None
|
offset
|
float
|
Axis offset from plot area. |
None
|
translate
|
float
|
Pixel translation. |
None
|
min_band
|
float
|
Lower bound for the reserved axis margin band, in pixels. |
None
|
max_band
|
float
|
Upper bound for the reserved axis margin band, in pixels. .. deprecated:: 0.17.0
|
None
|
title_orient
|
str
|
Title orientation. |
None
|
title_font_size
|
float
|
Title font size. |
None
|
title_color
|
str
|
Title color. |
None
|
title_padding
|
float
|
Title padding from axis. |
None
|
values
|
list
|
Explicit tick values. |
None
|
zindex
|
int
|
Z-index for layering. |
None
|
label_map
|
dict[str, str]
|
Mapping from original tick-label text to display text. Applied in the Python layer at render time by renaming the corresponding column values in the DataFrame before Rust computes the scale domain. Keys not present in the data are silently ignored. Example — rename categorical axis labels:: |
None
|
Examples:
>>> import ferrum as fm
>>> ax = fm.Axis(title="Speed (km/h)", label_angle=-45)
>>> ax.title
'Speed (km/h)'
>>> ax.to_dict()
{'title': 'Speed (km/h)', 'label_angle': -45}
to_dict ¶
Serialize to dict for the renderer, omitting None, defaults, and Python-only fields.