Plotting (.pl)#
- class spatialdata_plot.pl.basic.PlotAccessor(sdata)#
A class to provide plotting functions for
SpatialDataobjects.- Parameters:
sdata (
SpatialData) – TheSpatialDataobject to provide plotting functions for.
Notes
This class provides a number of methods that can be used to generate plots of the data stored in a
SpatialDataobject. These methods are accessed via theSpatialData.placcessor.- render_images(element=None, *, channel=None, cmap=None, norm=None, palette=None, alpha=1.0, scale=None, grayscale=False, transfunc=None, colorbar='auto', colorbar_params=None, channels_as_legend=False)#
Render image elements in SpatialData.
In case of no elements specified, “broadcasting” of parameters is applied. This means that for any particular SpatialElement, we validate whether a given parameter is valid. If not valid for a particular SpatialElement the specific parameter for that particular SpatialElement will be ignored. If you want to set specific parameters for specific elements please chain the render functions:
pl.render_images(...).pl.render_images(...).pl.show().- Parameters:
element (
str|None(default:None)) – The name of the image element to render. IfNone, all image elements in theSpatialDataobject will be used and all parameters will be broadcasted if possible.channel (
list[str] |list[int] |str|int|None(default:None)) – To select specific channels to plot. Can be a single channel name/int or a list of channel names/ints. IfNone, all channels will be used.cmap (
list[Colormap|str] |Colormap|str|None(default:None)) – Colormap or list of colormaps for continuous annotations, seematplotlib.colors.Colormap. Each colormap applies to a corresponding channel.norm (
list[Normalize] |Normalize|None(default:None)) – Colormap normalization for continuous annotations, seematplotlib.colors.Normalize. A singleNormalizeapplies to all channels. A list ofNormalizeobjects applies per-channel (length must match the number of channels).palette (
list[str] |str|None(default:None)) – Palette to color images. Can be a single palette name (broadcast to all channels) or a list matching the number of channels.alpha (
float|int(default:1.0)) – Alpha value for the images. Must be a numeric between 0 and 1.scale (
str|None(default:None)) –- Influences the resolution of the rendering. Possibilities include:
1)
None(default): The image is rasterized to fit the canvas size. For multiscale images, the best scale is selected before rasterization. 2) A scale name: Renders the specified scale ( of a multiscale image) as-is (with adjustments for dpi inshow()). 3) “full”: Renders the full image without rasterization. In the case of multiscale images, the highest resolution scale is selected. Note that this may result in long computing times for large images.
grayscale (
bool(default:False)) – Convert the image to grayscale before rendering using luminance weights (Rec. 601: 0.2989 R + 0.5870 G + 0.1140 B). Requires exactly 3 channels at the point of conversion — iftransfuncis also provided, it runs first, and the result must have 3 channels. The grayscale image is rendered as a single-channel image withcmap="gray"unless an explicitcmapis given. Useful for de-emphasising H&E tissue when overlaying colored annotations. Cannot be combined withpalette.transfunc (
Callable[[ndarray],ndarray] |list[Callable[[ndarray],ndarray]] |None(default:None)) –Transform(s) applied to the raw image array before normalization and rendering.
Single callable: receives a numpy array of shape
(c, y, x)(channels first) and must return an array of the same layout. The number of channels may change (e.g., stain deconvolution). Elementwise functions likenp.log1pbroadcast naturally. Note that reductions likenp.percentilewill compute a single value across all channels.List of callables: one per channel (length must match the number of selected channels). Each receives a
(y, x)array for its channel and must return a(y, x)array. Use this when each channel needs independent treatment (e.g., different gamma corrections for different fluorescence markers).When combined with
grayscale=True,transfuncruns first andgrayscaleis applied to the result.colorbar (
bool|str|None(default:'auto')) – Whether to request a colorbar for continuous colors. Use"auto"(default) for automatic selection.colorbar_params (
dict[str,object] |None(default:None)) – Parameters forwarded to Matplotlib’s colorbar alongside layout hints such asloc,width,pad, andlabel.channels_as_legend (
bool(default:False)) – WhenTrueand rendering multiple channels, show a categorical legend mapping each channel name to its compositing color. The legend uses thelegend_*parameters fromshow(). Ignored for single-channel and RGB(A) images. When multiplerender_imagescalls use this flag on the same axes, all channel entries are combined into a single legend.
Notes
RGB(A) auto-detection: when the channel names are exactly
{r, g, b}or{r, g, b, a}(case-insensitive) and no explicitcmaporpaletteis given, the image is rendered as true-color RGB(A) without colormaps.Multi-channel compositing: when multiple channels are rendered with per-channel colormaps, they are additively blended. Colormaps that go from a color to white (rather than to transparent) will cause upper layers to occlude lower ones.
A single
cmapis automatically broadcast to all selected channels.
- Return type:
SpatialData- Returns:
sd.SpatialData A copy of the SpatialData object with the rendering parameters stored in its plotting tree.
- render_labels(element=None, color=None, *, groups=None, contour_px=3, palette=None, cmap=None, norm=None, na_color='default', outline_alpha=0.0, fill_alpha=None, outline_color=None, scale=None, colorbar='auto', colorbar_params=None, table_name=None, table_layer=None, gene_symbols=None, transfunc=None)#
Render labels elements in SpatialData.
In case of no elements specified, “broadcasting” of parameters is applied. This means that for any particular SpatialElement, we validate whether a given parameter is valid. If not valid for a particular SpatialElement the specific parameter for that particular SpatialElement will be ignored. If you want to set specific parameters for specific elements please chain the render functions:
pl.render_labels(...).pl.render_labels(...).pl.show().- Parameters:
element (
str|None(default:None)) – The name of the labels element to render. IfNone, all label elements in theSpatialDataobject will be used and all parameters will be broadcasted if possible.color (
tuple[float,...] |list[float] |str|None(default:None)) – Can either be color-like (name of a color as string, e.g. “red”, hex representation, e.g. “#000000” or “#000000ff”, or an RGB(A) array as a tuple or list containing 3-4 floats within [0, 1]. If an alpha value is indicated, the value offill_alphatakes precedence if given) or a string representing a key insdata.table.obsor in the index ofsdata.table.var. The latter can be used to color by categorical or continuous variables. If the color column is found in multiple locations, please provide the table_name to be used for the element if you would like a specific table to be used.groups (
list[str] |str|None(default:None)) – When usingcolorand the key represents discrete labels,groupscan be used to show only a subset of them. By default, non-matching labels are hidden. To show non-matching labels, setna_colorexplicitly.palette (
dict[str,str] |list[str] |str|None(default:None)) – Palette for discrete annotations. Can be a dictionary mapping category names to colors, a list of valid color names (must match the number of groups), a single named palette or matplotlib colormap name, orNone.contour_px (
int|None(default:3)) – Draw contour of specified width for each segment. Must be >= 2;contour_px=1is rejected because a 1x1 erosion is the identity transformation and produces no visible outline. IfNone, fills entire segment, seeskimage.morphology.erosion().cmap (
Colormap|str|None(default:None)) – Colormap for continuous annotations using ‘color’, seematplotlib.colors.Colormap. For categorical data, usepaletteinstead.norm (
Normalize|None(default:None)) – Colormap normalization for continuous annotations, seematplotlib.colors.Normalize.na_color (
tuple[float,...] |list[float] |str|None(default:'default')) – Color for NA values and, whengroupsis set, for non-matching labels. When omitted, non-matching labels are hidden. Pass any explicit color (e.g."lightgray") to show them in that color instead. Accepts a named color ("red"), a hex string ("#000000ff"), or an RGB/RGBA list ([1.0, 0.0, 0.0, 1.0]). PassNoneto make NA values fully transparent.outline_alpha (
float|int(default:0.0)) – Alpha value for the outline of the labels. Invisible by default.fill_alpha (
float|int|None(default:None)) – Alpha value for the fill of the labels. By default, it is set to 0.4 or, if a color is given that implies an alpha, that value is used forfill_alpha.outline_color (
tuple[float,...] |list[float] |str|None(default:None)) – Color of the outline of the labels. Can either be a named color (“red”), a hex representation (“#000000”) or a list of floats that represent RGB/RGBA values (1.0, 0.0, 0.0, 1.0). IfNone, the outline inherits from thecolorparameter when it is a literal color, or uses data-driven per-label colors whencolorrefers to a column.scale (
str|None(default:None)) –- Influences the resolution of the rendering. Possibilities for setting this parameter:
1) None (default). The image is rasterized to fit the canvas size. For multiscale images, the best scale is selected before the rasterization step. 2) Name of one of the scales in the multiscale image to be rendered. This scale is rendered as it is (exception: a dpi is specified in
show(). Then the image is rasterized to fit the canvas and dpi). 3) “full”: render the full image without rasterization. In the case of a multiscale image, the scale with the highest resolution is selected. This can lead to long computing times for large images!
colorbar (
bool|str|None(default:'auto')) – Whether to request a colorbar for continuous colors. Use"auto"(default) for automatic selection.colorbar_params (
dict[str,object] |None(default:None)) – Parameters forwarded to Matplotlib’s colorbar alongside layout hints such asloc,width,pad, andlabel.table_name (
str|None(default:None)) – Name of the table containing the color columns.table_layer (
str|None(default:None)) – Layer of the AnnData table to use for coloring ifcoloris insdata.table.var_names. If None,sdata.table.Xof the default table is used for coloring.gene_symbols (
str|None(default:None)) – Column name insdata.table.varto use for looking upcolor. Use this whenvar_namesare e.g. ENSEMBL IDs but you want to refer to genes by their symbols stored in another column ofvar. Mimics scanpy’sgene_symbolsparameter.transfunc (
Callable[[float],float] |None(default:None)) – Optional transformation applied to the continuous color vector before normalization and colormap mapping.
- Return type:
SpatialData- Returns:
sd.SpatialData A copy of the SpatialData object with the rendering parameters stored in its plotting tree.
- render_points(element=None, color=None, *, alpha=None, groups=None, palette=None, na_color='default', cmap=None, norm=None, size=1.0, method=None, table_name=None, table_layer=None, gene_symbols=None, colorbar='auto', colorbar_params=None, datashader_reduction=None, transfunc=None)#
Render points elements in SpatialData.
In case of no elements specified, “broadcasting” of parameters is applied. This means that for any particular SpatialElement, we validate whether a given parameter is valid. If not valid for a particular SpatialElement the specific parameter for that particular SpatialElement will be ignored. If you want to set specific parameters for specific elements please chain the render functions:
pl.render_points(...).pl.render_points(...).pl.show().- Parameters:
element (
str|None(default:None)) – The name of the points element to render. IfNone, all points elements in theSpatialDataobject will be used.color (
tuple[float,...] |list[float] |str|None(default:None)) – Can either be color-like (name of a color as string, e.g. “red”, hex representation, e.g. “#000000” or “#000000ff”, or an RGB(A) array as a tuple or list containing 3-4 floats within [0, 1]. If an alpha value is indicated, the value ofalphatakes precedence if given) or a string representing a key insdata.table.obs. The latter can be used to color by categorical or continuous variables. IfelementisNone, if possible the color will be broadcasted to all elements. For this, the table in which the color key is found must annotate the respective element (region must be set to the specific element). If the color column is found in multiple locations, please provide the table_name to be used for the elements.alpha (
float|int|None(default:None)) – Alpha value for the points. By default, it is set to 1.0 or, if a color is given that implies an alpha, that value is used instead.groups (
list[str] |str|None(default:None)) – When usingcolorand the key represents discrete labels,groupscan be used to show only a subset of them. By default, non-matching points are filtered out entirely. To show non-matching points, setna_colorexplicitly. If element is None, broadcasting behaviour is attempted (use the same values for all elements).palette (
dict[str,str] |list[str] |str|None(default:None)) – Palette for discrete annotations. Can be a dictionary mapping category names to colors, a list of valid color names (must match the number of groups), a single named palette or matplotlib colormap name, orNone. IfelementisNone, broadcasting behaviour is attempted (use the same values for all elements).na_color (
tuple[float,...] |list[float] |str|None(default:'default')) – Color for NA values and, whengroupsis set, for non-matching points. When omitted, non-matching points are hidden. Pass any explicit color (e.g."lightgray") to show them in that color instead. Accepts a named color ("red"), a hex string ("#000000ff"), or an RGB/RGBA list ([1.0, 0.0, 0.0, 1.0]). PassNoneto make NA values fully transparent.cmap (
Colormap|str|None(default:None)) – Colormap for continuous annotations using ‘color’, seematplotlib.colors.Colormap. If no palette is given andcolorrefers to a categorical, the colors are sampled from this colormap.norm (
Normalize|None(default:None)) – Colormap normalization for continuous annotations, seematplotlib.colors.Normalize.method (
str|None(default:None)) – Whether to use'matplotlib'or'datashader'. WhenNone, the method is chosen automatically based on the size of the data (datashader for >10 000 elements).colorbar (
bool|str|None(default:'auto')) – Whether to request a colorbar for continuous colors. Use"auto"(default) for automatic selection.colorbar_params (
dict[str,object] |None(default:None)) – Parameters forwarded to Matplotlib’s colorbar alongside layout hints such asloc,width,pad, andlabel.table_name (
str|None(default:None)) – Name of the table containing the color(s) columns. If one name is given than the table is used for each spatial element to be plotted if the table annotates it. If you want to use different tables for particular elements, as specified under element.table_layer (
str|None(default:None)) – Layer of the table to use for coloring ifcoloris insdata.table.var_names. If None, the data insdata.table.Xis used for coloring.gene_symbols (
str|None(default:None)) – Column name insdata.table.varto use for looking upcolor. Use this whenvar_namesare e.g. ENSEMBL IDs but you want to refer to genes by their symbols stored in another column ofvar. Mimics scanpy’sgene_symbolsparameter.datashader_reduction (
Optional[Literal['sum','mean','any','count','std','var','max','min']] (default:None)) – Reduction method for datashader when coloring by continuous values. WhenNone, defaults to"sum".transfunc (
Callable[[float],float] |None(default:None)) – Optional transformation applied to the continuous color vector before normalization and colormap mapping.
- Return type:
SpatialData- Returns:
sd.SpatialData A copy of the SpatialData object with the rendering parameters stored in its plotting tree.
- render_shapes(element=None, color=None, *, fill_alpha=None, groups=None, palette=None, na_color='default', outline_width=None, outline_color=None, outline_alpha=None, cmap=None, norm=None, scale=1.0, method=None, table_name=None, table_layer=None, gene_symbols=None, shape=None, colorbar='auto', colorbar_params=None, datashader_reduction=None, transfunc=None)#
Render shapes elements in SpatialData.
In case of no elements specified, “broadcasting” of parameters is applied. This means that for any particular SpatialElement, we validate whether a given parameter is valid. If not valid for a particular SpatialElement the specific parameter for that particular SpatialElement will be ignored. If you want to set specific parameters for specific elements please chain the render functions:
pl.render_points(...).pl.render_points(...).pl.show().- Parameters:
element (
str|None(default:None)) – The name of the shapes element to render. IfNone, all shapes elements in theSpatialDataobject will be used.color (
tuple[float,...] |list[float] |str|None(default:None)) – Can either be color-like (name of a color as string, e.g. “red”, hex representation, e.g. “#000000” or “#000000ff”, or an RGB(A) array as a tuple or list containing 3-4 floats within [0, 1]. If an alpha value is indicated, the value offill_alphatakes precedence if given) or a string representing a key insdata.table.obs. The latter can be used to color by categorical or continuous variables. IfelementisNone, if possible the color will be broadcasted to all elements. For this, the table in which the color key is found must annotate the respective element (region must be set to the specific element). If the color column is found in multiple locations, please provide the table_name to be used for the elements.fill_alpha (
float|int|None(default:None)) – Alpha value for the fill of shapes. By default, it is set to 1.0 or, if a color is given that implies an alpha, that value is used forfill_alpha. If an alpha channel is present in a cmap passed by the user,fill_alphawill overwrite the value present in the cmap.groups (
list[str] |str|None(default:None)) – When usingcolorand the key represents discrete labels,groupscan be used to show only a subset of them. By default, non-matching elements are hidden. To show non-matching elements, setna_colorexplicitly. If element is None, broadcasting behaviour is attempted (use the same values for all elements).palette (
dict[str,str] |list[str] |str|None(default:None)) – Palette for discrete annotations. Can be a dictionary mapping category names to colors, a list of valid color names (must match the number of groups), a single named palette or matplotlib colormap name, orNone. If element is None, broadcasting behaviour is attempted (use the same values for all elements).na_color (
tuple[float,...] |list[float] |str|None(default:'default')) – Color for NA values and, whengroupsis set, for non-matching elements. When omitted, non-matching elements are hidden. Pass any explicit color (e.g."lightgray") to show them in that color instead. Accepts a named color ("red"), a hex string ("#000000ff"), or an RGB/RGBA list ([1.0, 0.0, 0.0, 1.0]). PassNoneto make NA values fully transparent.outline_width (
float|int|tuple[float|int,float|int] |None(default:None)) – Width of the border. If 2 values are given (tuple), 2 borders are shown with these widths (outer & inner). Ifoutline_colorand/oroutline_alphaare used to indicate that one/two outlines should be drawn, the default outline widths 1.5 and 0.5 are used for outer/only and inner outline respectively.outline_color (
tuple[float,...] |list[float] |str|tuple[tuple[float,...] |list[float] |str] |None(default:None)) – Color of the border. Can either be a named color (“red”), a hex representation (“#000000”) or a list of floats that represent RGB/RGBA values (1.0, 0.0, 0.0, 1.0). If the hex representation includes alpha, e.g. “#000000ff”, andoutline_alphais not given, this value controls the opacity of the outline. If 2 values are given (tuple), 2 borders are shown with these colors (outer & inner). Ifoutline_widthand/oroutline_alphaare used to indicate that one/two outlines should be drawn, the default outline colors “#000000” and “#ffffff are used for outer/only and inner outline respectively.outline_alpha (
float|int|tuple[float|int,float|int] |None(default:None)) – Alpha value for the outline of shapes. Invisible by default, meaning outline_alpha=0.0 if both outline_color and outline_width are not specified. Else, outlines are rendered with the alpha implied by outline_color, or with outline_alpha=1.0 if outline_color does not imply an alpha. For two outlines, alpha values can be passed in a tuple of length 2.cmap (
Colormap|str|None(default:None)) – Colormap for continuous annotations using ‘color’, seematplotlib.colors.Colormap. For categorical data, usepaletteinstead.norm (
Normalize|None(default:None)) – Colormap normalization for continuous annotations, seematplotlib.colors.Normalize.scale (
float|int(default:1.0)) – Value to scale shapes (circles and polygons).method (
str|None(default:None)) – Whether to use'matplotlib'or'datashader'. WhenNone, the method is chosen automatically based on the size of the data (datashader for >10 000 elements).colorbar (
bool|str|None(default:'auto')) – Whether to request a colorbar for continuous colors. Use"auto"(default) for automatic selection.colorbar_params (
dict[str,object] |None(default:None)) – Parameters forwarded to Matplotlib’s colorbar alongside layout hints such asloc,width,pad, andlabel.table_name (
str|None(default:None)) – Name of the table containing the color(s) columns. If one name is given than the table is used for each spatial element to be plotted if the table annotates it. If you want to use different tables for particular elements, as specified under element.table_layer (
str|None(default:None)) – Layer of the table to use for coloring ifcoloris insdata.table.var_names. If None, the data insdata.table.Xis used for coloring.gene_symbols (
str|None(default:None)) – Column name insdata.table.varto use for looking upcolor. Use this whenvar_namesare e.g. ENSEMBL IDs but you want to refer to genes by their symbols stored in another column ofvar. Mimics scanpy’sgene_symbolsparameter.shape (
Optional[Literal['circle','hex','visium_hex','square']] (default:None)) – If None (default), the shapes are rendered as they are. Else, if either of “circle”, “hex” or “square” is specified, the shapes are converted to a circle/hexagon/square before rendering. If “visium_hex” is specified, the shapes are assumed to be Visium spots and the size of the hexagons is adjusted to be adjacent to each other.datashader_reduction (
Optional[Literal['sum','mean','any','count','std','var','max','min']] (default:None)) – Reduction method for datashader when coloring by continuous values. WhenNone, defaults to"max".transfunc (
Callable[[float],float] |None(default:None)) – Optional transformation applied to the continuous color vector before normalization and colormap mapping.
Notes
Empty geometries will be removed at the time of plotting.
An
outline_widthof 0.0 leads to no border being plotted.When passing a color-like to ‘color’, this has precedence over the potential existence as a column name.
- Return type:
SpatialData- Returns:
sd.SpatialData A copy of the SpatialData object with the rendering parameters stored in its plotting tree.
- show(coordinate_systems=None, *, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, na_in_legend=True, colorbar=True, colorbar_params=None, wspace=None, hspace=0.25, ncols=4, frameon=None, figsize=None, dpi=None, fig=None, title=None, pad_extent=0, ax=None, return_ax=False, save=None, show=None, scalebar_dx=None, scalebar_units='um', scalebar_params=None, legend_params=None)#
Execute the plotting tree and display the final figure.
- Parameters:
coordinate_systems (
list[str] |str|None(default:None)) – Name(s) of the coordinate system(s) to be plotted. IfNone, all coordinate systems that contain relevant elements (as specified in therender_*calls) are plotted automatically.legend_fontsize (
Union[int,float,Literal['xx-small','x-small','small','medium','large','x-large','xx-large'],None] (default:None)) – Font size for the legend text. Accepts numeric values or matplotlib font size strings (e.g."small","large").legend_fontweight (
Union[int,Literal['light','normal','medium','semibold','bold','heavy','black']] (default:'bold')) – Font weight for the legend text (e.g."bold","normal").legend_loc (
str|None(default:'right margin')) – Location of the legend. Standard matplotlib legend locations (e.g."upper left") or"right margin","left margin","top margin","bottom margin"to place the legend outside the axes.legend_fontoutline (
int|None(default:None)) – Stroke width for a white outline around legend text, improving readability on busy plots.na_in_legend (
bool(default:True)) – Whether to include NA / unmapped categories in the legend.colorbar (
bool(default:True)) – Global switch to enable/disable all colorbars. Per-layer settings are ignored when this isFalse.colorbar_params (
dict[str,object] |None(default:None)) – Global overrides passed to colorbars for all axes. Accepts the same keys as per-layercolorbar_params(e.g.,loc,width,pad,label).wspace (
float|None(default:None)) – Horizontal spacing between panels (passed tomatplotlib.gridspec.GridSpec).hspace (
float(default:0.25)) – Vertical spacing between panels (passed tomatplotlib.gridspec.GridSpec).ncols (
int(default:4)) – Number of columns in the multi-panel grid.frameon (
bool|None(default:None)) – Whether to draw the axes frame. IfNone, the frame is hidden automatically for multi-panel plots.figsize (
tuple[float,float] |None(default:None)) – Size of the figure(width, height)in inches. The actual canvas size in pixels isdpi * figsize. IfNone, the matplotlib default is used(6.4, 4.8).dpi (
int|None(default:None)) – Resolution of the plot in dots per inch. IfNone, the matplotlib default is used(100.0).fig (
Figure|None(default:None)) –Deprecated since version Pass: axes created from your figure via
axinstead.title (
list[str] |str|None(default:None)) – Title(s) for the plot. A single string is applied to all panels; a list must match the number of coordinate systems. IfNone, each panel is titled with its coordinate system name.pad_extent (
int|float(default:0)) – Padding added around the computed spatial extent on all sides.ax (
list[Axes] |Axes|None(default:None)) – Pre-existing matplotlib axes to plot on. Can be a singleAxesor a list matching the number of coordinate systems. IfNone, a new figure and axes are created.return_ax (
bool(default:False)) – Whether to return the axes object(s) instead ofNone.save (
str|Path|None(default:None)) – Path to save the figure to. IfNone, the figure is not saved.show (
bool|None(default:None)) – Whether to callplt.show()at the end. IfNone(default), the plot is shown automatically when running in non-interactive mode (scripts) and suppressed in interactive sessions (e.g. Jupyter). Whenaxis provided by the user, defaults toFalseto allow further modifications.scalebar_dx (
float|None(default:None)) – Physical size of one axes-unit inscalebar_units. IfNone, no scalebar is drawn. SpatialData coordinate systems carry no unit metadata, so this value must be supplied explicitly (e.g.1.0when axes are already in micrometers; the microns-per-pixel value when axes are in image pixels).scalebar_units (
str(default:'um')) – Unit string for the scalebar (passed tomatplotlib_scalebar.scalebar.ScaleBar). Only takes effect whenscalebar_dxis set.scalebar_params (
dict[str,Any] |None(default:None)) – Extra keyword arguments forwarded tomatplotlib_scalebar.scalebar.ScaleBar, e.g.{"location": "lower right", "color": "white", "length_fraction": 0.25}. See the matplotlib-scalebar documentation for the full list of options.legend_params (
dict[str,Any] |None(default:None)) – Bundled legend options; overrides the matchinglegend_*flat kwargs. Accepted keys:location(orloc),fontsize,fontweight,fontoutline,na_in_legend. Unknown keys raiseValueError.
- Return type:
- Returns:
Axes | list[Axes] | None The axes object(s) if
return_ax=True, otherwiseNone.
- property sdata: SpatialData#
The
SpatialDataobject to provide plotting functions for.