Skip to content

feat(plot): add share_axes to show_segmentation for synced viewing#1405

Open
shcrela wants to merge 1 commit into
MouseLand:mainfrom
shcrela:feature/shared-axes-plotting
Open

feat(plot): add share_axes to show_segmentation for synced viewing#1405
shcrela wants to merge 1 commit into
MouseLand:mainfrom
shcrela:feature/shared-axes-plotting

Conversation

@shcrela

@shcrela shcrela commented Feb 11, 2026

Copy link
Copy Markdown

Description

This PR introduces synchronized zooming and panning to the show_segmentation function by adding an optional share_axes parameter.

When analyzing high-resolution microscopy data, users frequently need to inspect fine details across different views (original image, masks, flows, and outlines). Currently, these subplots have independent coordinate systems. Enabling share_axes links them, allowing for a "zoom-one-zoom-all" experience in interactive Matplotlib backends.

Changes

  • New Parameter: Added share_axes=False to show_segmentation.
  • Refactor: Reorganized the subplot creation logic into a loop. This reduces code duplication and allows subsequent axes to cleanly reference the first axis (ax0) for sharing.
  • Documentation Alignment: Added the missing seg_norm parameter to the function signature to match the existing docstring.
  • Preservation: Maintained all original image processing, normalization, and file-saving logic to ensure no breaking changes for existing workflows.

Testing

Verified that:

  1. Panning/zooming on the original image updates the masks and flows views when share_axes=True.
  2. The function still behaves as expected (independent axes) when share_axes=False.
  3. File saving via file_name still outputs correctly.
Refactor subplot creation into a loop to allow optional shared x and y axes between the image, outlines, masks, and flows.
@mrariden

Copy link
Copy Markdown
Collaborator

Hi @shcrela please share some images of the output before and after to help visualize the improvement

@shcrela

shcrela commented Feb 16, 2026

Copy link
Copy Markdown
Author

Actual zooming and panning:
actual_zoom_pan

Proposed, synced, zooming and panning:

synced_zoom_pan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants