spatialdata-plot
spatialdata-plot copied to clipboard
Make plotting parameters keyword-only
I'd suggest you make all the plotting parameters keyword-only arguments, e.g.:
def render_shapes(
self,
elements: list[str] | str | None = None,
color: list[str | None] | str | None = None,
+ *,
fill_alpha: float | int = 1.0,
groups: list[list[str | None]] | list[str | None] | str | None = None,
palette: list[list[str | None]] | list[str | None] | str | None = None,
na_color: ColorLike | None = "lightgrey",
outline: bool = False,
outline_width: float | int = 1.5,
outline_color: str | list[float] = "#000000ff",
outline_alpha: float | int = 1.0,
cmap: Colormap | str | None = None,
norm: bool | Normalize = False,
scale: float | int = 1.0,
table_name: list[str] | str | None = None,
**kwargs: Any,
)
Otherwise you'll never be able to add an additional parameter at an arbitrary position without breaking backwards-compatibility. It also forces people to write more readable code. Scanpy has been transitioning to as well, but only when it was too late.