Currently, the axis-item labels for an array cannot depend on multiple dimensions, but sometimes the meaning of an axis depends on another dimension that is sliced into.
This interpretation should be coherent so long as the axis-item labels named array is a subset of the array to be rendered.
In general, it would be great if axis_item_labels could accept Penzai named arrays/Jax arrays (and internally cast each to a list or equivalent so the object is json-serializable).
import treescope
from penzai import pz
# dimension-dependent axis-item labels:
# should render different labels for each slice of `offset`
axis_item_labels = pz.nx.ones({"x": 10}) * pz.nx.arange("y", 10) + pz.nx.arange("offset", 3)
treescope.render_array(pz.nx.ones({"offset": 3, "x": 10, "y": 10}), axis_item_labels=axis_item_labels)
# item labels for x and y:
treescope.render_array(pz.nx.ones({"x": 10, "y": 10}), axis_item_labels=[pz.nx.arange("x", 10), pz.nx.arange("y", 10)])
Currently, the axis-item labels for an array cannot depend on multiple dimensions, but sometimes the meaning of an axis depends on another dimension that is sliced into.
This interpretation should be coherent so long as the axis-item labels named array is a subset of the array to be rendered.
In general, it would be great if
axis_item_labelscould accept Penzai named arrays/Jax arrays (and internally cast each to a list or equivalent so the object is json-serializable).