2828from xarray import DataArray , DataTree
2929
3030from spatialdata_plot ._accessor import register_spatial_data_accessor
31- from spatialdata_plot ._logging import _log_context , logger
31+ from spatialdata_plot ._logging import _log_context
3232from spatialdata_plot .pl .render import (
3333 _draw_channel_legend ,
3434 _render_images ,
@@ -190,7 +190,8 @@ def render_shapes(
190190 shape : Literal ["circle" , "hex" , "visium_hex" , "square" ] | None = None ,
191191 colorbar : bool | str | None = "auto" ,
192192 colorbar_params : dict [str , object ] | None = None ,
193- ** kwargs : Any ,
193+ datashader_reduction : Literal ["sum" , "mean" , "any" , "count" , "std" , "var" , "max" , "min" ] | None = None ,
194+ transfunc : Callable [[float ], float ] | None = None ,
194195 ) -> sd .SpatialData :
195196 """
196197 Render shapes elements in SpatialData.
@@ -279,15 +280,10 @@ def render_shapes(
279280 specified, the shapes are converted to a circle/hexagon/square before rendering. If "visium_hex" is
280281 specified, the shapes are assumed to be Visium spots and the size of the hexagons is adjusted to be adjacent
281282 to each other.
282-
283- **kwargs : Any
284- Additional arguments for customization. This can include:
285-
286- datashader_reduction : Literal[
287- "sum", "mean", "any", "count", "std", "var", "max", "min"
288- ], default: "max"
289- Reduction method for datashader when coloring by continuous values. Defaults to 'max'.
290-
283+ datashader_reduction : Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None, optional
284+ Reduction method for datashader when coloring by continuous values. When ``None``, defaults to ``"max"``.
285+ transfunc : Callable[[float], float] | None, optional
286+ Optional transformation applied to the continuous color vector before normalization and colormap mapping.
291287
292288 Notes
293289 -----
@@ -300,8 +296,6 @@ def render_shapes(
300296 sd.SpatialData
301297 A copy of the SpatialData object with the rendering parameters stored in its plotting tree.
302298 """
303- if "vmin" in kwargs or "vmax" in kwargs :
304- logger .warning ("`vmin` and `vmax` are deprecated. Pass matplotlib `Normalize` object to norm instead." )
305299 params_dict = _validate_shape_render_params (
306300 self ._sdata ,
307301 element = element ,
@@ -320,7 +314,7 @@ def render_shapes(
320314 table_layer = table_layer ,
321315 shape = shape ,
322316 method = method ,
323- ds_reduction = kwargs . get ( " datashader_reduction" ) ,
317+ ds_reduction = datashader_reduction ,
324318 colorbar = colorbar ,
325319 colorbar_params = colorbar_params ,
326320 gene_symbols = gene_symbols ,
@@ -351,7 +345,7 @@ def render_shapes(
351345 palette = param_values ["palette" ],
352346 outline_alpha = final_outline_alpha ,
353347 fill_alpha = param_values ["fill_alpha" ],
354- transfunc = kwargs . get ( " transfunc" ) ,
348+ transfunc = transfunc ,
355349 table_name = param_values ["table_name" ],
356350 table_layer = param_values ["table_layer" ],
357351 shape = param_values ["shape" ],
@@ -384,7 +378,8 @@ def render_points(
384378 gene_symbols : str | None = None ,
385379 colorbar : bool | str | None = "auto" ,
386380 colorbar_params : dict [str , object ] | None = None ,
387- ** kwargs : Any ,
381+ datashader_reduction : Literal ["sum" , "mean" , "any" , "count" , "std" , "var" , "max" , "min" ] | None = None ,
382+ transfunc : Callable [[float ], float ] | None = None ,
388383 ) -> sd .SpatialData :
389384 """
390385 Render points elements in SpatialData.
@@ -452,22 +447,16 @@ def render_points(
452447 Column name in :attr:`sdata.table.var` to use for looking up ``color``. Use this when
453448 ``var_names`` are e.g. ENSEMBL IDs but you want to refer to genes by their symbols stored
454449 in another column of ``var``. Mimics scanpy's ``gene_symbols`` parameter.
455-
456- **kwargs : Any
457- Additional arguments for customization. This can include:
458-
459- datashader_reduction : Literal[
460- "sum", "mean", "any", "count", "std", "var", "max", "min"
461- ], default: "sum"
462- Reduction method for datashader when coloring by continuous values. Defaults to 'sum'.
450+ datashader_reduction : Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None, optional
451+ Reduction method for datashader when coloring by continuous values. When ``None``, defaults to ``"sum"``.
452+ transfunc : Callable[[float], float] | None, optional
453+ Optional transformation applied to the continuous color vector before normalization and colormap mapping.
463454
464455 Returns
465456 -------
466457 sd.SpatialData
467458 A copy of the SpatialData object with the rendering parameters stored in its plotting tree.
468459 """
469- if "vmin" in kwargs or "vmax" in kwargs :
470- logger .warning ("`vmin` and `vmax` are deprecated. Pass matplotlib `Normalize` object to norm instead." )
471460 params_dict = _validate_points_render_params (
472461 self ._sdata ,
473462 element = element ,
@@ -481,7 +470,7 @@ def render_points(
481470 size = size ,
482471 table_name = table_name ,
483472 table_layer = table_layer ,
484- ds_reduction = kwargs . get ( " datashader_reduction" ) ,
473+ ds_reduction = datashader_reduction ,
485474 colorbar = colorbar ,
486475 colorbar_params = colorbar_params ,
487476 gene_symbols = gene_symbols ,
@@ -511,7 +500,7 @@ def render_points(
511500 cmap_params = cmap_params ,
512501 palette = param_values ["palette" ],
513502 alpha = param_values ["alpha" ],
514- transfunc = kwargs . get ( " transfunc" ) ,
503+ transfunc = transfunc ,
515504 size = param_values ["size" ],
516505 table_name = param_values ["table_name" ],
517506 table_layer = param_values ["table_layer" ],
@@ -730,7 +719,7 @@ def render_labels(
730719 table_name : str | None = None ,
731720 table_layer : str | None = None ,
732721 gene_symbols : str | None = None ,
733- ** kwargs : Any ,
722+ transfunc : Callable [[ float ], float ] | None = None ,
734723 ) -> sd .SpatialData :
735724 """
736725 Render labels elements in SpatialData.
@@ -806,14 +795,14 @@ def render_labels(
806795 Column name in :attr:`sdata.table.var` to use for looking up ``color``. Use this when
807796 ``var_names`` are e.g. ENSEMBL IDs but you want to refer to genes by their symbols stored
808797 in another column of ``var``. Mimics scanpy's ``gene_symbols`` parameter.
798+ transfunc : Callable[[float], float] | None, optional
799+ Optional transformation applied to the continuous color vector before normalization and colormap mapping.
809800
810801 Returns
811802 -------
812803 sd.SpatialData
813804 A copy of the SpatialData object with the rendering parameters stored in its plotting tree.
814805 """
815- if "vmin" in kwargs or "vmax" in kwargs :
816- logger .warning ("`vmin` and `vmax` are deprecated. Pass matplotlib `Normalize` object to norm instead." )
817806 params_dict = _validate_label_render_params (
818807 self ._sdata ,
819808 element = element ,
@@ -859,7 +848,7 @@ def render_labels(
859848 scale = param_values ["scale" ],
860849 table_name = param_values ["table_name" ],
861850 table_layer = param_values ["table_layer" ],
862- transfunc = kwargs . get ( " transfunc" ) ,
851+ transfunc = transfunc ,
863852 zorder = n_steps ,
864853 colorbar = param_values ["colorbar" ],
865854 colorbar_params = param_values ["colorbar_params" ],
0 commit comments