Skip to content

Add display titles for coord/dim axis labels with per-instrument overrides#918

Open
SimonHeybrock wants to merge 1 commit into
mainfrom
coord-dim-titles
Open

Add display titles for coord/dim axis labels with per-instrument overrides#918
SimonHeybrock wants to merge 1 commit into
mainfrom
coord-dim-titles

Conversation

@SimonHeybrock
Copy link
Copy Markdown
Member

@SimonHeybrock SimonHeybrock commented May 6, 2026

Summary

Plot axis labels were locked to the raw coord/dim names, so the only way to display a dim differently (e.g. detector_number as "Pixel ID", or wavelength as λ) was to rewrite the data with per-view transforms. This adds a configurable display title for coord/dim names, mirroring the existing source_metadata pattern. A global DEFAULT_DIM_TITLES map (λ, 2θ, d-spacing, time of arrival, …) is merged with optional per-instrument Instrument.dim_titles overrides, threaded through TitleResolver to the HoloViews converters via a dim_label callback. LOKI now uses it to display detector_number as "Pixel ID".

Closes #764 - note that we are not adding a description for now as it did not seems very useful. Should be easy to extend later if we find a use.

What this is not

This does not add a runtime user-facing config options for per-plot titles. Titles defined here are set in the package and are thus fixed (code change required to change title). Adding a plotter config option is a potential future enhancement.

Test plan

  • Open a LOKI plot using the detector_number dim (e.g. monitor_counts_per_pixel) and verify the X-axis label reads "Pixel ID".
  • Open a plot with a wavelength axis and verify the label reads "λ".
  • Open a plot using a dim with no entry in DEFAULT_DIM_TITLES or per-instrument overrides and verify it still falls back to the raw dim name.

Plot axis labels were locked to raw coord/dim names, forcing per-view data
transforms (e.g. dim renames) just to cosmetically relabel an axis. Mirror
the existing `source_metadata` pattern: a global `DEFAULT_DIM_TITLES` map
(λ, 2θ, d-spacing, time of arrival, ...) plus optional per-instrument
`Instrument.dim_titles` overrides, threaded through `TitleResolver` and the
HoloViews converters via a `dim_label` callback. LOKI uses it to display
`detector_number` as "Pixel ID".

Refs #764.
@SimonHeybrock SimonHeybrock changed the title dashboard: configurable display titles for coord/dim axis labels Add configurable display titles for coord/dim axis labels May 6, 2026
@SimonHeybrock SimonHeybrock changed the title Add configurable display titles for coord/dim axis labels Add display titles for coord/dim axis labels with per-instrument overrides May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coord/dimension titles?

1 participant