Skip to content

vmin/vmax deprecated kwargs work on 3 render functions but crash on render_images #612

Description

@timtreis

vmin/vmax deprecated kwargs work on 3 render functions but crash on render_images

Description

render_shapes, render_points, and render_labels all accept vmin/vmax via **kwargs and emit a helpful deprecation warning. render_images has a fixed signature with no **kwargs, so the same call crashes with TypeError: got an unexpected keyword argument 'vmin'. Users migrating from the old API face a confusing asymmetry across four otherwise-identical render functions.

Environment

spatialdata-plot: 0.3.4.dev (main, 5cfedc7)
spatialdata: 0.5.0
Python: 3.13

Minimal Reproducible Example

import matplotlib; matplotlib.use("Agg")
import matplotlib.pyplot as plt
import warnings
import dask; dask.config.set({"dataframe.query-planning": False})
import spatialdata as sd
import spatialdata_plot

sdata = sd.datasets.blobs(n_points=50)
img_key = list(sdata.images.keys())[0]
shapes_key = list(sdata.shapes.keys())[0]

# These three work (deprecation warning emitted):
with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    sdata.pl.render_shapes(shapes_key, vmin=0, vmax=1)
    print("render_shapes: OK")

# This crashes:
sdata.pl.render_images(img_key, vmin=0, vmax=200)
print("render_images: OK")

Expected vs. Actual

Expected: render_images emits the same deprecation warning as the other three functions and continues (directing users to use norm=Normalize(vmin=..., vmax=...)).

Actual: TypeError: PlotAccessor.render_images() got an unexpected keyword argument 'vmin'

Fix Sketch

Add **kwargs to render_images and copy the vmin/vmax deprecation guard from the other three functions (basic.py:301-302). Alternatively, explicitly document the asymmetry if it is intentional — though inconsistency across four sibling functions is a usability hazard regardless.

Labels: bug, images, priority: low


Triage tier: Tier 2

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions