Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scverse/spatialdata-plot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: scverse/spatialdata-plot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: feature/render-graph
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 6 commits
  • 9 files changed
  • 2 contributors

Commits on Apr 16, 2026

  1. Add end-to-end tests for render_graph

    Three visual regression tests covering the highest-value scenarios:
    - Basic graph overlay on shapes (KNN connectivity edges)
    - Graph overlay on labels with background image (most common real-world case)
    - Group-filtered graph (only edges between specified cell types)
    
    Tests will fail until render_graph is implemented.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    timtreis and claude committed Apr 16, 2026
    Configuration menu
    Copy the full SHA
    433df0f View commit details
    Browse the repository at this point in the history
  2. Implement render_graph for spatial connectivity visualization

    Adds `sdata.pl.render_graph()` to render spatial graph edges from
    adjacency matrices stored in table.obsp, using element centroids
    for coordinates. Supports shapes, points, and labels elements via
    spatialdata.get_centroids().
    
    Key features:
    - connectivity_key accepts full obsp key or prefix (auto-resolves)
    - element and table_name auto-discovered when unambiguous
    - groups + group_key filtering (both-endpoints semantics)
    - Rasterized LineCollection for performance
    - No networkx dependency (direct sparse matrix to line segments)
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    timtreis and claude committed Apr 16, 2026
    Configuration menu
    Copy the full SHA
    855ed32 View commit details
    Browse the repository at this point in the history
  3. Address adversarial review findings

    - Drop **kwargs from render_graph() and _render_graph() — the deferred
      execution pattern can't forward arbitrary kwargs, matching how other
      render functions use kwargs.get() for named options only
    - Add adjacency matrix shape validation against table.n_obs to catch
      subset graphs stored in multi-region tables
    - Fix CS dispatch to use get_transformation() for element-level CS
      membership instead of type-level has_shapes/has_labels flags
    - Vectorize edge filtering: replace Python-loop set lookups with
      numpy boolean arrays (has_coord + np.isin for groups)
    - Remove dead line (dict overwritten immediately)
    - Use triu(k=1) to skip self-loops at the sparse level
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    timtreis and claude committed Apr 16, 2026
    Configuration menu
    Copy the full SHA
    ed78508 View commit details
    Browse the repository at this point in the history
  4. Add test coverage for auto-discovery, empty graph, and error paths

    - Auto-discovery: render_graph() with no args finds the single table/element
    - Empty graph: zero-edge adjacency matrix renders without error
    - Error paths: missing obsp key, missing element, groups without group_key
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    timtreis and claude committed Apr 16, 2026
    Configuration menu
    Copy the full SHA
    9b1463e View commit details
    Browse the repository at this point in the history
  5. Remove unreachable adjacency shape validation

    AnnData rejects mismatched obsp matrices at assignment time,
    making this check dead code.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    timtreis and claude committed Apr 16, 2026
    Configuration menu
    Copy the full SHA
    4a50ed7 View commit details
    Browse the repository at this point in the history
  6. Replace baseline images with Linux/CI-generated versions

    Initial baselines were generated on macOS/arm64. Matplotlib anti-aliasing
    produces subtly different output on Linux, causing CI failures with RMS
    values 27-37 (tolerance 15). CI-generated images are byte-identical across
    Python 3.11, 3.14-stable, and 3.14-pre.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    timtreis and claude committed Apr 16, 2026
    Configuration menu
    Copy the full SHA
    c190858 View commit details
    Browse the repository at this point in the history
Loading