You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: make plot_array overlays respect imshow_origin #565
Development tracker for the reproducible community report now preserved as PyAutoLabs Discussion #14, originally PyAutoArray#535.
plot_array passes origin=origin_imshow to the image raster, but vector overlays (mask, border, origin, grid, mesh grid, positions, lines, and quiver coordinates) remain in unchanged data coordinates. With imshow_origin: lower, this silently mirrors the raster relative to its overlays.
The defect is still present on main as of 2026-09-21.
Acceptance
imshow_origin: upper retains current behaviour.
imshow_origin: lower keeps overlays registered to the corresponding image features.
Add a regression covering at least an asymmetric positions/lines overlay so a visually plausible but misregistered plot cannot silently recur.
Preserve the distinction between display orientation and PyAutoArray's internal y-coordinate convention.
Close this issue when the fix is merged, then mark the settling response in Discussion Get version number from env #14 as accepted.
Plan (approved 2026-10-07, Claude CLI /community → /start_dev)
Mind prompt: active/imshow_origin_lower_overlays.md. Branch feature/imshow-origin-lower-overlays.
High-level
Add a helper in autoarray/plot/utils.py that reflects overlay y about the extent midpoint when imshow_origin == "lower" (Discussion Get version number from env #14 option 1, the pattern _apply_contours already uses). "upper" is unchanged.
Apply it in plot_array (autoarray/plot/array.py) to every overlay: mask edge, border, origin marker, grid, mesh grid, positions, lines, regions polygons, quiver (position and dy, which also flips sign). Patches are left as-is and documented as unsupported under "lower".
Audit plot/inversion.py and plot/grid.py for the same raster + overlay pairing and apply the helper wherever a raster carries the origin.
Add the Discussion's origin-agnostic regression test to test_autoarray/plot/, parametrised over both origins; confirmed red on unfixed main under "lower".
Document on the imshow_origin config key that it changes presentation only: under "lower" the displayed y axis and reported model y parameters disagree in sign.
Detailed
autoarray/plot/utils.py: _overlay_yx_for_origin(yx, extent, origin_imshow) — returns yx unchanged for "upper"; for "lower" returns a copy with yx[:, 0] = extent[2] + extent[3] - yx[:, 0]. None passes through. A sibling for quiver negates column 2 (dy) as well.
autoarray/plot/array.py: after extent is resolved, wrap mask, border, origin, grid, mesh_grid, each positions entry, each lines entry, each regions polygon (pass through to plot_regions pre-reflected) and vector_yx through the helper before drawing. _apply_contours is untouched.
plot/inversion.py lines ~159/170 and plot/grid.py ~128–174: apply only where the panel's raster is an imshow honouring origin_imshow; leave pure scatter panels alone.
test_autoarray/plot/test_array.py (new): test__positions_marker_lands_on_block[upper|lower] per the Discussion's marker_lands_on_block; plus a lines variant. Config set via conf.instance["visualize"]["general"]["general"]["imshow_origin"] and restored in finally.
autoarray/config/visualize/general.yaml comment on imshow_origin: presentation-only caveat.
Run python -m pytest test_autoarray/plot/ test_autoarray/ ; downstream smoke not required (private helpers, no public API change).
Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary.
PR opened: #616 (branch feature/imshow-origin-lower-overlays, 93961c6). Fix covers plot_array and the uniform rectangular mesh path of plot_inversion_reconstruction; regression tests red on unfixed main for every lower case. Known out-of-scope quirk left for a follow-up: zoom_to_brightest in plot_inversion_reconstruction sets axis limits from an unreflected zoom extent, so under lower on a uniform mesh the zoom window can sit over the wrong part of the image.
Activity
Jammy2211 commentedon Oct 7, 2026
Plan (approved 2026-10-07, Claude CLI /community → /start_dev)
Mind prompt:
active/imshow_origin_lower_overlays.md. Branchfeature/imshow-origin-lower-overlays.High-level
autoarray/plot/utils.pythat reflects overlayyabout the extent midpoint whenimshow_origin == "lower"(Discussion Get version number from env #14 option 1, the pattern_apply_contoursalready uses)."upper"is unchanged.plot_array(autoarray/plot/array.py) to every overlay: mask edge, border, origin marker, grid, mesh grid, positions, lines, regions polygons, quiver (position anddy, which also flips sign). Patches are left as-is and documented as unsupported under"lower".plot/inversion.pyandplot/grid.pyfor the same raster + overlay pairing and apply the helper wherever a raster carries the origin.test_autoarray/plot/, parametrised over both origins; confirmed red on unfixed main under"lower".imshow_originconfig key that it changes presentation only: under"lower"the displayed y axis and reported model y parameters disagree in sign.Detailed
autoarray/plot/utils.py:_overlay_yx_for_origin(yx, extent, origin_imshow)— returnsyxunchanged for"upper"; for"lower"returns a copy withyx[:, 0] = extent[2] + extent[3] - yx[:, 0].Nonepasses through. A sibling for quiver negates column 2 (dy) as well.autoarray/plot/array.py: afterextentis resolved, wrapmask,border,origin,grid,mesh_grid, eachpositionsentry, eachlinesentry, eachregionspolygon (pass through toplot_regionspre-reflected) andvector_yxthrough the helper before drawing._apply_contoursis untouched.plot/inversion.pylines ~159/170 andplot/grid.py~128–174: apply only where the panel's raster is animshowhonouringorigin_imshow; leave pure scatter panels alone.test_autoarray/plot/test_array.py(new):test__positions_marker_lands_on_block[upper|lower]per the Discussion'smarker_lands_on_block; plus alinesvariant. Config set viaconf.instance["visualize"]["general"]["general"]["imshow_origin"]and restored infinally.autoarray/config/visualize/general.yamlcomment onimshow_origin: presentation-only caveat.python -m pytest test_autoarray/plot/ test_autoarray/; downstream smoke not required (private helpers, no public API change).Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary.
Community: reply on https://github.com/orgs/PyAutoLabs/discussions/14 after merge/release, crediting the reproducer and test.
Jammy2211 commentedon Oct 7, 2026
PR opened: #616 (branch
feature/imshow-origin-lower-overlays, 93961c6). Fix coversplot_arrayand the uniform rectangular mesh path ofplot_inversion_reconstruction; regression tests red on unfixed main for everylowercase. Known out-of-scope quirk left for a follow-up:zoom_to_brightestinplot_inversion_reconstructionsets axis limits from an unreflected zoom extent, so underloweron a uniform mesh the zoom window can sit over the wrong part of the image.Merge pull request #616 from PyAutoLabs/feature/imshow-origin-lower-o…