Repository navigation
Fix per-line plot styles being ignored when plotting parameters - #287
Merged
Merged
Conversation
Since #271, ParameterAnalysis.plot and Analysis.plot_parameters passed coords=[x_axis] to plopp.plot. plopp implements coords= with DataArray.rename_dims, which drops the DataArray's name, and plopp looks up per-line style dicts (linestyle, marker, color, ...) by that name. All styles were therefore silently ignored: the ParameterAnalysis model was drawn as points instead of a dashed line, and legend labels were lost. Replace add_x_axis_coord with with_x_axis_dim, which makes the x-axis coordinate the dimension before plotting, so coords= is no longer needed. Add tests that render with plopp for real and check the line styles. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- with_x_axis_dim renames the dimension the Q coordinate lies along instead of assuming it is named 'Q', as plopp's coords= did. - tests/conftest.py pins the Agg backend, so tests that render for real don't open Tk windows and fail intermittently on Windows. - Document that passing plopp's coords= makes per-line styles be ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #287 +/- ##
===========================================
+ Coverage 98.15% 98.18% +0.03%
===========================================
Files 60 64 +4
Lines 6066 6243 +177
Branches 1022 1042 +20
===========================================
+ Hits 5954 6130 +176
- Misses 58 59 +1
Partials 54 54
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
henrikjacobsenfys
added a commit
that referenced
this pull request
Nov 12, 2026
The conflict resolution kept a call to add_x_axis_coord, which #287 replaced with with_x_axis_dim, and applied with_x_axis_dim to the dict of DataArrays instead of to the data and model Datasets. The Q^2 test took #287's assertions, which treat the plotted object as one Dataset. Co-Authored-By: Claude Fable 5.2 <[email protected]>
henrikjacobsenfys
added a commit
that referenced
this pull request
Nov 12, 2026
* Allow evaluating the ParameterAnalysis model on a custom Q grid calculate_model_dataset and plot take an optional Q (sc.Variable) so the model can be drawn on a finer grid than the data. Closes #200. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Validate the Q grid in ParameterAnalysis.plot and calculate_model_dataset Q must be a 1D sc.Variable with a unit of inverse length. plot checks it up front, so a bad Q is no longer silently ignored when there are no bindings to evaluate. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Validate Q with the shared _validate_and_convert_Q Replaces the ParameterAnalysis-specific check, so the Q grid follows the same rules as everywhere else: a single dimension named 'Q', a unit convertible to 1/angstrom, and positive values. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Keep the model dims as 'Q' and correct the plot comment Q is validated to have the single dimension 'Q', so the model array can keep dims=['Q'] as before. The comment said data and model are plotted as separate Datasets; they are passed as one dict of DataArrays. Co-Authored-By: Claude Fable 5.2 <[email protected]> * Fix the merge of develop into the finer-Q-grid branch The conflict resolution kept a call to add_x_axis_coord, which #287 replaced with with_x_axis_dim, and applied with_x_axis_dim to the dict of DataArrays instead of to the data and model Datasets. The Q^2 test took #287's assertions, which treat the plotted object as one Dataset. Co-Authored-By: Claude Fable 5.2 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Problem
Since #271,
ParameterAnalysis.plot()draws the model as points instead of a dashed line (visible in tutorial 1). Colours no longer pair data with model, and the legend labels are gone.Analysis.plot_parameters()is affected the same way: it loses its hollow markers and labels.Cause
#271 started passing
coords=[x_axis]toplopp.plot. plopp implementscoords=by callingDataArray.rename_dims. In scipp 26.9,rename_dimsdrops the DataArray'sname. plopp looks up per-line style dicts (linestyle={name: ...},marker,color, ...) by that name, so every style was silently ignored and plopp fell back to its default markers. Bothx_axis='Q'andx_axis='Q^2'were affected.Fix
add_x_axis_coordwithwith_x_axis_dim. It makes the x-axis coordinate the dimension before plotting, so we no longer passcoords=to plopp.Qcoordinate lies along, as plopp did, so data whose dimension isn't calledQstill works.**kwargsdocstrings that passingcoords=yourself makes plopp ignore the styles.tests/conftest.pypins matplotlib's Agg backend. Without it, tests that render for real open Tk windows on Windows and fail intermittently with Tcl errors.Tests
QandQ^2. They fail ondevelopand pass with this change.Qcoordinate on a dimension not namedQ.coords=kwarg.pixi run checkpasses, and so do the Bayesian sampling integration tests.An agent reviewed the change, and its findings are addressed in the second commit.
🤖 Generated with Claude Code