@@ -166,6 +166,7 @@ def render_shapes(
166
166
cmap : Colormap | str | None = None ,
167
167
norm : bool | Normalize = False ,
168
168
scale : float | int = 1.0 ,
169
+ method : str | None = None ,
169
170
table_name : str | None = None ,
170
171
** kwargs : Any ,
171
172
) -> sd .SpatialData :
@@ -219,6 +220,9 @@ def render_shapes(
219
220
Colormap normalization for continuous annotations.
220
221
scale : float | int, default 1.0
221
222
Value to scale circles, if present.
223
+ method : str | None, optional
224
+ Whether to use 'matplotlib' and 'datashader'. When None, the method is
225
+ chosen based on the size of the data.
222
226
table_name: str | None
223
227
Name of the table containing the color(s) columns. If one name is given than the table is used for each
224
228
spatial element to be plotted if the table annotates it. If you want to use different tables for particular
@@ -253,6 +257,7 @@ def render_shapes(
253
257
norm = norm ,
254
258
scale = scale ,
255
259
table_name = table_name ,
260
+ method = method ,
256
261
)
257
262
258
263
sdata = self ._copy ()
@@ -281,6 +286,8 @@ def render_shapes(
281
286
fill_alpha = param_values ["fill_alpha" ],
282
287
transfunc = kwargs .get ("transfunc" , None ),
283
288
table_name = param_values ["table_name" ],
289
+ zorder = n_steps ,
290
+ method = method ,
284
291
)
285
292
n_steps += 1
286
293
@@ -298,6 +305,7 @@ def render_points(
298
305
cmap : Colormap | str | None = None ,
299
306
norm : None | Normalize = None ,
300
307
size : float | int = 1.0 ,
308
+ method : str | None = None ,
301
309
table_name : str | None = None ,
302
310
** kwargs : Any ,
303
311
) -> sd .SpatialData :
@@ -342,6 +350,9 @@ def render_points(
342
350
Colormap normalization for continuous annotations.
343
351
size : float | int, default 1.0
344
352
Size of the points
353
+ method : str | None, optional
354
+ Whether to use 'matplotlib' and 'datashader'. When None, the method is
355
+ chosen based on the size of the data.
345
356
table_name: str | None
346
357
Name of the table containing the color(s) columns. If one name is given than the table is used for each
347
358
spatial element to be plotted if the table annotates it. If you want to use different tables for particular
@@ -368,6 +379,12 @@ def render_points(
368
379
table_name = table_name ,
369
380
)
370
381
382
+ if method is not None :
383
+ if not isinstance (method , str ):
384
+ raise TypeError ("Parameter 'method' must be a string." )
385
+ if method not in ["matplotlib" , "datashader" ]:
386
+ raise ValueError ("Parameter 'method' must be either 'matplotlib' or 'datashader'." )
387
+
371
388
sdata = self ._copy ()
372
389
sdata = _verify_plotting_tree (sdata )
373
390
n_steps = len (sdata .plotting_tree .keys ())
@@ -391,6 +408,8 @@ def render_points(
391
408
transfunc = kwargs .get ("transfunc" , None ),
392
409
size = param_values ["size" ],
393
410
table_name = param_values ["table_name" ],
411
+ zorder = n_steps ,
412
+ method = method ,
394
413
)
395
414
n_steps += 1
396
415
@@ -504,6 +523,7 @@ def render_images(
504
523
alpha = param_values ["alpha" ],
505
524
percentiles_for_norm = param_values ["percentiles_for_norm" ],
506
525
scale = param_values ["scale" ],
526
+ zorder = n_steps ,
507
527
)
508
528
n_steps += 1
509
529
@@ -515,14 +535,14 @@ def render_labels(
515
535
element : str | None = None ,
516
536
color : str | None = None ,
517
537
groups : list [str ] | str | None = None ,
518
- contour_px : int = 3 ,
538
+ contour_px : int | None = 3 ,
519
539
outline : bool = False ,
520
540
palette : list [str ] | str | None = None ,
521
541
cmap : Colormap | str | None = None ,
522
542
norm : Normalize | None = None ,
523
543
na_color : ColorLike | None = (0.0 , 0.0 , 0.0 , 0.0 ),
524
544
outline_alpha : float | int = 1.0 ,
525
- fill_alpha : float | int = 0.3 ,
545
+ fill_alpha : float | int = 0.4 ,
526
546
scale : str | None = None ,
527
547
table_name : str | None = None ,
528
548
** kwargs : Any ,
@@ -626,6 +646,7 @@ def render_labels(
626
646
transfunc = kwargs .get ("transfunc" , None ),
627
647
scale = param_values ["scale" ],
628
648
table_name = param_values ["table_name" ],
649
+ zorder = n_steps ,
629
650
)
630
651
n_steps += 1
631
652
return sdata
0 commit comments