Add display titles for coord/dim axis labels with per-instrument overrides#918
Open
SimonHeybrock wants to merge 1 commit into
Open
Add display titles for coord/dim axis labels with per-instrument overrides#918SimonHeybrock wants to merge 1 commit into
SimonHeybrock wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plot axis labels were locked to the raw coord/dim names, so the only way to display a dim differently (e.g.
detector_numberas "Pixel ID", orwavelengthas λ) was to rewrite the data with per-view transforms. This adds a configurable display title for coord/dim names, mirroring the existingsource_metadatapattern. A globalDEFAULT_DIM_TITLESmap (λ, 2θ, d-spacing, time of arrival, …) is merged with optional per-instrumentInstrument.dim_titlesoverrides, threaded throughTitleResolverto the HoloViews converters via adim_labelcallback. LOKI now uses it to displaydetector_numberas "Pixel ID".Closes #764 - note that we are not adding a
descriptionfor 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
detector_numberdim (e.g.monitor_counts_per_pixel) and verify the X-axis label reads "Pixel ID".wavelengthaxis and verify the label reads "λ".DEFAULT_DIM_TITLESor per-instrument overrides and verify it still falls back to the raw dim name.