From 4f19138147c284c3038982cdeaa7c4c913aa68da Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sat, 22 Feb 2025 12:00:44 +0100 Subject: [PATCH 01/56] part config --- src/spatialdata_plot/pl/_viewconfig.py | 288 +++++++++++++++++++++++++ src/spatialdata_plot/pl/basic.py | 15 ++ 2 files changed, 303 insertions(+) create mode 100644 src/spatialdata_plot/pl/_viewconfig.py diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py new file mode 100644 index 00000000..56f4b859 --- /dev/null +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -0,0 +1,288 @@ +from pathlib import Path +import spatialdata +from uuid import uuid4, UUID +from enum import Enum +from matplotlib.figure import Figure +import matplotlib.colors as mcolors +from matplotlib.axes import Axes +from spatialdata_plot.pl.render_params import ( + ImageRenderParams, + LabelsRenderParams, + PointsRenderParams, + ShapesRenderParams, +) +from typing import OrderedDict + +Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams + +class VegaAlignment(Enum): + LEFT = "start" + CENTER = "middle" + RIGHT = "end" + + @classmethod + def from_matplotlib(cls, alignment: str): + """Convert Matplotlib horizontal alignment to Vega alignment.""" + mapping = { + "left": cls.LEFT, + "center": cls.CENTER, + "right": cls.RIGHT + } + return mapping.get(alignment, cls.CENTER).value + +def _create_axis_scale_block(ax: Axes): + """Create vega scales object pertaining to both the x and the y axis. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. + """ + scales = [] + scales.append(_get_axis_scale_config(ax, "x")) + scales.append(_get_axis_scale_config(ax, "y")) + return scales + + +def _get_axis_scale_config(ax: Axes, axis_name: str): + """Provide a vega like scales object particular for one of the plotting axes. + + Note that in vega, this config also contains the fields reverse and zero. + However, given that we specify the domain explicitly, these are not required here. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. + axis_name: str + Which axis the config should be made for, either "x" or "y". + """ + scale = {} + scale["name"] = f"{axis_name.upper()}_scale" + if axis_name == "x": + scale["type"] = ax.get_xaxis().get_scale() + scale["domain"] = [ax.get_xlim()[0], ax.get_xlim()[1]] + scale["range"] = "width" + if axis_name == "y": + scale["type"] = ax.get_yaxis().get_scale() + scale["domain"] = [ax.get_ylim()[0], ax.get_ylim()[1]] + scale["range"] = "height" + return scale + + +def _create_padding_object(fig: Figure): + """Get the padding parameters for a vega viewconfiguration. + + Given that matplotlib gives the padding parameters as a fraction of the the figure width or height and + vega gives it as absolute number of pixels we need to convert from the fraction to the number of pixels. + + Parameters + ---------- + fig : Figure + The matplotlib figure. The top level container for all the plot elements. + """ + fig_width_pixels, fig_height_pixels = fig.get_size_inches() * fig.dpi + # contains also wspace and hspace but does not seem to be used by vega here. + padding_obj = fig.subplotpars + padding = { + "left": padding_obj.left * fig_width_pixels, + "top": (1 - padding_obj.top) * fig_height_pixels, + "right": (1 - padding_obj.right) * fig_width_pixels, + "bottom": padding_obj.bottom * fig_height_pixels, + } + return padding + +def _create_base_level_sdata_block(url: Path): + """Create the vega json object for the SpatialData zarr store. + + Parameters + ---------- + url : Path + The location of the SpatialData zarr store. + + This config is to be added to the vega data field block. + """ + base_block = {} + base_block["name"] = uuid4() + base_block["url"] = str(url) + base_block["format"] = {"type": "SpatialData", + "version": spatialdata.__version__} + return base_block + +def _create_derived_data_block(call: str, params: Params, base_uuid: UUID, cs: str): + """Create vega like data object for SpatialData elements. + + Each object for a SpatialData element contains an additional transform that + is not entirely corresponding to the vega spec but aims to allow for retrieving + the specific element and transforming it to a particular coordinate space. + + Parameters + ---------- + call: str + The render call from spatialdata plot, either render_images, render_labels, render_points + or render_shapes, prefixed by n_ where n is the index of the render call starting from 0. + params: Params + The render parameters used in spatialdata-plot for the particular type of SpatialData + element. + base_uuid: UUID + Unique identifier used to refer to the base level SpatialData zarr store in the vega + like view configuration. + cs: str + The name of the coordinate system in which the SpatialData element was plotted. + """ + data_block = {} + + data_block["name"] = uuid4() + # TODO: think about versioning of individual spatialdata elements + if "render_images" in call: + data_block["format"] = {"type": "spatialdata_image", "version": 0.1} + elif "render_labels" in call: + data_block["format"] = {"type": "spatialdata_label", "version": 0.1} + elif "render_points" in call: + data_block["format"] = {"type": "spatialdata_point", "version": 0.1} + elif "render_shapes" in call: + data_block["format"] = {"type": "spatialdata_shape", "version": 0.1} + else: + raise ValueError(f"Unknown call: {call}") + + data_block["source"] = base_uuid + data_block["transform"] = [{"type": "filter_element", "expr": params.element}, + {"type": "filter_cs", "expr": cs}] + return data_block + + +def _create_data_configs(plotting_tree: OrderedDict[str, Params], cs: str, sdata_path: str): + """Create the vega json array value to the data key. + + The data array in the SpatialData vegalike viewconfig consists out of + an object for the base level of the SpatialData zarr store and subsequently + derived individual SpatialData elements. + + Parameters + ---------- + plotting_tree: OrderedDict[str, Params] + Dictionary with as keys the render calls prefixed with the index of the render call. Render calls are either + render_images, render_labels, render_points, or render_shapes. The values in the dict are the parameters + corresponding to the render call. + cs: str + The name of the coordinate system in which the SpatialData elements were plotted. + sdata_path: str + The location of the SpatialData zarr store. + """ + data = [] + url = Path("sdata.zarr") + + if sdata_path: + url = sdata_path + + base_block = _create_base_level_sdata_block(url) + data.append(base_block) + for call, params in plotting_tree.items(): + data.append(_create_derived_data_block(call, params, base_block["name"], cs)) + + return data + + +def _create_title_config(ax, fig): + """Create a vega title object for a spatialdata view configuration. + + Note that not all field values as obtained from matplotlib are supported by the official + vega specification. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. + fig : Figure + The matplotlib figure. The top level container for all the plot elements. + """ + title_text = ax.get_title() + title_obj = ax.title + title_font = title_obj.get_fontproperties() + + title_config = {"text": title_text, + "orient": "top", # there is not really a nice conversion here of matplotlib to vega + "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), + "baseline": title_obj.get_va(), + "color": title_obj.get_color(), + "font": title_obj.get_fontname(), + "fontSize": (title_font.get_size() * fig.dpi) / 72, + "fontStyle": title_obj.get_fontstyle(), + "fontWeight": title_font.get_weight(), + } + return title_config + +def _create_axis_block(ax, axis_scales_block, dpi): + axis_array = [] + for scale in axis_scales_block: + axis_config = {} + axis_config["scale"] = scale["name"] + if scale["name"] == "X_scale": + axis = ax.xaxis + label = ax.get_xlabel() + elif scale["name"] == "Y_scale": + axis = ax.yaxis + label = ax.get_ylabel() + + axis_config["orient"] = axis.get_label_position() + + axis_line_props = ax.spines[axis_config["orient"]].properties() + axis_props = axis.properties() + axis_config["title"] = label + axis_config["domain"] = axis_line_props['visible'] # domain is whether axis line should be visible. + axis_config["domainOpacity"] = axis_line_props["alpha"] if axis_line_props["alpha"] else 1 + axis_config["domainColor"] = mcolors.to_hex(axis_line_props["edgecolor"])[:-2] + axis_config["domainWidth"] = (axis_line_props["linewidth"] * dpi) / 72 + axis_config["grid"] = axis_props["tick_params"]["gridOn"] + + # making the assumption here that all gridlines look the same + if axis_config["grid"]: + axis_config["gridOpacity"] = axis_props["gridlines"][0].properties()['alpha'] + axis_config["gridCap"] = axis_props["gridlines"][0].properties()['dash_capstyle'] + grid_color = float(axis_props["gridlines"][0].properties()['markeredgecolor']) + axis_config["gridColor"] = mcolors.to_hex([grid_color]*3) + axis_config["gridWidth"] = (axis_props["gridlines"][0].properties()["markeredgewidth"] * dpi) / 72 + axis_config["labelFont"] = axis_props['majorticklabels'][0].get_fontname() + axis_config["labelFontSize"] = (axis_props['majorticklabels'][0].get_size() * dpi) / 72 + axis_config["labelFontStyle"] = axis_props['majorticklabels'][0].get_fontstyle() + axis_config["labelFontWeight"] = axis_props['majorticklabels'][0].get_fontweight() + axis_config["tickCount"] = len(axis_props["ticklocs"]) + if axis_config["tickCount"] != 0: + tick_props = axis_props["ticklines"][0].properties() + axis_config["ticks"] = tick_props["visible"] + axis_config["tickOpacity"] = tick_props["alpha"] if tick_props["alpha"] else 1 + if axis_config["ticks"] and axis_config["tickOpacity"] != 0: + axis_config["tickColor"] = mcolors.to_hex(tick_props["color"]) + axis_config["tickCap"] = tick_props["dash_capstyle"] + axis_config["tickWidth"] = (tick_props['linewidth'] * dpi) / 72 + axis_config["tickSize"] = (tick_props['markersize'] * dpi) / 72 #also marker edge width, but vega doesn't have an equivalent for that. + + + + # view={"grid": true, + # "tickCount": 5, + # "labelFontSize": 12, + # "titleFontSize": 14 + # } + axis_array.append(axis_config) + return axis_config + +def create_viewconfig(sdata, fig_params, legend_params, cs): + fig = fig_params.fig + ax = fig_params.ax + data_block = _create_data_configs(sdata.plotting_tree, cs, sdata._path) + + axis_scales_block = _create_axis_scale_block(ax) + axis_block = _create_axis_block(ax, axis_scales_block, fig.dpi) + + viewconfig = { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": fig.get_figheight() * fig.dpi, # matplotlib uses inches, but vega uses absolute pixels + "width": fig.get_figwidth() * fig.dpi, + "padding": _create_padding_object(fig), + "title": _create_title_config(ax, fig), + "data": data_block, + "scales": axis_scales_block, + + } + print() diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index e9dd630d..cbe564bc 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -29,6 +29,7 @@ _render_points, _render_shapes, ) +from spatialdata_plot.pl._viewconfig import create_viewconfig from spatialdata_plot.pl.render_params import ( CmapParams, ImageRenderParams, @@ -723,6 +724,7 @@ def show( ax: list[Axes] | Axes | None = None, return_ax: bool = False, save: str | Path | None = None, + store_viewconfig: bool = True, ) -> sd.SpatialData: """ Plot the images in the SpatialData object. @@ -830,7 +832,17 @@ def show( ax_y_max, ax_y_min = ax.get_ylim() # (0, 0) is top-left coordinate_systems = sdata.coordinate_systems if coordinate_systems is None else coordinate_systems + + # Only reason for multiple coordinate systems is to show quick overview, but this would complicate the view config + # implementation. For testing now, global is used as default. + if not isinstance(coordinate_systems, str) and store_viewconfig: + # TODO: change this when having full implementation. + store_viewconfig_cs = "global" + #raise ValueError("If wanting to store the view configuration. A single coordinate system must be provided") + if isinstance(coordinate_systems, str): + if store_viewconfig: + store_viewconfig_cs = coordinate_systems coordinate_systems = [coordinate_systems] for cs in coordinate_systems: @@ -1029,6 +1041,9 @@ def show( if fig_params.fig is not None and save is not None: save_fig(fig_params.fig, path=save) + if store_viewconfig: + create_viewconfig(sdata, fig_params, legend_params, store_viewconfig_cs) + # Manually show plot if we're not in interactive mode # https://stackoverflow.com/a/64523765 if not hasattr(sys, "ps1"): From 3d346ba6cf57b9f0f8bd7064af31c6f9073718ef Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sat, 22 Feb 2025 13:07:22 +0100 Subject: [PATCH 02/56] complete axis array --- src/spatialdata_plot/pl/_viewconfig.py | 28 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 56f4b859..b778412b 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -219,16 +219,14 @@ def _create_axis_block(ax, axis_scales_block, dpi): axis_config["scale"] = scale["name"] if scale["name"] == "X_scale": axis = ax.xaxis - label = ax.get_xlabel() elif scale["name"] == "Y_scale": axis = ax.yaxis - label = ax.get_ylabel() + + axis_props = axis.properties() axis_config["orient"] = axis.get_label_position() axis_line_props = ax.spines[axis_config["orient"]].properties() - axis_props = axis.properties() - axis_config["title"] = label axis_config["domain"] = axis_line_props['visible'] # domain is whether axis line should be visible. axis_config["domainOpacity"] = axis_line_props["alpha"] if axis_line_props["alpha"] else 1 axis_config["domainColor"] = mcolors.to_hex(axis_line_props["edgecolor"])[:-2] @@ -257,15 +255,22 @@ def _create_axis_block(ax, axis_scales_block, dpi): axis_config["tickWidth"] = (tick_props['linewidth'] * dpi) / 72 axis_config["tickSize"] = (tick_props['markersize'] * dpi) / 72 #also marker edge width, but vega doesn't have an equivalent for that. + label = axis_props["label_text"] + if label == "": + axis_config["title"] = label + label_props = axis_props["label"].properties() + axis_config["titleAlign"] = label_props["horizontalalignment"] + axis_config["titleBaseline"] = label_props["verticalalignment"] + axis_config["titleColor"] = mcolors.to_hex(label_props["color"]) + axis_config["titleFont"] = label_props["fontname"] + axis_config["titleFontSize"] = (label_props["fontsize"] * dpi) / 72 + axis_config["titleFontWeight"] = label_props["fontweight"] + axis_config["titleOpacity"] = label_props["alpha"] if label_props["alpha"] else 1 + axis_config["zindex"] = axis_props["zorder"] - # view={"grid": true, - # "tickCount": 5, - # "labelFontSize": 12, - # "titleFontSize": 14 - # } axis_array.append(axis_config) - return axis_config + return axis_array def create_viewconfig(sdata, fig_params, legend_params, cs): fig = fig_params.fig @@ -273,7 +278,7 @@ def create_viewconfig(sdata, fig_params, legend_params, cs): data_block = _create_data_configs(sdata.plotting_tree, cs, sdata._path) axis_scales_block = _create_axis_scale_block(ax) - axis_block = _create_axis_block(ax, axis_scales_block, fig.dpi) + axis_array = _create_axis_block(ax, axis_scales_block, fig.dpi) viewconfig = { "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", @@ -283,6 +288,7 @@ def create_viewconfig(sdata, fig_params, legend_params, cs): "title": _create_title_config(ax, fig), "data": data_block, "scales": axis_scales_block, + "axes": axis_array } print() From 4de2f7293ec2add40c943aef80ce18c75536d6dc Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sat, 22 Feb 2025 15:58:06 +0100 Subject: [PATCH 03/56] add axes array to config --- src/spatialdata_plot/pl/_viewconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index b778412b..bf0e5013 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -288,7 +288,7 @@ def create_viewconfig(sdata, fig_params, legend_params, cs): "title": _create_title_config(ax, fig), "data": data_block, "scales": axis_scales_block, - "axes": axis_array + "axes": axis_array, } print() From 1d5f162345e9bfd86cf55909d0663b7c6174842a Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sat, 22 Feb 2025 16:32:44 +0100 Subject: [PATCH 04/56] convert uuid to string --- src/spatialdata_plot/pl/_viewconfig.py | 63 ++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index bf0e5013..c7b7720c 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -11,7 +11,7 @@ PointsRenderParams, ShapesRenderParams, ) -from typing import OrderedDict +from collections import OrderedDict Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams @@ -103,7 +103,7 @@ def _create_base_level_sdata_block(url: Path): This config is to be added to the vega data field block. """ base_block = {} - base_block["name"] = uuid4() + base_block["name"] = str(uuid4()) base_block["url"] = str(url) base_block["format"] = {"type": "SpatialData", "version": spatialdata.__version__} @@ -132,7 +132,7 @@ def _create_derived_data_block(call: str, params: Params, base_uuid: UUID, cs: s """ data_block = {} - data_block["name"] = uuid4() + data_block["name"] = str(uuid4()) # TODO: think about versioning of individual spatialdata elements if "render_images" in call: data_block["format"] = {"type": "spatialdata_image", "version": 0.1} @@ -272,6 +272,63 @@ def _create_axis_block(ax, axis_scales_block, dpi): axis_array.append(axis_config) return axis_array +# def plotting_tree_dict_to_marks(plotting_tree_dict): +# out = [] # caller will set { ..., "marks": out } +# for pl_call_id, pl_call_params in plotting_tree_dict.items(): +# if pl_call_id.endswith("_render_images"): +# for channel_index in pl_call_params["channel"]: +# out.append({ +# "type": "raster_image", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": { "value": pl_call_params.get("alpha") }, +# "color": {"scale": get_scale_name(pl_call_params), "field": channel_index } +# } +# }) +# if pl_call_id.endswith("_render_shapes"): +# out.append({ +# "type": "shape", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, +# "fillColor": get_shapes_color_encoding(pl_call_params), +# "strokeWidth": {"value": pl_call_params.get("outline_width")}, +# # TODO: check whether this is the key used in the spatial plotting tree # TODO: what are the units? +# "strokeColor": {"value": pl_call_params.get("outline_color")}, +# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, +# } +# }) +# if pl_call_id.endswith("_render_points"): +# out.append({ +# "type": "point", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": {"value": pl_call_params.get("alpha")}, +# "color": get_shapes_color_encoding(pl_call_params), +# "size": {"value": pl_call_params.get("size")}, +# } +# }) +# if pl_call_id.endswith("_render_labels"): +# out.append({ +# "type": "raster_labels", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": {"value": pl_call_params.get("alpha")}, +# "fillColor": get_shapes_color_encoding(pl_call_params), +# "strokeColor": get_shapes_color_encoding(pl_call_params), +# "strokeWidth": {"value": pl_call_params.get("contour_px")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# } +# }) + def create_viewconfig(sdata, fig_params, legend_params, cs): fig = fig_params.fig ax = fig_params.ax From 6f324ba49c42d5ba68aa1850c37dba3607f9d499 Mon Sep 17 00:00:00 2001 From: Luca Marconato Date: Sun, 23 Feb 2025 14:47:35 +0100 Subject: [PATCH 05/56] saving viewconfig from tests; fix mypy --- .pre-commit-config.yaml | 4 +- src/spatialdata_plot/config.py | 2 + src/spatialdata_plot/pl/_viewconfig.py | 146 +++++++++++++------------ src/spatialdata_plot/pl/basic.py | 98 ++++++++++++++--- tests/conftest.py | 36 ++++++ tests/pl/test_get_extent.py | 4 +- tests/pl/test_render_labels.py | 5 + tests/pl/test_render_points.py | 4 +- tests/pl/test_render_shapes.py | 7 +- 9 files changed, 214 insertions(+), 92 deletions(-) create mode 100644 src/spatialdata_plot/config.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b055853a..6b83653d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,8 +12,8 @@ repos: rev: 24.10.0 hooks: - id: black - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.8 + - repo: https://github.com/rbubley/mirrors-prettier + rev: v3.5.1 hooks: - id: prettier - repo: https://github.com/asottile/blacken-docs diff --git a/src/spatialdata_plot/config.py b/src/spatialdata_plot/config.py new file mode 100644 index 00000000..73ed3256 --- /dev/null +++ b/src/spatialdata_plot/config.py @@ -0,0 +1,2 @@ +# default value for the parameter store_viewconfig_in_attrs for .pl.show() +STORE_VIEWCONFIG_IN_ATTRS = False diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index bf0e5013..e01a1047 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -1,36 +1,43 @@ -from pathlib import Path -import spatialdata -from uuid import uuid4, UUID +from __future__ import annotations + +from collections import OrderedDict from enum import Enum -from matplotlib.figure import Figure +from pathlib import Path +from typing import TYPE_CHECKING, Any +from uuid import uuid4 + import matplotlib.colors as mcolors +import spatialdata from matplotlib.axes import Axes +from matplotlib.figure import Figure + from spatialdata_plot.pl.render_params import ( + FigParams, ImageRenderParams, LabelsRenderParams, PointsRenderParams, ShapesRenderParams, ) -from typing import OrderedDict Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams +if TYPE_CHECKING: + from spatialdata import SpatialData + + class VegaAlignment(Enum): LEFT = "start" CENTER = "middle" RIGHT = "end" @classmethod - def from_matplotlib(cls, alignment: str): + def from_matplotlib(cls, alignment: str) -> str: """Convert Matplotlib horizontal alignment to Vega alignment.""" - mapping = { - "left": cls.LEFT, - "center": cls.CENTER, - "right": cls.RIGHT - } + mapping = {"left": cls.LEFT, "center": cls.CENTER, "right": cls.RIGHT} return mapping.get(alignment, cls.CENTER).value -def _create_axis_scale_block(ax: Axes): + +def _create_axis_scale_block(ax: Axes) -> list[dict[str, Any]]: """Create vega scales object pertaining to both the x and the y axis. Parameters @@ -44,7 +51,7 @@ def _create_axis_scale_block(ax: Axes): return scales -def _get_axis_scale_config(ax: Axes, axis_name: str): +def _get_axis_scale_config(ax: Axes, axis_name: str) -> dict[str, Any]: """Provide a vega like scales object particular for one of the plotting axes. Note that in vega, this config also contains the fields reverse and zero. @@ -57,20 +64,20 @@ def _get_axis_scale_config(ax: Axes, axis_name: str): axis_name: str Which axis the config should be made for, either "x" or "y". """ - scale = {} + scale: dict[str, Any] = {} scale["name"] = f"{axis_name.upper()}_scale" if axis_name == "x": scale["type"] = ax.get_xaxis().get_scale() - scale["domain"] = [ax.get_xlim()[0], ax.get_xlim()[1]] + scale["domain"] = [ax.get_xlim()[0].item(), ax.get_xlim()[1].item()] scale["range"] = "width" if axis_name == "y": scale["type"] = ax.get_yaxis().get_scale() - scale["domain"] = [ax.get_ylim()[0], ax.get_ylim()[1]] + scale["domain"] = [ax.get_ylim()[0].item(), ax.get_ylim()[1].item()] scale["range"] = "height" return scale -def _create_padding_object(fig: Figure): +def _create_padding_object(fig: Figure) -> dict[str, float]: """Get the padding parameters for a vega viewconfiguration. Given that matplotlib gives the padding parameters as a fraction of the the figure width or height and @@ -84,15 +91,15 @@ def _create_padding_object(fig: Figure): fig_width_pixels, fig_height_pixels = fig.get_size_inches() * fig.dpi # contains also wspace and hspace but does not seem to be used by vega here. padding_obj = fig.subplotpars - padding = { - "left": padding_obj.left * fig_width_pixels, - "top": (1 - padding_obj.top) * fig_height_pixels, - "right": (1 - padding_obj.right) * fig_width_pixels, - "bottom": padding_obj.bottom * fig_height_pixels, + return { + "left": (padding_obj.left * fig_width_pixels).item(), + "top": ((1 - padding_obj.top) * fig_height_pixels).item(), + "right": ((1 - padding_obj.right) * fig_width_pixels).item(), + "bottom": (padding_obj.bottom * fig_height_pixels).item(), } - return padding -def _create_base_level_sdata_block(url: Path): + +def _create_base_level_sdata_block(url: str) -> dict[str, Any]: """Create the vega json object for the SpatialData zarr store. Parameters @@ -102,14 +109,14 @@ def _create_base_level_sdata_block(url: Path): This config is to be added to the vega data field block. """ - base_block = {} - base_block["name"] = uuid4() - base_block["url"] = str(url) - base_block["format"] = {"type": "SpatialData", - "version": spatialdata.__version__} - return base_block - -def _create_derived_data_block(call: str, params: Params, base_uuid: UUID, cs: str): + return { + "name": str(uuid4()), + "url": url, + "format": {"type": "SpatialData", "version": spatialdata.__version__}, + } + + +def _create_derived_data_block(call: str, params: Params, base_uuid: str, cs: str) -> dict[str, Any]: """Create vega like data object for SpatialData elements. Each object for a SpatialData element contains an additional transform that @@ -124,15 +131,15 @@ def _create_derived_data_block(call: str, params: Params, base_uuid: UUID, cs: s params: Params The render parameters used in spatialdata-plot for the particular type of SpatialData element. - base_uuid: UUID + base_uuid: str Unique identifier used to refer to the base level SpatialData zarr store in the vega like view configuration. cs: str The name of the coordinate system in which the SpatialData element was plotted. """ - data_block = {} + data_block: dict[str, Any] = {} - data_block["name"] = uuid4() + data_block["name"] = str(uuid4()) # TODO: think about versioning of individual spatialdata elements if "render_images" in call: data_block["format"] = {"type": "spatialdata_image", "version": 0.1} @@ -146,12 +153,11 @@ def _create_derived_data_block(call: str, params: Params, base_uuid: UUID, cs: s raise ValueError(f"Unknown call: {call}") data_block["source"] = base_uuid - data_block["transform"] = [{"type": "filter_element", "expr": params.element}, - {"type": "filter_cs", "expr": cs}] + data_block["transform"] = [{"type": "filter_element", "expr": params.element}, {"type": "filter_cs", "expr": cs}] return data_block -def _create_data_configs(plotting_tree: OrderedDict[str, Params], cs: str, sdata_path: str): +def _create_data_configs(plotting_tree: OrderedDict[str, Params], cs: str, sdata_path: str) -> list[dict[str, Any]]: """Create the vega json array value to the data key. The data array in the SpatialData vegalike viewconfig consists out of @@ -170,7 +176,7 @@ def _create_data_configs(plotting_tree: OrderedDict[str, Params], cs: str, sdata The location of the SpatialData zarr store. """ data = [] - url = Path("sdata.zarr") + url = str(Path("sdata.zarr")) if sdata_path: url = sdata_path @@ -183,7 +189,7 @@ def _create_data_configs(plotting_tree: OrderedDict[str, Params], cs: str, sdata return data -def _create_title_config(ax, fig): +def _create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: """Create a vega title object for a spatialdata view configuration. Note that not all field values as obtained from matplotlib are supported by the official @@ -200,19 +206,20 @@ def _create_title_config(ax, fig): title_obj = ax.title title_font = title_obj.get_fontproperties() - title_config = {"text": title_text, - "orient": "top", # there is not really a nice conversion here of matplotlib to vega - "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), - "baseline": title_obj.get_va(), - "color": title_obj.get_color(), - "font": title_obj.get_fontname(), - "fontSize": (title_font.get_size() * fig.dpi) / 72, - "fontStyle": title_obj.get_fontstyle(), - "fontWeight": title_font.get_weight(), - } - return title_config - -def _create_axis_block(ax, axis_scales_block, dpi): + return { + "text": title_text, + "orient": "top", # there is not really a nice conversion here of matplotlib to vega + "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), + "baseline": title_obj.get_va(), + "color": title_obj.get_color(), + "font": title_obj.get_fontname(), + "fontSize": (title_font.get_size() * fig.dpi) / 72, + "fontStyle": title_obj.get_fontstyle(), + "fontWeight": title_font.get_weight(), + } + + +def _create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: float) -> list[dict[str, Any]]: axis_array = [] for scale in axis_scales_block: axis_config = {} @@ -227,7 +234,7 @@ def _create_axis_block(ax, axis_scales_block, dpi): axis_config["orient"] = axis.get_label_position() axis_line_props = ax.spines[axis_config["orient"]].properties() - axis_config["domain"] = axis_line_props['visible'] # domain is whether axis line should be visible. + axis_config["domain"] = axis_line_props["visible"] # domain is whether axis line should be visible. axis_config["domainOpacity"] = axis_line_props["alpha"] if axis_line_props["alpha"] else 1 axis_config["domainColor"] = mcolors.to_hex(axis_line_props["edgecolor"])[:-2] axis_config["domainWidth"] = (axis_line_props["linewidth"] * dpi) / 72 @@ -235,15 +242,15 @@ def _create_axis_block(ax, axis_scales_block, dpi): # making the assumption here that all gridlines look the same if axis_config["grid"]: - axis_config["gridOpacity"] = axis_props["gridlines"][0].properties()['alpha'] - axis_config["gridCap"] = axis_props["gridlines"][0].properties()['dash_capstyle'] - grid_color = float(axis_props["gridlines"][0].properties()['markeredgecolor']) - axis_config["gridColor"] = mcolors.to_hex([grid_color]*3) + axis_config["gridOpacity"] = axis_props["gridlines"][0].properties()["alpha"] + axis_config["gridCap"] = axis_props["gridlines"][0].properties()["dash_capstyle"] + grid_color = float(axis_props["gridlines"][0].properties()["markeredgecolor"]) + axis_config["gridColor"] = mcolors.to_hex([grid_color] * 3) axis_config["gridWidth"] = (axis_props["gridlines"][0].properties()["markeredgewidth"] * dpi) / 72 - axis_config["labelFont"] = axis_props['majorticklabels'][0].get_fontname() - axis_config["labelFontSize"] = (axis_props['majorticklabels'][0].get_size() * dpi) / 72 - axis_config["labelFontStyle"] = axis_props['majorticklabels'][0].get_fontstyle() - axis_config["labelFontWeight"] = axis_props['majorticklabels'][0].get_fontweight() + axis_config["labelFont"] = axis_props["majorticklabels"][0].get_fontname() + axis_config["labelFontSize"] = (axis_props["majorticklabels"][0].get_size() * dpi) / 72 + axis_config["labelFontStyle"] = axis_props["majorticklabels"][0].get_fontstyle() + axis_config["labelFontWeight"] = axis_props["majorticklabels"][0].get_fontweight() axis_config["tickCount"] = len(axis_props["ticklocs"]) if axis_config["tickCount"] != 0: tick_props = axis_props["ticklines"][0].properties() @@ -252,8 +259,10 @@ def _create_axis_block(ax, axis_scales_block, dpi): if axis_config["ticks"] and axis_config["tickOpacity"] != 0: axis_config["tickColor"] = mcolors.to_hex(tick_props["color"]) axis_config["tickCap"] = tick_props["dash_capstyle"] - axis_config["tickWidth"] = (tick_props['linewidth'] * dpi) / 72 - axis_config["tickSize"] = (tick_props['markersize'] * dpi) / 72 #also marker edge width, but vega doesn't have an equivalent for that. + axis_config["tickWidth"] = (tick_props["linewidth"] * dpi) / 72 + axis_config["tickSize"] = ( + tick_props["markersize"] * dpi + ) / 72 # also marker edge width, but vega doesn't have an equivalent for that. label = axis_props["label_text"] if label == "": @@ -272,7 +281,8 @@ def _create_axis_block(ax, axis_scales_block, dpi): axis_array.append(axis_config) return axis_array -def create_viewconfig(sdata, fig_params, legend_params, cs): + +def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: Any, cs: str) -> dict[str, Any]: fig = fig_params.fig ax = fig_params.ax data_block = _create_data_configs(sdata.plotting_tree, cs, sdata._path) @@ -280,15 +290,13 @@ def create_viewconfig(sdata, fig_params, legend_params, cs): axis_scales_block = _create_axis_scale_block(ax) axis_array = _create_axis_block(ax, axis_scales_block, fig.dpi) - viewconfig = { + return { "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": fig.get_figheight() * fig.dpi, # matplotlib uses inches, but vega uses absolute pixels + "height": fig.get_figheight() * fig.dpi, # matplotlib uses inches, but vega uses absolute pixels "width": fig.get_figwidth() * fig.dpi, "padding": _create_padding_object(fig), "title": _create_title_config(ax, fig), "data": data_block, "scales": axis_scales_block, "axes": axis_array, - } - print() diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index cbe564bc..704a270e 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -1,6 +1,8 @@ from __future__ import annotations +import json import sys +import uuid import warnings from collections import OrderedDict from copy import deepcopy @@ -22,14 +24,15 @@ from spatialdata._utils import _deprecation_alias from xarray import DataArray, DataTree +import spatialdata_plot.config from spatialdata_plot._accessor import register_spatial_data_accessor +from spatialdata_plot.pl._viewconfig import create_viewconfig from spatialdata_plot.pl.render import ( _render_images, _render_labels, _render_points, _render_shapes, ) -from spatialdata_plot.pl._viewconfig import create_viewconfig from spatialdata_plot.pl.render_params import ( CmapParams, ImageRenderParams, @@ -150,6 +153,7 @@ def _copy( tables=self._sdata.tables if tables is None else tables, ) sdata.plotting_tree = self._sdata.plotting_tree if hasattr(self._sdata, "plotting_tree") else OrderedDict() + sdata._sdata = self._sdata return sdata @@ -724,7 +728,8 @@ def show( ax: list[Axes] | Axes | None = None, return_ax: bool = False, save: str | Path | None = None, - store_viewconfig: bool = True, + store_viewconfig_in_attrs: bool | None = None, + store_viewconfig_to_disk: Path | None = None, ) -> sd.SpatialData: """ Plot the images in the SpatialData object. @@ -735,6 +740,27 @@ def show( Name(s) of the coordinate system(s) to be plotted. If None, all coordinate systems are plotted. If a coordinate system doesn't contain any relevant elements (as specified in the render_* calls), it is automatically not plotted. + legend_fontsize : + Font size of the legend text. + legend_fontweight : + Font weight of the legend text. + legend_loc : + Location of the legend on the plot. + legend_fontoutline : + Width of the outline around the legend text. + na_in_legend : + Whether to include 'NA' values in the legend. + colorbar : + Whether to plot the colorbar. + wspace : + The amount of width reserved for space between subplots, expressed as a fraction of the average axis width. + hspace : + The amount of height reserved for space between subplots, expressed as a fraction of the average axis + height. + ncols : + Number of columns in the figure. + frameon : + Whether to draw the frame around the plot. figsize : Size of the figure (width, height) in inches. The size of the actual canvas may deviate from this, depending on the dpi! In matplotlib, the actual figure size (in pixels) is dpi * figsize. @@ -742,17 +768,25 @@ def show( dpi : Resolution of the plot in dots per inch (as in matplotlib). If None, the default of matplotlib is used (100.0). + fig : + Matplotlib Figure object to use for plotting. + title : + The title of the plot. If not provided, the plot will have the name of the coordinate system as the title. + share_extent : + Whether to share the extent of the plots. + pad_extent : + Padding around the extent of the plots, expressed as an integer or float. ax : - Matplotlib axes object to plot on. If None, a new figure is created. - Works only if there is one image in the SpatialData object. - ncols : - Number of columns in the figure. Default is 4. + Matplotlib Axes object to plot on. Works only if there is one image in the SpatialData object. return_ax : - Whether to return the axes object created. False by default. - colorbar : - Whether to plot the colorbar. True by default. - title : - The title of the plot. If not provided the plot will have the name of the coordinate system as title. + Whether to return the axes object created. + save : + Path to save the plot to a file. + store_viewconfig_in_attrs : + Whether to store the view configuration in `.attrs` slot of the `SpatialData` object. It defaults to + `spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS`. + store_viewconfig_to_disk : + Path to store the view configuration on disk. By default, the view configuration is not stored on disk. Returns ------- @@ -790,6 +824,9 @@ def show( save, ) + if store_viewconfig_in_attrs is None: + store_viewconfig_in_attrs = spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS + sdata = self._copy() # Evaluate execution tree for plotting @@ -833,15 +870,16 @@ def show( coordinate_systems = sdata.coordinate_systems if coordinate_systems is None else coordinate_systems - # Only reason for multiple coordinate systems is to show quick overview, but this would complicate the view config - # implementation. For testing now, global is used as default. - if not isinstance(coordinate_systems, str) and store_viewconfig: + # Only reason for multiple coordinate systems is to show quick overview, but this would complicate the + # view config implementation. For testing now, global is used as default. + if not isinstance(coordinate_systems, str) and store_viewconfig_in_attrs: # TODO: change this when having full implementation. store_viewconfig_cs = "global" - #raise ValueError("If wanting to store the view configuration. A single coordinate system must be provided") + # raise ValueError("If wanting to store the view configuration. A single coordinate system must be + # provided") if isinstance(coordinate_systems, str): - if store_viewconfig: + if store_viewconfig_in_attrs: store_viewconfig_cs = coordinate_systems coordinate_systems = [coordinate_systems] @@ -1041,8 +1079,32 @@ def show( if fig_params.fig is not None and save is not None: save_fig(fig_params.fig, path=save) - if store_viewconfig: - create_viewconfig(sdata, fig_params, legend_params, store_viewconfig_cs) + def get_current_ax_uuid(ax: Axes) -> str: + return str(uuid.uuid5(uuid.NAMESPACE_DNS, str(id(ax)))) + + def _concat_viewconfig( + old_viewconfig: list[dict[str, Any]], new_viewconfig: list[dict[str, Any]] + ) -> list[dict[str, Any]]: + return old_viewconfig + new_viewconfig + + viewconfig: list[dict[str, Any]] | None = None + if store_viewconfig_in_attrs or store_viewconfig_to_disk: + viewconfig = [create_viewconfig(sdata, fig_params, legend_params, store_viewconfig_cs)] + if store_viewconfig_in_attrs: + root = sdata + while hasattr(root, "_sdata"): + root = root._sdata + + assert isinstance(viewconfig, list) + viewconfig[0]["usermeta"] = {"axis_uuid": get_current_ax_uuid(ax)} + if "viewconfig" not in root.attrs: + root.attrs["viewconfig"] = viewconfig + else: + merged_viewconfig = _concat_viewconfig(root.attrs["viewconfig"], viewconfig) + root.attrs["viewconfig"] = merged_viewconfig + if store_viewconfig_to_disk: + with open(store_viewconfig_to_disk, "w") as outfile: + json.dump(viewconfig, outfile) # Manually show plot if we're not in interactive mode # https://stackoverflow.com/a/64523765 diff --git a/tests/conftest.py b/tests/conftest.py index 27adff68..74c57fed 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +import json +import warnings from abc import ABC, ABCMeta from collections.abc import Callable from functools import wraps @@ -27,11 +29,13 @@ from xarray import DataArray, DataTree import spatialdata_plot # noqa: F401 +import spatialdata_plot.config HERE: Path = Path(__file__).parent EXPECTED = HERE / "_images" ACTUAL = HERE / "figures" +VIEWCONFIG_ACTUAL = HERE / "figures_viewconfig" TOL = 15 DPI = 80 @@ -64,6 +68,11 @@ def sdata_raccoon() -> SpatialData: return raccoon() +@pytest.fixture() +def sdata_empty() -> SpatialData: + return SpatialData() + + @pytest.fixture def test_sdata_single_image(): """Creates a simple sdata object.""" @@ -386,6 +395,7 @@ def compare(cls, basename: str, tolerance: float | None = None): # Apply constrained layout and save the plot fig.set_constrained_layout(True) plt.savefig(out_path, dpi=DPI) + plt.close() if tolerance is None: @@ -400,9 +410,35 @@ def compare(cls, basename: str, tolerance: float | None = None): def _decorate(fn: Callable, clsname: str, name: str | None = None) -> Callable: @wraps(fn) def save_and_compare(self, *args, **kwargs): + # we need the test to contain one of these parameters as argument; the view configuration will be saved there + keys_to_check = ["sdata_blobs", "sdata_blobs_str", "sdata_raccoon", "sdata_empty"] + sdata = None + for key in keys_to_check: + sdata = kwargs.get(key) + if sdata is not None: + break + + if sdata is not None: + old_config = spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS + spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS = True fn(self, *args, **kwargs) self.compare(fig_name) + if sdata is not None: + spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS = old_config + if "viewconfig" in sdata.attrs: + viewconfig = sdata.attrs["viewconfig"] + VIEWCONFIG_ACTUAL.mkdir(parents=True, exist_ok=True) + with open(VIEWCONFIG_ACTUAL / f"{fig_name}.json", "w") as outfile: + json.dump(viewconfig, outfile, indent=4) + return + + # uncomment to catch tests that do not save the viewconfig + # raise ValueError("No viewconfig saved for the test") + warnings.warn( + f"No viewconfig found in {keys_to_check} object. Skipping viewconfig generation.", UserWarning, stacklevel=2 + ) + if not callable(fn): raise TypeError(f"Expected a `callable` for class `{clsname}`, found `{type(fn).__name__}`.") diff --git a/tests/pl/test_get_extent.py b/tests/pl/test_get_extent.py index 338a17b7..2f4ed74c 100644 --- a/tests/pl/test_get_extent.py +++ b/tests/pl/test_get_extent.py @@ -51,9 +51,10 @@ def test_plot_extent_of_img_is_correct_after_spatial_query(self, sdata_blobs: Sp cropped_blobs = sdata_blobs.query.bounding_box( axes=["x", "y"], min_coordinate=[100, 100], max_coordinate=[400, 400], target_coordinate_system="global" ) + cropped_blobs._sdata = sdata_blobs cropped_blobs.pl.render_images().pl.show() - def test_plot_correct_plot_after_transformations(self): + def test_plot_correct_plot_after_transformations(self, sdata_empty): # inspired by https://github.com/scverse/spatialdata/blob/ef0a2dc7f9af8d4c84f15eec503177f1d08c3d46/tests/core/test_data_extent.py#L125 circles = [Point(p) for p in [[0.5, 0.1], [0.9, 0.5], [0.5, 0.9], [0.1, 0.5]]] @@ -98,6 +99,7 @@ def test_plot_correct_plot_after_transformations(self): }, points={"points": points_df, "points_pi3": points_df, "points_pi4": points_df}, ) + sdata._sdata = sdata_empty for i in [3, 4]: theta = math.pi / i diff --git a/tests/pl/test_render_labels.py b/tests/pl/test_render_labels.py index d7697bd7..c1217841 100644 --- a/tests/pl/test_render_labels.py +++ b/tests/pl/test_render_labels.py @@ -117,6 +117,9 @@ def _make_tablemodel_with_categorical_labels(sdata_blobs, label): _, axs = plt.subplots(nrows=1, ncols=3, layout="tight") + sdata_blobs.pl.render_labels(label, color="channel_1_sum", table="other_table", scale="scale0").pl.show( + ax=axs[0], title="ch_1_sum", colorbar=False + ) sdata_blobs.pl.render_labels(label, color="channel_1_sum", table="other_table", scale="scale0").pl.show( ax=axs[0], title="ch_1_sum", colorbar=False ) @@ -130,6 +133,7 @@ def _make_tablemodel_with_categorical_labels(sdata_blobs, label): # we're modifying the data here, so we need an independent copy sdata_blobs_local = deepcopy(sdata_blobs) + sdata_blobs_local._sdata = sdata_blobs _make_tablemodel_with_categorical_labels(sdata_blobs_local, label) def test_plot_two_calls_with_coloring_result_in_two_colorbars(self, sdata_blobs: SpatialData): @@ -141,6 +145,7 @@ def test_plot_two_calls_with_coloring_result_in_two_colorbars(self, sdata_blobs: table.uns["spatialdata_attrs"]["region"] = "blobs_multiscale_labels" table = table[:, ~table.var_names.isin(["channel_0_sum"])] sdata_blobs_local["multi_table"] = table + sdata_blobs_local._sdata = sdata_blobs sdata_blobs_local.pl.render_labels("blobs_labels", color="channel_0_sum", table_name="table").pl.render_labels( "blobs_multiscale_labels", color="channel_1_sum", table_name="multi_table" ).pl.show() diff --git a/tests/pl/test_render_points.py b/tests/pl/test_render_points.py index 3ddef2bb..cf0ecda9 100644 --- a/tests/pl/test_render_points.py +++ b/tests/pl/test_render_points.py @@ -166,6 +166,7 @@ def test_plot_datashader_can_use_std_as_reduction_not_all_zero(self, sdata_blobs temp.loc[195, "y"] = 159 temp.loc[195, "instance_id"] = 13 blob["blobs_points"] = PointsModel.parse(dask.dataframe.from_pandas(temp, 1), coordinates={"x": "x", "y": "y"}) + blob._sdata = sdata_blobs blob.pl.render_points( element="blobs_points", size=40, color="instance_id", method="datashader", datashader_reduction="std" ).pl.show() @@ -190,7 +191,7 @@ def test_plot_mpl_and_datashader_point_sizes_agree_after_altered_dpi(self, sdata element="blobs_points", size=400, color="yellow", method="datashader", alpha=0.8 ).pl.show(dpi=200) - def test_plot_points_transformed_ds_agrees_with_mpl(self): + def test_plot_points_transformed_ds_agrees_with_mpl(self, sdata_empty): sdata = SpatialData( points={ "points1": PointsModel.parse( @@ -199,6 +200,7 @@ def test_plot_points_transformed_ds_agrees_with_mpl(self): ) }, ) + sdata._sdata = sdata_empty sdata.pl.render_points("points1", method="matplotlib", size=50, color="lightgrey").pl.render_points( "points1", method="datashader", size=10, color="red" ).pl.show() diff --git a/tests/pl/test_render_shapes.py b/tests/pl/test_render_shapes.py index 7abb0783..978d84f0 100644 --- a/tests/pl/test_render_shapes.py +++ b/tests/pl/test_render_shapes.py @@ -71,7 +71,7 @@ def test_plot_can_render_circles_with_default_outline_width(self, sdata_blobs: S def test_plot_can_render_circles_with_specified_outline_width(self, sdata_blobs: SpatialData): sdata_blobs.pl.render_shapes(element="blobs_circles", outline_alpha=1, outline_width=3.0).pl.show() - def test_plot_can_render_multipolygons(self): + def test_plot_can_render_multipolygons(self, sdata_empty): def _make_multi(): hole = MultiPolygon( [(((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), [((0.2, 0.2), (0.2, 0.8), (0.8, 0.8), (0.8, 0.2))])] @@ -92,6 +92,7 @@ def _make_multi(): return sd_polygons sdata = SpatialData(shapes={"p": _make_multi()}) + sdata._sdata = sdata_empty adata = anndata.AnnData(pd.DataFrame({"p": ["hole", "overlap", "square", "circle"]})) adata.obs.loc[:, "region"] = "p" adata.obs.loc[:, "val"] = [0, 1, 2, 3] @@ -104,6 +105,7 @@ def test_plot_can_color_from_geodataframe(self, sdata_blobs: SpatialData): blob["table"].obs["region"] = "blobs_polygons" blob["table"].uns["spatialdata_attrs"]["region"] = "blobs_polygons" blob.shapes["blobs_polygons"]["value"] = [1, 10, 1, 20, 1] + blob._sdata = sdata_blobs blob.pl.render_shapes( element="blobs_polygons", color="value", @@ -166,6 +168,7 @@ def test_plot_can_plot_shapes_after_spatial_query(self, sdata_blobs: SpatialData cropped_blob = blob.query.bounding_box( axes=["x", "y"], min_coordinate=[100, 100], max_coordinate=[300, 300], target_coordinate_system="global" ) + cropped_blob._sdata = sdata_blobs cropped_blob.pl.render_shapes().pl.show() def test_plot_can_plot_with_annotation_despite_random_shuffling(self, sdata_blobs: SpatialData): @@ -213,6 +216,7 @@ def test_plot_can_plot_queried_with_annotation_despite_random_shuffling(self, sd filter_table=True, ) + sdata_cropped._sdata = sdata_blobs sdata_cropped.pl.render_shapes("blobs_circles", color="annotation").pl.show() def test_plot_can_color_two_shapes_elements_by_annotation(self, sdata_blobs: SpatialData): @@ -257,6 +261,7 @@ def test_plot_can_color_two_queried_shapes_elements_by_annotation(self, sdata_bl filter_table=True, ) + sdata_cropped._sdata = sdata_blobs sdata_cropped.pl.render_shapes("blobs_circles", color="annotation").pl.render_shapes( "blobs_polygons", color="annotation" ).pl.show() From bbdb02b64cc62ab8791f5c2627adb3c2c20b425c Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 23 Feb 2025 16:57:23 +0100 Subject: [PATCH 06/56] minor updates --- src/spatialdata_plot/pl/_viewconfig.py | 180 ++++++++++++++----------- 1 file changed, 101 insertions(+), 79 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index c7b7720c..f35eb451 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -109,7 +109,7 @@ def _create_base_level_sdata_block(url: Path): "version": spatialdata.__version__} return base_block -def _create_derived_data_block(call: str, params: Params, base_uuid: UUID, cs: str): +def _create_derived_data_block(ax, call: str, params: Params, base_uuid: UUID, cs: str): """Create vega like data object for SpatialData elements. Each object for a SpatialData element contains an additional transform that @@ -130,28 +130,105 @@ def _create_derived_data_block(call: str, params: Params, base_uuid: UUID, cs: s cs: str The name of the coordinate system in which the SpatialData element was plotted. """ - data_block = {} + data_object = {} + marks_array = {} + img_counter = 0 - data_block["name"] = str(uuid4()) + data_object["name"] = params.element + "_" + str(uuid4()) # TODO: think about versioning of individual spatialdata elements if "render_images" in call: - data_block["format"] = {"type": "spatialdata_image", "version": 0.1} + data_object["format"] = {"type": "spatialdata_image", "version": 0.1} + marks_object = _create_raster_image_marks_object(ax,call, params, data_object["name"], img_counter) + img_counter += 1 elif "render_labels" in call: - data_block["format"] = {"type": "spatialdata_label", "version": 0.1} + data_object["format"] = {"type": "spatialdata_label", "version": 0.1} elif "render_points" in call: - data_block["format"] = {"type": "spatialdata_point", "version": 0.1} + data_object["format"] = {"type": "spatialdata_point", "version": 0.1} elif "render_shapes" in call: - data_block["format"] = {"type": "spatialdata_shape", "version": 0.1} + data_object["format"] = {"type": "spatialdata_shape", "version": 0.1} else: raise ValueError(f"Unknown call: {call}") - data_block["source"] = base_uuid - data_block["transform"] = [{"type": "filter_element", "expr": params.element}, + data_object["source"] = base_uuid + data_object["transform"] = [{"type": "filter_element", "expr": params.element}, {"type": "filter_cs", "expr": cs}] - return data_block + + # TODO: complete this part + if "render_images" in call: + multiscale = "full" if not params.scale else params.scale + data_object["transform"].append({"type": "filter_scale", "expr": multiscale}) + data_object["transform"].append({"type": "filter_channel", "expr": params.channel}) + return data_object, marks_array + +def _create_raster_image_marks_object(ax, call: str, params: ImageRenderParams, element_uuid: str, counter): + image_object = OrderedDict() + image_object["type"] = "raster_image" + image_object["from"] = {"data": element_uuid} + image_object["zindex"] = ax.properties()['images'][counter].zorder + image_object["encode"] = {"enter": { + + "opacity": {"value": ax.properties()['images'][counter].properties()['alpha']} + }} + return image_object +# def plotting_tree_dict_to_marks(plotting_tree_dict): +# out = [] # caller will set { ..., "marks": out } +# for pl_call_id, pl_call_params in plotting_tree_dict.items(): +# if pl_call_id.endswith("_render_images"): +# for channel_index in pl_call_params["channel"]: +# out.append({ +# "type": "raster_image", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": { "value": pl_call_params.get("alpha") }, +# "color": {"scale": get_scale_name(pl_call_params), "field": channel_index } +# } +# }) +# if pl_call_id.endswith("_render_shapes"): +# out.append({ +# "type": "shape", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, +# "fillColor": get_shapes_color_encoding(pl_call_params), +# "strokeWidth": {"value": pl_call_params.get("outline_width")}, +# # TODO: check whether this is the key used in the spatial plotting tree # TODO: what are the units? +# "strokeColor": {"value": pl_call_params.get("outline_color")}, +# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, +# } +# }) +# if pl_call_id.endswith("_render_points"): +# out.append({ +# "type": "point", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": {"value": pl_call_params.get("alpha")}, +# "color": get_shapes_color_encoding(pl_call_params), +# "size": {"value": pl_call_params.get("size")}, +# } +# }) +# if pl_call_id.endswith("_render_labels"): +# out.append({ +# "type": "raster_labels", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": {"value": pl_call_params.get("alpha")}, +# "fillColor": get_shapes_color_encoding(pl_call_params), +# "strokeColor": get_shapes_color_encoding(pl_call_params), +# "strokeWidth": {"value": pl_call_params.get("contour_px")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# } +# }) -def _create_data_configs(plotting_tree: OrderedDict[str, Params], cs: str, sdata_path: str): +def _create_data_configs(plotting_tree: OrderedDict[str, Params], ax, cs: str, sdata_path: str): """Create the vega json array value to the data key. The data array in the SpatialData vegalike viewconfig consists out of @@ -178,7 +255,8 @@ def _create_data_configs(plotting_tree: OrderedDict[str, Params], cs: str, sdata base_block = _create_base_level_sdata_block(url) data.append(base_block) for call, params in plotting_tree.items(): - data.append(_create_derived_data_block(call, params, base_block["name"], cs)) + data_object, marks_object = _create_derived_data_block(ax, call, params, base_block["name"], cs) + data.append(data_object) return data @@ -272,80 +350,24 @@ def _create_axis_block(ax, axis_scales_block, dpi): axis_array.append(axis_config) return axis_array -# def plotting_tree_dict_to_marks(plotting_tree_dict): -# out = [] # caller will set { ..., "marks": out } -# for pl_call_id, pl_call_params in plotting_tree_dict.items(): -# if pl_call_id.endswith("_render_images"): -# for channel_index in pl_call_params["channel"]: -# out.append({ -# "type": "raster_image", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": { "value": pl_call_params.get("alpha") }, -# "color": {"scale": get_scale_name(pl_call_params), "field": channel_index } -# } -# }) -# if pl_call_id.endswith("_render_shapes"): -# out.append({ -# "type": "shape", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, -# "fillColor": get_shapes_color_encoding(pl_call_params), -# "strokeWidth": {"value": pl_call_params.get("outline_width")}, -# # TODO: check whether this is the key used in the spatial plotting tree # TODO: what are the units? -# "strokeColor": {"value": pl_call_params.get("outline_color")}, -# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, -# } -# }) -# if pl_call_id.endswith("_render_points"): -# out.append({ -# "type": "point", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": {"value": pl_call_params.get("alpha")}, -# "color": get_shapes_color_encoding(pl_call_params), -# "size": {"value": pl_call_params.get("size")}, -# } -# }) -# if pl_call_id.endswith("_render_labels"): -# out.append({ -# "type": "raster_labels", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": {"value": pl_call_params.get("alpha")}, -# "fillColor": get_shapes_color_encoding(pl_call_params), -# "strokeColor": get_shapes_color_encoding(pl_call_params), -# "strokeWidth": {"value": pl_call_params.get("contour_px")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# } -# }) def create_viewconfig(sdata, fig_params, legend_params, cs): fig = fig_params.fig ax = fig_params.ax - data_block = _create_data_configs(sdata.plotting_tree, cs, sdata._path) + data_block = _create_data_configs(sdata.plotting_tree, ax, cs, sdata._path) axis_scales_block = _create_axis_scale_block(ax) axis_array = _create_axis_block(ax, axis_scales_block, fig.dpi) - viewconfig = { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": fig.get_figheight() * fig.dpi, # matplotlib uses inches, but vega uses absolute pixels - "width": fig.get_figwidth() * fig.dpi, - "padding": _create_padding_object(fig), - "title": _create_title_config(ax, fig), - "data": data_block, - "scales": axis_scales_block, - "axes": axis_array, + # TODO: check why attrs does not respect ordereddict when writing sdata + viewconfig = OrderedDict() + viewconfig["$schema"] = "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + viewconfig["height"] = fig.get_figheight() * fig.dpi # matplotlib uses inches, but vega uses absolute pixels + viewconfig["width"] = fig.get_figwidth() * fig.dpi + viewconfig["padding"] = _create_padding_object(fig) + viewconfig["title"] = _create_title_config(ax, fig) + viewconfig["data"] = data_block + viewconfig["scales"] = axis_scales_block + viewconfig["axes"] = axis_array - } print() From 97af1250bf0ef3f2bacbba0bb601c6211f8c6372 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 23 Feb 2025 23:21:39 +0100 Subject: [PATCH 07/56] remove percentiles_for_norm --- src/spatialdata_plot/pl/render_params.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index b44175c3..79858cd9 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -122,7 +122,6 @@ class ImageRenderParams: channel: list[str] | list[int] | int | str | None = None palette: ListedColormap | list[str] | None = None alpha: float = 1.0 - percentiles_for_norm: tuple[float | None, float | None] = (None, None) scale: str | None = None zorder: int = 0 From 9520a936f6fce6693dd61d4cad3d3f35706a398d Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 23 Feb 2025 23:38:51 +0100 Subject: [PATCH 08/56] finalize basic config image --- src/spatialdata_plot/pl/_viewconfig.py | 212 ++++++++++++++++--------- src/spatialdata_plot/pl/basic.py | 6 +- 2 files changed, 137 insertions(+), 81 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index dfd1a9dc..2e291436 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -1,5 +1,6 @@ from __future__ import annotations +import re from collections import OrderedDict from enum import Enum from pathlib import Path @@ -12,6 +13,7 @@ from matplotlib.figure import Figure from spatialdata_plot.pl.render_params import ( + CmapParams, FigParams, ImageRenderParams, LabelsRenderParams, @@ -99,6 +101,25 @@ def _create_padding_object(fig: Figure) -> dict[str, float]: } +def _create_colorscale_image(cmap_params: CmapParams) -> dict[str, Any]: + cmap = cmap_params.cmap + if isinstance(cmap, mcolors.ListedColormap): + type_scale = "ordinal" + if cmap.name == "from_list": # default name when cmap is custom. + pass + else: + color_range = {"scheme": cmap.name, "count": cmap.N} + + return { + "name": f"color_{str(uuid4())}", + "type": type_scale, + # The domain in matplotlib seems to be 0-1 always for images, but for example for napari should be + # interpreted as relative + "domain": [0, 1], + "range": color_range, + } + + def _create_base_level_sdata_block(url: str) -> dict[str, Any]: """Create the vega json object for the SpatialData zarr store. @@ -117,8 +138,8 @@ def _create_base_level_sdata_block(url: str) -> dict[str, Any]: def _create_derived_data_block( - ax: Axes, call: str, params: Params, base_uuid: str, cs: str -) -> tuple[dict[str, Any], dict[str, Any]]: + ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int +) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any]]: """Create vega like data object for SpatialData elements. Each object for a SpatialData element contains an additional transform that @@ -140,15 +161,14 @@ def _create_derived_data_block( The name of the coordinate system in which the SpatialData element was plotted. """ data_object: dict[str, Any] = {} - img_counter = 0 + marks_object: dict[str, Any] = {} + color_scale_object: dict[str, Any] = {} data_object["name"] = params.element + "_" + str(uuid4()) # TODO: think about versioning of individual spatialdata elements if "render_images" in call and isinstance(params, ImageRenderParams): data_object["format"] = {"type": "spatialdata_image", "version": 0.1} - marks_object = _create_raster_image_marks_object(ax, call, params, data_object["name"], img_counter) - img_counter += 1 elif "render_labels" in call: data_object["format"] = {"type": "spatialdata_label", "version": 0.1} marks_object = {"a": 5} @@ -164,87 +184,54 @@ def _create_derived_data_block( data_object["source"] = base_uuid data_object["transform"] = [{"type": "filter_element", "expr": params.element}, {"type": "filter_cs", "expr": cs}] - # TODO: complete this part if "render_images" in call and isinstance(params, ImageRenderParams): # second part to shut up mypy multiscale = "full" if not params.scale else params.scale data_object["transform"].append({"type": "filter_scale", "expr": multiscale}) data_object["transform"].append({"type": "filter_channel", "expr": params.channel}) - return data_object, marks_object + # Use isinstance because of possible 0 value + if isinstance(vmin := params.cmap_params.norm.vmin, float) and isinstance( + vmax := params.cmap_params.norm.vmax, float + ): + + if params.cmap_params.norm.clip: + formula = f"clamp((datum.value - {vmin}) / ({vmax} - {vmin}), 0, 1)" + else: + formula = f"(datum.value - {vmin}) / ({vmax} - {vmin})" + data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) + + color_scale_object = _create_colorscale_image(params.cmap_params) + + marks_object = _create_raster_image_marks_object( + ax, call, params, data_object, call_count, color_scale_object["name"] + ) + return data_object, marks_object, color_scale_object def _create_raster_image_marks_object( - ax: Axes, call: str, params: ImageRenderParams, element_uuid: str, counter: int + ax: Axes, call: str, params: ImageRenderParams, data_object: dict[str, Any], call_count: int, scale_id: str ) -> dict[str, Any]: return { "type": "raster_image", - "from": {"data": element_uuid}, - "zindex": ax.properties()["images"][counter].zorder, - "encode": {"enter": {"opacity": {"value": ax.properties()["images"][counter].properties()["alpha"]}}}, + "from": {"data": data_object["name"]}, + "zindex": ax.properties()["images"][call_count].zorder, + "encode": { + "enter": { + "opacity": {"value": ax.properties()["images"][call_count].properties()["alpha"]}, + "fill": [{"scale": scale_id, "value": "intensity_value"}], + } + }, } -# def plotting_tree_dict_to_marks(plotting_tree_dict): -# out = [] # caller will set { ..., "marks": out } -# for pl_call_id, pl_call_params in plotting_tree_dict.items(): -# if pl_call_id.endswith("_render_images"): -# for channel_index in pl_call_params["channel"]: -# out.append({ -# "type": "raster_image", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": { "value": pl_call_params.get("alpha") }, -# "color": {"scale": get_scale_name(pl_call_params), "field": channel_index } -# } -# }) -# if pl_call_id.endswith("_render_shapes"): -# out.append({ -# "type": "shape", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, -# "fillColor": get_shapes_color_encoding(pl_call_params), -# "strokeWidth": {"value": pl_call_params.get("outline_width")}, -# # TODO: check whether this is the key used in the spatial plotting tree # TODO: what are the units? -# "strokeColor": {"value": pl_call_params.get("outline_color")}, -# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, -# } -# }) -# if pl_call_id.endswith("_render_points"): -# out.append({ -# "type": "point", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": {"value": pl_call_params.get("alpha")}, -# "color": get_shapes_color_encoding(pl_call_params), -# "size": {"value": pl_call_params.get("size")}, -# } -# }) -# if pl_call_id.endswith("_render_labels"): -# out.append({ -# "type": "raster_labels", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": {"value": pl_call_params.get("alpha")}, -# "fillColor": get_shapes_color_encoding(pl_call_params), -# "strokeColor": get_shapes_color_encoding(pl_call_params), -# "strokeWidth": {"value": pl_call_params.get("contour_px")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# } -# }) +def strip_call(s: str) -> str: + """Strip leading digit and underscore from call.""" + return re.sub(r"^\d+_", "", s) def _create_data_configs( plotting_tree: OrderedDict[str, Params], ax: Axes, cs: str, sdata_path: str -) -> list[dict[str, Any]]: +) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: """Create the vega json array value to the data key. The data array in the SpatialData vegalike viewconfig consists out of @@ -262,19 +249,29 @@ def _create_data_configs( sdata_path: str The location of the SpatialData zarr store. """ - data = [] + data_array = [] + marks_array = [] + color_scale_array = [] url = str(Path("sdata.zarr")) if sdata_path: url = sdata_path base_block = _create_base_level_sdata_block(url) - data.append(base_block) + data_array.append(base_block) + + counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} for call, params in plotting_tree.items(): - data_object, marks_object = _create_derived_data_block(ax, call, params, base_block["name"], cs) - data.append(data_object) + call = strip_call(call) + data_object, marks_object, color_scale_object = _create_derived_data_block( + ax, call, params, base_block["name"], cs, counters[call] + ) + data_array.append(data_object) + marks_array.append(marks_object) + color_scale_array.append(color_scale_object) + counters[call] += 1 - return data + return data_array, marks_array, color_scale_array def _create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: @@ -373,10 +370,10 @@ def _create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: f def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: Any, cs: str) -> dict[str, Any]: fig = fig_params.fig ax = fig_params.ax - data_block = _create_data_configs(sdata.plotting_tree, ax, cs, sdata._path) + data_array, marks_array, color_scale_array = _create_data_configs(sdata.plotting_tree, ax, cs, sdata._path) - axis_scales_block = _create_axis_scale_block(ax) - axis_array = _create_axis_block(ax, axis_scales_block, fig.dpi) + scales_array = _create_axis_scale_block(ax) + axis_array = _create_axis_block(ax, scales_array, fig.dpi) # TODO: check why attrs does not respect ordereddict when writing sdata return { @@ -385,7 +382,66 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: "width": fig.get_figwidth() * fig.dpi, "padding": _create_padding_object(fig), "title": _create_title_config(ax, fig), - "data": data_block, - "scales": axis_scales_block, + "data": data_array, + "scales": axis_array + color_scale_array, "axes": axis_array, + "marks": marks_array, } + + +# def plotting_tree_dict_to_marks(plotting_tree_dict): +# out = [] # caller will set { ..., "marks": out } +# for pl_call_id, pl_call_params in plotting_tree_dict.items(): +# if pl_call_id.endswith("_render_images"): +# for channel_index in pl_call_params["channel"]: +# out.append({ +# "type": "raster_image", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": { "value": pl_call_params.get("alpha") }, +# "color": {"scale": get_scale_name(pl_call_params), "field": channel_index } +# } +# }) +# if pl_call_id.endswith("_render_shapes"): +# out.append({ +# "type": "shape", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, +# "fillColor": get_shapes_color_encoding(pl_call_params), +# "strokeWidth": {"value": pl_call_params.get("outline_width")}, +# # TODO: check whether this is the key used in the spatial plotting tree # TODO: what are the units? +# "strokeColor": {"value": pl_call_params.get("outline_color")}, +# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, +# } +# }) +# if pl_call_id.endswith("_render_points"): +# out.append({ +# "type": "point", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": {"value": pl_call_params.get("alpha")}, +# "color": get_shapes_color_encoding(pl_call_params), +# "size": {"value": pl_call_params.get("size")}, +# } +# }) +# if pl_call_id.endswith("_render_labels"): +# out.append({ +# "type": "raster_labels", +# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, +# "zindex": pl_call_params["zorder"], +# "encode": { +# "opacity": {"value": pl_call_params.get("alpha")}, +# "fillColor": get_shapes_color_encoding(pl_call_params), +# "strokeColor": get_shapes_color_encoding(pl_call_params), +# "strokeWidth": {"value": pl_call_params.get("contour_px")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, +# # TODO: check whether this is the key used in the spatial plotting tree +# } +# }) diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 704a270e..7e7f0f8b 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -1076,9 +1076,6 @@ def show( ax.set_xlim(x_min, x_max) ax.set_ylim(y_max, y_min) # (0, 0) is top-left - if fig_params.fig is not None and save is not None: - save_fig(fig_params.fig, path=save) - def get_current_ax_uuid(ax: Axes) -> str: return str(uuid.uuid5(uuid.NAMESPACE_DNS, str(id(ax)))) @@ -1106,6 +1103,9 @@ def _concat_viewconfig( with open(store_viewconfig_to_disk, "w") as outfile: json.dump(viewconfig, outfile) + if fig_params.fig is not None and save is not None: + save_fig(fig_params.fig, path=save) + # Manually show plot if we're not in interactive mode # https://stackoverflow.com/a/64523765 if not hasattr(sys, "ps1"): From d0e0044d7e63b16c91aeb9ba638ea8c323f35359 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 24 Feb 2025 09:44:42 +0100 Subject: [PATCH 09/56] move json dump before compare --- tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 74c57fed..acf8099d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -422,7 +422,6 @@ def save_and_compare(self, *args, **kwargs): old_config = spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS = True fn(self, *args, **kwargs) - self.compare(fig_name) if sdata is not None: spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS = old_config @@ -439,6 +438,8 @@ def save_and_compare(self, *args, **kwargs): f"No viewconfig found in {keys_to_check} object. Skipping viewconfig generation.", UserWarning, stacklevel=2 ) + self.compare(fig_name) + if not callable(fn): raise TypeError(f"Expected a `callable` for class `{clsname}`, found `{type(fn).__name__}`.") From 6c4d66a90a7f3515924b2efd50d08943b2056421 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 24 Feb 2025 15:27:55 +0100 Subject: [PATCH 10/56] adjust to capture palette in viewconfig --- src/spatialdata_plot/pl/basic.py | 5 ++++- src/spatialdata_plot/pl/render.py | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 7e7f0f8b..6490ad3e 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -953,7 +953,9 @@ def show( wants_shapes = False wanted_elements: list[str] = [] - for cmd, params in render_cmds: + for prefix, cmd_params in enumerate(render_cmds): + cmd, params = cmd_params + prefix += 1 # We create a copy here as the wanted elements can change from one cs to another. params_copy = deepcopy(params) if cmd == "render_images" and has_images: @@ -976,6 +978,7 @@ def show( scalebar_params=scalebar_params, legend_params=legend_params, rasterize=rasterize, + render_count=prefix, ) elif cmd == "render_shapes" and has_shapes: diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 5bafe7a8..0c4bc08e 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -722,6 +722,7 @@ def _render_images( scalebar_params: ScalebarParams, legend_params: LegendParams, rasterize: bool, + render_count: int, ) -> None: sdata_filt = sdata.filter_by_coordinate_system( @@ -794,6 +795,9 @@ def _render_images( cmap._init() cmap._lut[:, -1] = render_params.alpha + # Required for viewconfig + sdata.plotting_tree[f"{render_count}_render_images"].cmap_params.cmap = cmap + _ax_show_and_transform(layer, trans_data, ax, cmap=cmap, zorder=render_params.zorder) if legend_params.colorbar: @@ -854,6 +858,8 @@ def _render_images( raise ValueError("If 'palette' is provided, its length must match the number of channels.") channel_cmaps = [_get_linear_colormap([c], "k")[0] for c in palette if isinstance(c, str)] + + sdata.plotting_tree[f"{render_count}_render_images"].cmap_params.cmap = channel_cmaps colored = np.stack([channel_cmaps[i](layers[c]) for i, c in enumerate(channels)], 0).sum(0) colored = colored[:, :, :3] From f723c70f715b08c0a9bfcafffce0c19cc17c092f Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 24 Feb 2025 15:30:01 +0100 Subject: [PATCH 11/56] complete viewconfig for images --- src/spatialdata_plot/pl/_viewconfig.py | 91 ++++++++++++++++---------- tests/pl/test_render_images.py | 4 ++ 2 files changed, 61 insertions(+), 34 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 2e291436..dc818e57 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -101,23 +101,36 @@ def _create_padding_object(fig: Figure) -> dict[str, float]: } -def _create_colorscale_image(cmap_params: CmapParams) -> dict[str, Any]: - cmap = cmap_params.cmap - if isinstance(cmap, mcolors.ListedColormap): - type_scale = "ordinal" - if cmap.name == "from_list": # default name when cmap is custom. - pass - else: - color_range = {"scheme": cmap.name, "count": cmap.N} +def _create_colorscale_image(cmap_params: CmapParams) -> tuple[list[dict[str, Any]], float]: + cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] + color_scale_array: list[dict[str, Any]] = [] + for cmap in cmaps: + if isinstance(cmap, mcolors.ListedColormap): + type_scale = "ordinal" + if cmap.name == "from_list": # default name when cmap is custom. + # TODO: complete this for all types of cmaps + pass + else: + color_range = {"scheme": cmap.name, "count": cmap.N} + elif isinstance(cmap, mcolors.LinearSegmentedColormap): + # image_alpha = cmap._lut[0][-1] + type_scale = "linear" + if cmap.name == "custom_colormap": + pass + else: + color_range = {"scheme": cmap.name, "count": cmap.N} + color_scale_object = { + "name": f"color_{str(uuid4())}", + "type": type_scale, + # The domain in matplotlib seems to be 0-1 always for images, but for example for napari should be + # interpreted as relative + "domain": [0, 1], + "range": color_range, + } - return { - "name": f"color_{str(uuid4())}", - "type": type_scale, - # The domain in matplotlib seems to be 0-1 always for images, but for example for napari should be - # interpreted as relative - "domain": [0, 1], - "range": color_range, - } + color_scale_array.append(color_scale_object) + + return color_scale_array def _create_base_level_sdata_block(url: str) -> dict[str, Any]: @@ -139,7 +152,7 @@ def _create_base_level_sdata_block(url: str) -> dict[str, Any]: def _create_derived_data_block( ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int -) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any]]: +) -> tuple[dict[str, Any], dict[str, Any], list[dict[str, Any]]]: """Create vega like data object for SpatialData elements. Each object for a SpatialData element contains an additional transform that @@ -162,7 +175,7 @@ def _create_derived_data_block( """ data_object: dict[str, Any] = {} marks_object: dict[str, Any] = {} - color_scale_object: dict[str, Any] = {} + color_scale_array: list[dict[str, Any]] = [] data_object["name"] = params.element + "_" + str(uuid4()) @@ -189,27 +202,37 @@ def _create_derived_data_block( data_object["transform"].append({"type": "filter_scale", "expr": multiscale}) data_object["transform"].append({"type": "filter_channel", "expr": params.channel}) # Use isinstance because of possible 0 value - if isinstance(vmin := params.cmap_params.norm.vmin, float) and isinstance( - vmax := params.cmap_params.norm.vmax, float - ): + norm = params.cmap_params.norm if not isinstance(params.cmap_params, list) else params.cmap_params[0].norm + if isinstance(vmin := norm.vmin, float) and isinstance(vmax := norm.vmax, float): - if params.cmap_params.norm.clip: + if norm.clip: formula = f"clamp((datum.value - {vmin}) / ({vmax} - {vmin}), 0, 1)" else: formula = f"(datum.value - {vmin}) / ({vmax} - {vmin})" data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) - color_scale_object = _create_colorscale_image(params.cmap_params) + color_scale_array = _create_colorscale_image(params.cmap_params) - marks_object = _create_raster_image_marks_object( - ax, call, params, data_object, call_count, color_scale_object["name"] - ) - return data_object, marks_object, color_scale_object + marks_object = _create_raster_image_marks_object(ax, call, params, data_object, call_count, color_scale_array) + return data_object, marks_object, color_scale_array def _create_raster_image_marks_object( - ax: Axes, call: str, params: ImageRenderParams, data_object: dict[str, Any], call_count: int, scale_id: str + ax: Axes, + call: str, + params: ImageRenderParams, + data_object: dict[str, Any], + call_count: int, + color_scale_array: list[dict[str, Any]], + # image_alpha : float ) -> dict[str, Any]: + if len(color_scale_array) == 1: + fill_color = [{"scale": color_scale_array[0]["name"], "value": "intensity_value"}] + else: + fill_color = [ + {"scale": color_scale["name"], "field": f"channel_{index}"} + for index, color_scale in enumerate(color_scale_array) + ] return { "type": "raster_image", @@ -217,8 +240,8 @@ def _create_raster_image_marks_object( "zindex": ax.properties()["images"][call_count].zorder, "encode": { "enter": { - "opacity": {"value": ax.properties()["images"][call_count].properties()["alpha"]}, - "fill": [{"scale": scale_id, "value": "intensity_value"}], + "opacity": {"value": params.alpha}, + "fill": fill_color, } }, } @@ -251,7 +274,7 @@ def _create_data_configs( """ data_array = [] marks_array = [] - color_scale_array = [] + color_scale_array_full = [] url = str(Path("sdata.zarr")) if sdata_path: @@ -263,15 +286,15 @@ def _create_data_configs( counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} for call, params in plotting_tree.items(): call = strip_call(call) - data_object, marks_object, color_scale_object = _create_derived_data_block( + data_object, marks_object, color_scale_array = _create_derived_data_block( ax, call, params, base_block["name"], cs, counters[call] ) data_array.append(data_object) marks_array.append(marks_object) - color_scale_array.append(color_scale_object) + color_scale_array_full += color_scale_array counters[call] += 1 - return data_array, marks_array, color_scale_array + return data_array, marks_array, color_scale_array_full def _create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: diff --git a/tests/pl/test_render_images.py b/tests/pl/test_render_images.py index c4e43977..a319fa9a 100644 --- a/tests/pl/test_render_images.py +++ b/tests/pl/test_render_images.py @@ -70,6 +70,10 @@ def test_plot_can_pass_normalize_clip_True(self, sdata_blobs: SpatialData): norm = Normalize(vmin=0, vmax=0.4, clip=True) sdata_blobs.pl.render_images(element="blobs_image", channel=0, norm=norm).pl.show() + def test_plot_can_pass_normalize_clip_true_list_cmap(self, sdata_blobs: SpatialData): + norm = Normalize(vmin=0, vmax=0.4, clip=True) + sdata_blobs.pl.render_images(element="blobs_image", cmap=["seismic", "Reds", "Blues"], norm=norm).pl.show() + def test_plot_can_pass_normalize_clip_False(self, sdata_blobs: SpatialData): norm = Normalize(vmin=0, vmax=0.4, clip=False) sdata_blobs.pl.render_images(element="blobs_image", channel=0, norm=norm).pl.show() From c2488e604cba5cde86b1f17b7f9abff209452a6d Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Tue, 25 Feb 2025 18:49:09 +0100 Subject: [PATCH 12/56] finalize image config with colorbar legend --- src/spatialdata_plot/pl/_viewconfig.py | 147 ++++++++++++++++++++++--- 1 file changed, 133 insertions(+), 14 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index dc818e57..47591ef0 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -101,19 +101,51 @@ def _create_padding_object(fig: Figure) -> dict[str, float]: } +def _get_colorbar_orient(ax, cbar): + """ + Determine the Vega legend orientation based on the position of a Matplotlib colorbar relative to the main plot. + + Parameters + ---------- + ax: matplotlib.axes.Axes + The main plot axes containing the actual plotted data. + cbar : Colorbar + The matplotlib colorbar object. + + Returns + ------- + str + Vega `legend.orient` value ('top', 'bottom', 'left', 'right', or 'overlapping'). + """ + main_bbox = ax.get_position() # Main plot bounding box + cbar_bbox = cbar.ax.get_position() # Colorbar bounding box + + if cbar_bbox.y1 <= main_bbox.y0: + return "bottom" # Colorbar is below + if cbar_bbox.y0 >= main_bbox.y1: + return "top" # Colorbar is above + if cbar_bbox.x1 <= main_bbox.x0: + return "left" # Colorbar is to the left + if cbar_bbox.x0 >= main_bbox.x1: + return "right" # Colorbar is to the right + + return "overlapping" # Unusual case + + def _create_colorscale_image(cmap_params: CmapParams) -> tuple[list[dict[str, Any]], float]: cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] + cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps # Happens if palette is specified as list of strings color_scale_array: list[dict[str, Any]] = [] for cmap in cmaps: + # TODO: check why listedcolormap is only passed on when we specify channel. if isinstance(cmap, mcolors.ListedColormap): - type_scale = "ordinal" + type_scale = "linear" if cmap.name == "from_list": # default name when cmap is custom. # TODO: complete this for all types of cmaps pass else: color_range = {"scheme": cmap.name, "count": cmap.N} elif isinstance(cmap, mcolors.LinearSegmentedColormap): - # image_alpha = cmap._lut[0][-1] type_scale = "linear" if cmap.name == "custom_colormap": pass @@ -150,8 +182,84 @@ def _create_base_level_sdata_block(url: str) -> dict[str, Any]: } +def _create_legend_title_config(title_obj, dpi): + title_props = title_obj.properties() + return { + "title": title_props["text"], + "titleOrient": "top", + "titleAlign": title_props["horizontalalignment"], + "titleBaseline": title_props["verticalalignment"], + "titleColor": title_props["color"], + "titleFont": title_props["fontname"], + "titleFontSize": (title_props["fontsize"] * dpi) / 72, + "titleFontStyle": title_props["fontstyle"], + "titleFontWeight": title_props["fontweight"], + } + + +def _create_colorbar_legend(fig, color_scale_array): + legend_array: list[dict[str, Any]] = [] + axes = fig.get_axes() + for col_config in color_scale_array: + cbar = None + for ax in axes: + cbar = getattr(ax.properties()["axes_locator"], "_cbar") if ax.properties()["axes_locator"] else None + if not cbar: + continue + if cbar.cmap.name != col_config["range"]["scheme"]: + cbar = None + continue + break + + if not cbar: + continue + + axis_props = cbar.ax.properties() + if cbar.orientation == "vertical": + gradient_length = cbar.ax.get_position().bounds[-1] * fig.get_figheight() * fig.dpi + label = axis_props["yticklabels"][0].properties() + else: + gradient_length = cbar.ax.get_position().bounds[-2] * fig.get_figwidth() * fig.dpi + label = axis_props["xticklabels"][0].properties() + if col_config["type"] == "linear": + legend_type = "gradient" + spine_outline = cbar.outline.properties() # outline of the colorbar lining + + stroke_color = mcolors.to_hex(spine_outline["facecolor"]) if spine_outline["facecolor"][-1] > 0 else None + legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) + # TODO: do we require padding? it is not obvious to get from matplotlib + legend_object = { + "type": legend_type, + "direction": cbar.orientation, + "orient": "none", # Required in vega in order to use the x and y position + "fill": color_scale_array[0]["name"], + "fillColor": mcolors.to_hex(cbar.ax.get_facecolor()), + "gradientLength": gradient_length, + "gradientOpacity": cbar.cmap._lut[-0][-1], + "gradientThickness": (cbar.ax.get_position().bounds[2] * fig.dpi) / 72, + "gradientStrokeColor": stroke_color, + "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, + "values": list(cbar.ax.get_yticks()), + "labelAlign": label["horizontalalignment"], + "labelColor": mcolors.to_hex(label["color"]), + "labelFont": label["fontname"], + "labelFontSize": (label["fontsize"] * fig.dpi) / 72, + "labelFontStyle": label["fontstyle"], + "labelFontWeight": label["fontweight"], + "legendX": cbar.ax.get_position().bounds[0] * fig.get_figwidth() * fig.dpi, + "legendY": (1 - (cbar.ax.get_position().bounds[1] + cbar.ax.get_position().bounds[-1])) + * fig.get_figheight() + * fig.dpi, + "zindex": axis_props["zorder"], + } + if legend_title_object["title"] != "": + legend_object.update(legend_title_object) + legend_array.append(legend_object) + return legend_array + + def _create_derived_data_block( - ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int + fig, ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int ) -> tuple[dict[str, Any], dict[str, Any], list[dict[str, Any]]]: """Create vega like data object for SpatialData elements. @@ -176,6 +284,7 @@ def _create_derived_data_block( data_object: dict[str, Any] = {} marks_object: dict[str, Any] = {} color_scale_array: list[dict[str, Any]] = [] + legend_array: list[dict[str, Any]] = [] data_object["name"] = params.element + "_" + str(uuid4()) @@ -212,9 +321,9 @@ def _create_derived_data_block( data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) color_scale_array = _create_colorscale_image(params.cmap_params) - + legend_array = _create_colorbar_legend(fig, color_scale_array) marks_object = _create_raster_image_marks_object(ax, call, params, data_object, call_count, color_scale_array) - return data_object, marks_object, color_scale_array + return data_object, marks_object, color_scale_array, legend_array def _create_raster_image_marks_object( @@ -253,7 +362,7 @@ def strip_call(s: str) -> str: def _create_data_configs( - plotting_tree: OrderedDict[str, Params], ax: Axes, cs: str, sdata_path: str + plotting_tree: OrderedDict[str, Params], fig, ax: Axes, cs: str, sdata_path: str ) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: """Create the vega json array value to the data key. @@ -275,6 +384,7 @@ def _create_data_configs( data_array = [] marks_array = [] color_scale_array_full = [] + legend_array_full = [] url = str(Path("sdata.zarr")) if sdata_path: @@ -286,15 +396,16 @@ def _create_data_configs( counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} for call, params in plotting_tree.items(): call = strip_call(call) - data_object, marks_object, color_scale_array = _create_derived_data_block( - ax, call, params, base_block["name"], cs, counters[call] + data_object, marks_object, color_scale_array, legend_array = _create_derived_data_block( + fig, ax, call, params, base_block["name"], cs, counters[call] ) data_array.append(data_object) marks_array.append(marks_object) color_scale_array_full += color_scale_array + legend_array_full += legend_array counters[call] += 1 - return data_array, marks_array, color_scale_array_full + return data_array, marks_array, color_scale_array_full, legend_array_full def _create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: @@ -393,24 +504,32 @@ def _create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: f def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: Any, cs: str) -> dict[str, Any]: fig = fig_params.fig ax = fig_params.ax - data_array, marks_array, color_scale_array = _create_data_configs(sdata.plotting_tree, ax, cs, sdata._path) + data_array, marks_array, color_scale_array, legend_array = _create_data_configs( + sdata.plotting_tree, fig, ax, cs, sdata._path + ) scales_array = _create_axis_scale_block(ax) axis_array = _create_axis_block(ax, scales_array, fig.dpi) + scales = axis_array + color_scale_array if len(color_scale_array) > 0 else axis_array # TODO: check why attrs does not respect ordereddict when writing sdata - return { + viewconfig = { "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", "height": fig.get_figheight() * fig.dpi, # matplotlib uses inches, but vega uses absolute pixels "width": fig.get_figwidth() * fig.dpi, "padding": _create_padding_object(fig), "title": _create_title_config(ax, fig), "data": data_array, - "scales": axis_array + color_scale_array, - "axes": axis_array, - "marks": marks_array, + "scales": scales, } + viewconfig["axes"] = axis_array + if len(legend_array) > 0: + viewconfig["legend"] = legend_array + viewconfig["marks"] = marks_array + + return viewconfig + # def plotting_tree_dict_to_marks(plotting_tree_dict): # out = [] # caller will set { ..., "marks": out } From 73a5778fef1179188a86a43932bd2c6cc226c9db Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Tue, 25 Feb 2025 23:23:47 +0100 Subject: [PATCH 13/56] add table lookup to config --- src/spatialdata_plot/pl/_viewconfig.py | 47 ++++++++++++++++++++------ 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 47591ef0..94f6f95d 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -1,7 +1,6 @@ from __future__ import annotations import re -from collections import OrderedDict from enum import Enum from pathlib import Path from typing import TYPE_CHECKING, Any @@ -11,6 +10,7 @@ import spatialdata from matplotlib.axes import Axes from matplotlib.figure import Figure +from spatialdata.models import get_table_keys from spatialdata_plot.pl.render_params import ( CmapParams, @@ -203,7 +203,7 @@ def _create_colorbar_legend(fig, color_scale_array): for col_config in color_scale_array: cbar = None for ax in axes: - cbar = getattr(ax.properties()["axes_locator"], "_cbar") if ax.properties()["axes_locator"] else None + cbar = getattr(ax.properties()["axes_locator"], "_cbar", None) if ax.properties()["axes_locator"] else None if not cbar: continue if cbar.cmap.name != col_config["range"]["scheme"]: @@ -259,7 +259,7 @@ def _create_colorbar_legend(fig, color_scale_array): def _create_derived_data_block( - fig, ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int + sdata, fig, ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int, table_id=None ) -> tuple[dict[str, Any], dict[str, Any], list[dict[str, Any]]]: """Create vega like data object for SpatialData elements. @@ -322,13 +322,26 @@ def _create_derived_data_block( color_scale_array = _create_colorscale_image(params.cmap_params) legend_array = _create_colorbar_legend(fig, color_scale_array) - marks_object = _create_raster_image_marks_object(ax, call, params, data_object, call_count, color_scale_array) + marks_object = _create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) + if "render_labels" in call and isinstance(params, LabelsRenderParams): + data_object["transform"].append({"type": "filter_scale", "expr": params.scale}) + if table_id: + _, _, instance_key = get_table_keys(sdata[params.table_name]) + data_object["transform"].append( + { + "type": "lookup", + "from": table_id, + "key": instance_key, + "fields": [params.color], + "as": ["id_color_map"], + "default": None, + } + ) return data_object, marks_object, color_scale_array, legend_array def _create_raster_image_marks_object( ax: Axes, - call: str, params: ImageRenderParams, data_object: dict[str, Any], call_count: int, @@ -361,8 +374,17 @@ def strip_call(s: str) -> str: return re.sub(r"^\d+_", "", s) +def _create_table_data_object(table_name, base_uuid): + return { + "name": str(uuid4()), + "format": {"type": "spatialdata_table", "version": 0.1}, + "source": base_uuid, + "transform": [{"type": "filter_element", "expr": table_name}], + } + + def _create_data_configs( - plotting_tree: OrderedDict[str, Params], fig, ax: Axes, cs: str, sdata_path: str + sdata: SpatialData, fig, ax: Axes, cs: str, sdata_path: str ) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: """Create the vega json array value to the data key. @@ -394,11 +416,16 @@ def _create_data_configs( data_array.append(base_block) counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} - for call, params in plotting_tree.items(): + for call, params in sdata.plotting_tree.items(): call = strip_call(call) + table_id = None + if table := getattr(params, "table_name", None): + data_array.append(_create_table_data_object(table, base_block["name"])) + table_id = data_array[-1]["name"] data_object, marks_object, color_scale_array, legend_array = _create_derived_data_block( - fig, ax, call, params, base_block["name"], cs, counters[call] + sdata, fig, ax, call, params, base_block["name"], cs, counters[call], table_id ) + data_array.append(data_object) marks_array.append(marks_object) color_scale_array_full += color_scale_array @@ -504,9 +531,7 @@ def _create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: f def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: Any, cs: str) -> dict[str, Any]: fig = fig_params.fig ax = fig_params.ax - data_array, marks_array, color_scale_array, legend_array = _create_data_configs( - sdata.plotting_tree, fig, ax, cs, sdata._path - ) + data_array, marks_array, color_scale_array, legend_array = _create_data_configs(sdata, fig, ax, cs, sdata._path) scales_array = _create_axis_scale_block(ax) axis_array = _create_axis_block(ax, scales_array, fig.dpi) From b93af879c50e461bdad9b4b9fadc0b1c132a93be Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 14 Mar 2025 10:23:52 +0100 Subject: [PATCH 14/56] new updates --- src/spatialdata_plot/pl/_viewconfig.py | 168 ++++++++++++++++++----- src/spatialdata_plot/pl/basic.py | 1 + src/spatialdata_plot/pl/render.py | 20 +-- src/spatialdata_plot/pl/render_params.py | 1 + src/spatialdata_plot/pl/utils.py | 19 ++- 5 files changed, 162 insertions(+), 47 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 94f6f95d..9435116d 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -131,12 +131,30 @@ def _get_colorbar_orient(ax, cbar): return "overlapping" # Unusual case - -def _create_colorscale_image(cmap_params: CmapParams) -> tuple[list[dict[str, Any]], float]: +def _create_random_colorscale(data_id, field): + return [{ + "name": f"color_{str(uuid4())}", + "type": "ordinal", + "domain": {"data": data_id, "field": field}, + "range": ["random"], # TODO: decide how to better do this to simulate label2rgb + }] + + +def _create_categorical_colorscale(color_mapping) -> list[dict[str, Any]]: + """Create a categorical vega like color scale array.""" + return [{ + "name": f"color_{str(uuid4())}", + "type": "ordinal", + "domain": list(color_mapping.keys()), + "range": list(color_mapping.values()), + }] + + +def _create_colorscale_image(cmap_params: CmapParams, data_id, field) -> tuple[list[dict[str, Any]], float]: cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps # Happens if palette is specified as list of strings color_scale_array: list[dict[str, Any]] = [] - for cmap in cmaps: + for index, cmap in enumerate(cmaps): # TODO: check why listedcolormap is only passed on when we specify channel. if isinstance(cmap, mcolors.ListedColormap): type_scale = "linear" @@ -151,12 +169,14 @@ def _create_colorscale_image(cmap_params: CmapParams) -> tuple[list[dict[str, An pass else: color_range = {"scheme": cmap.name, "count": cmap.N} + if isinstance(field, (int, list)): + field = f"channel_{index}" + if not field: + field = "value" color_scale_object = { "name": f"color_{str(uuid4())}", "type": type_scale, - # The domain in matplotlib seems to be 0-1 always for images, but for example for napari should be - # interpreted as relative - "domain": [0, 1], + "domain": {"data": data_id, "field": field}, "range": color_range, } @@ -197,6 +217,25 @@ def _create_legend_title_config(title_obj, dpi): } +def _create_categorical_legend(fig, color_scale_array): + legend_array: list[dict[str, Any]] = [] + ax = fig.get_axes()[0] + legend = ax.legend() + + for color_object in color_scale_array: + fill_color = legend.get_frame().get_facecolor() + legend_object = { + "type": "discrete", + "direction": "horizontal" if legend._ncols == 0 else "vertical", + "fill": color_object["name"], + "orient": "none", + "columns": legend._ncols, + "columnPadding": + "fillColor": fill_color, + } + + + def _create_colorbar_legend(fig, color_scale_array): legend_array: list[dict[str, Any]] = [] axes = fig.get_axes() @@ -257,6 +296,32 @@ def _create_colorbar_legend(fig, color_scale_array): legend_array.append(legend_object) return legend_array +def _add_norm_transform(params, data_object): + norm = params.cmap_params.norm if not isinstance(params.cmap_params, list) else params.cmap_params[0].norm + if isinstance(vmin := norm.vmin, float) and isinstance(vmax := norm.vmax, float): + + if norm.clip: + formula = f"clamp((datum.value - {vmin}) / ({vmax} - {vmin}), 0, 1)" + else: + formula = f"(datum.value - {vmin}) / ({vmax} - {vmin})" + data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) + return data_object + +def _add_table_lookup(sdata, params, data_object, table_id): + if table_id: + _, _, instance_key = get_table_keys(sdata[params.table_name]) + data_object["transform"].append( + { + "type": "lookup", + "from": table_id, + "key": instance_key, + "fields": ["instance_ids"], + "values": [params.color], + "as": [params.color], + "default": None, + } + ) + return data_object def _create_derived_data_block( sdata, fig, ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int, table_id=None @@ -293,7 +358,6 @@ def _create_derived_data_block( data_object["format"] = {"type": "spatialdata_image", "version": 0.1} elif "render_labels" in call: data_object["format"] = {"type": "spatialdata_label", "version": 0.1} - marks_object = {"a": 5} elif "render_points" in call: data_object["format"] = {"type": "spatialdata_point", "version": 0.1} marks_object = {"a": 5} @@ -311,32 +375,30 @@ def _create_derived_data_block( data_object["transform"].append({"type": "filter_scale", "expr": multiscale}) data_object["transform"].append({"type": "filter_channel", "expr": params.channel}) # Use isinstance because of possible 0 value - norm = params.cmap_params.norm if not isinstance(params.cmap_params, list) else params.cmap_params[0].norm - if isinstance(vmin := norm.vmin, float) and isinstance(vmax := norm.vmax, float): - - if norm.clip: - formula = f"clamp((datum.value - {vmin}) / ({vmax} - {vmin}), 0, 1)" - else: - formula = f"(datum.value - {vmin}) / ({vmax} - {vmin})" - data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) + data_object = _add_norm_transform(params, data_object) - color_scale_array = _create_colorscale_image(params.cmap_params) + color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], params.channel) legend_array = _create_colorbar_legend(fig, color_scale_array) marks_object = _create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) if "render_labels" in call and isinstance(params, LabelsRenderParams): data_object["transform"].append({"type": "filter_scale", "expr": params.scale}) - if table_id: - _, _, instance_key = get_table_keys(sdata[params.table_name]) - data_object["transform"].append( - { - "type": "lookup", - "from": table_id, - "key": instance_key, - "fields": [params.color], - "as": ["id_color_map"], - "default": None, - } - ) + data_object = _add_table_lookup(sdata, params, data_object, table_id) + if data_object["transform"][-1]["type"] == "lookup": + color_field = data_object["transform"][-1]["values"][0] + data_object = _add_norm_transform(params, data_object) + if params.colortype == "continuous": + color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], color_field) + legend_array = _create_colorbar_legend(fig, color_scale_array) + if params.colortype == "categorical": + print("yo") + if isinstance(params.colortype, dict): + color_scale_array = _create_categorical_colorscale(params.colortype) + legend_array = _create_categorical_legend(fig, color_scale_array) + print() + if params.colortype == "random": + color_scale_array = _create_random_colorscale(data_object["name"], "value") + marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) + return data_object, marks_object, color_scale_array, legend_array @@ -346,10 +408,9 @@ def _create_raster_image_marks_object( data_object: dict[str, Any], call_count: int, color_scale_array: list[dict[str, Any]], - # image_alpha : float ) -> dict[str, Any]: if len(color_scale_array) == 1: - fill_color = [{"scale": color_scale_array[0]["name"], "value": "intensity_value"}] + fill_color = [{"scale": color_scale_array[0]["name"], "value": "value"}] else: fill_color = [ {"scale": color_scale["name"], "field": f"channel_{index}"} @@ -368,6 +429,49 @@ def _create_raster_image_marks_object( }, } +def _create_raster_label_marks_object( + ax: Axes, + params: ImageRenderParams, + data_object: dict[str, Any], + call_count: int, + color_scale_array: list[dict[str, Any]], +) -> dict[str, Any]: + + if params.colortype == "continuous": + color_col = color_scale_array[0]["domain"]["field"] + fill_color = [{"scale": color_scale_array[0]["name"], "value": color_col}] + encode_update = { + "fill": [ + { + "test": f"isValid(datum.value)", + "scale": color_scale_array[0]["name"], + "field": color_col + }, + { + "value": params.cmap_params.na_color}]} + if params.colortype == "random" or isinstance(params.colortype, dict): + fill_color = [{"scale": color_scale_array[0]["name"], "value": "value"}] + elif params.colortype.startswith("#"): + fill_color = [{"value": params.colortype}] + + labels_object = { + "type": "raster_label", + "from": {"data": data_object["name"]}, + "zindex": ax.properties()["images"][call_count].zorder, + "encode": { + "enter": { + "stroke": fill_color, + "fill": fill_color, + "fillOpacity": {"value": params.fill_alpha}, + "strokeOpacity": {"value": params.outline_alpha}, + "strokeWidth": {"value": params.contour_px} + } + }, + } + + if params.colortype == "continuous": + labels_object["encode"]["update"] = encode_update + return labels_object def strip_call(s: str) -> str: """Strip leading digit and underscore from call.""" @@ -482,7 +586,7 @@ def _create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: f axis_line_props = ax.spines[axis_config["orient"]].properties() axis_config["domain"] = axis_line_props["visible"] # domain is whether axis line should be visible. axis_config["domainOpacity"] = axis_line_props["alpha"] if axis_line_props["alpha"] else 1 - axis_config["domainColor"] = mcolors.to_hex(axis_line_props["edgecolor"])[:-2] + axis_config["domainColor"] = mcolors.to_hex(axis_line_props["edgecolor"]) axis_config["domainWidth"] = (axis_line_props["linewidth"] * dpi) / 72 axis_config["grid"] = axis_props["tick_params"]["gridOn"] @@ -536,7 +640,7 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: scales_array = _create_axis_scale_block(ax) axis_array = _create_axis_block(ax, scales_array, fig.dpi) - scales = axis_array + color_scale_array if len(color_scale_array) > 0 else axis_array + scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array # TODO: check why attrs does not respect ordereddict when writing sdata viewconfig = { "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 6490ad3e..1351787c 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -1044,6 +1044,7 @@ def show( scalebar_params=scalebar_params, legend_params=legend_params, rasterize=rasterize, + render_count=prefix, ) if title is None: diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 0c4bc08e..500aed9b 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -106,7 +106,7 @@ def _render_shapes( sdata_filt[table_name].obs[col_for_color] = sdata_filt[table_name].obs[col_for_color].astype("category") # get color vector (categorical or continuous) - color_source_vector, color_vector, _ = _set_color_source_vec( + color_source_vector, color_vector, _, color_mapping = _set_color_source_vec( sdata=sdata_filt, element=sdata_filt[element], element_name=element, @@ -887,6 +887,7 @@ def _render_labels( scalebar_params: ScalebarParams, legend_params: LegendParams, rasterize: bool, + render_count: int, ) -> None: element = render_params.element table_name = render_params.table_name @@ -941,7 +942,7 @@ def _render_labels( _, trans_data = _prepare_transformation(label, coordinate_system, ax) - color_source_vector, color_vector, categorical = _set_color_source_vec( + color_source_vector, color_vector, categorical, color_mapping = _set_color_source_vec( sdata=sdata_filt, element=label, element_name=element, @@ -955,7 +956,7 @@ def _render_labels( ) def _draw_labels(seg_erosionpx: int | None, seg_boundaries: bool, alpha: float) -> matplotlib.image.AxesImage: - labels = _map_color_seg( + labels, variable_type = _map_color_seg( seg=label.values, cell_id=instance_id, color_vector=color_vector, @@ -978,7 +979,7 @@ def _draw_labels(seg_erosionpx: int | None, seg_boundaries: bool, alpha: float) ) _cax.set_transform(trans_data) cax = ax.add_image(_cax) - return cax # noqa: RET504 + return cax, variable_type # noqa: RET504 # default case: no contour, just fill # since contour_px is passed to skimage.morphology.erosion to create the contour, @@ -987,12 +988,12 @@ def _draw_labels(seg_erosionpx: int | None, seg_boundaries: bool, alpha: float) if (render_params.fill_alpha > 0.0 and render_params.outline_alpha == 0.0) or ( render_params.fill_alpha == render_params.outline_alpha ): - cax = _draw_labels(seg_erosionpx=None, seg_boundaries=False, alpha=render_params.fill_alpha) + cax, variable_type = _draw_labels(seg_erosionpx=None, seg_boundaries=False, alpha=render_params.fill_alpha) alpha_to_decorate_ax = render_params.fill_alpha # outline-only case elif render_params.fill_alpha == 0.0 and render_params.outline_alpha > 0.0: - cax = _draw_labels( + cax, variable_type = _draw_labels( seg_erosionpx=render_params.contour_px, seg_boundaries=True, alpha=render_params.outline_alpha ) alpha_to_decorate_ax = render_params.outline_alpha @@ -1000,10 +1001,10 @@ def _draw_labels(seg_erosionpx: int | None, seg_boundaries: bool, alpha: float) # pretty case: both outline and infill elif render_params.fill_alpha > 0.0 and render_params.outline_alpha > 0.0: # first plot the infill ... - cax_infill = _draw_labels(seg_erosionpx=None, seg_boundaries=False, alpha=render_params.fill_alpha) + cax_infill, _ = _draw_labels(seg_erosionpx=None, seg_boundaries=False, alpha=render_params.fill_alpha) # ... then overlay the contour - cax_contour = _draw_labels( + cax_contour, variable_type = _draw_labels( seg_erosionpx=render_params.contour_px, seg_boundaries=True, alpha=render_params.outline_alpha ) @@ -1013,7 +1014,8 @@ def _draw_labels(seg_erosionpx: int | None, seg_boundaries: bool, alpha: float) else: raise ValueError("Parameters 'fill_alpha' and 'outline_alpha' cannot both be 0.") - + variable_type = color_mapping if variable_type == "categorical" else variable_type + sdata.plotting_tree[f"{render_count}_render_labels"].colortype = variable_type _ = _decorate_axs( ax=ax, cax=cax, diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index 79858cd9..dda7addc 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -144,3 +144,4 @@ class LabelsRenderParams: table_name: str | None = None table_layer: str | None = None zorder: int = 0 + colortype: str | None = None diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index 03941dd8..15af881b 100644 --- a/src/spatialdata_plot/pl/utils.py +++ b/src/spatialdata_plot/pl/utils.py @@ -715,9 +715,10 @@ def _set_color_source_vec( table_name: str | None = None, table_layer: str | None = None, ) -> tuple[ArrayLike | pd.Series | None, ArrayLike, bool]: + color_mapping = None if value_to_plot is None and element is not None: color = np.full(len(element), na_color) - return color, color, False + return color, color, False, color_mapping # Figure out where to get the color from origins = _locate_value(value_key=value_to_plot, sdata=sdata, element_name=element_name, table_name=table_name) @@ -750,7 +751,7 @@ def _set_color_source_vec( "Ignoring categorical palette which is given for a continuous variable. " "Consider using `cmap` to pass a ColorMap." ) - return None, color_source_vector, False + return None, color_source_vector, False, color_mapping color_source_vector = pd.Categorical(color_source_vector) # convert, e.g., `pd.Series` @@ -770,11 +771,11 @@ def _set_color_source_vec( # do not rename categories, as colors need not be unique color_vector = color_source_vector.map(color_mapping) - return color_source_vector, color_vector, True + return color_source_vector, color_vector, True, color_mapping logger.warning(f"Color key '{value_to_plot}' for element '{element_name}' not been found, using default colors.") color = np.full(sdata[table_name].n_obs, to_hex(na_color)) - return color, color, False + return color, color, False, color_mapping def _map_color_seg( @@ -790,18 +791,22 @@ def _map_color_seg( ) -> ArrayLike: cell_id = np.array(cell_id) + variable_type = None if pd.api.types.is_categorical_dtype(color_vector.dtype): # Case A: users wants to plot a categorical column if np.any(color_source_vector.isna()): cell_id[color_source_vector.isna()] = 0 val_im: ArrayLike = map_array(seg.copy(), cell_id, color_vector.codes + 1) cols = colors.to_rgba_array(color_vector.categories) + variable_type = "categorical" elif pd.api.types.is_numeric_dtype(color_vector.dtype): # Case B: user wants to plot a continous column if isinstance(color_vector, pd.Series): color_vector = color_vector.to_numpy() cols = cmap_params.cmap(cmap_params.norm(color_vector)) + # TODO: ask why this mapping is even required if we map from 2 that are the same val_im = map_array(seg.copy(), cell_id, cell_id) + variable_type = "continuous" else: # Case C: User didn't specify any colors if color_source_vector is not None and ( @@ -813,6 +818,7 @@ def _map_color_seg( val_im = map_array(seg.copy(), cell_id, cell_id) RNG = default_rng(42) cols = RNG.random((len(color_vector), 3)) + variable_type = "random" else: # Case D: User didn't specify a column to color by, but modified the na_color val_im = map_array(seg.copy(), cell_id, cell_id) @@ -820,6 +826,7 @@ def _map_color_seg( # we have hex colors assert all(_is_color_like(c) for c in color_vector), "Not all values are color-like." cols = colors.to_rgba_array(color_vector) + variable_type = color_vector[0][:-2] else: cols = cmap_params.cmap(cmap_params.norm(color_vector)) @@ -838,11 +845,11 @@ def _map_color_seg( if seg.shape[0] == 1: seg = np.squeeze(seg, axis=0) seg_bound: ArrayLike = np.clip(seg_im - find_boundaries(seg)[:, :, None], 0, 1) - return np.dstack((seg_bound, np.where(val_im > 0, 1, 0))) # add transparency here + return np.dstack((seg_bound, np.where(val_im > 0, 1, 0))), variable_type # add transparency here if len(val_im.shape) != len(seg_im.shape): val_im = np.expand_dims((val_im > 0).astype(int), axis=-1) - return np.dstack((seg_im, val_im)) + return np.dstack((seg_im, val_im)), variable_type def _generate_base_categorial_color_mapping( From e4cfd04df56cc996d98802aa23b72789cd381d97 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 16 Mar 2025 00:24:51 +0100 Subject: [PATCH 15/56] finish initial label configs --- src/spatialdata_plot/pl/_viewconfig.py | 315 ++++++++++++++++++------- src/spatialdata_plot/pl/render.py | 2 +- src/spatialdata_plot/pl/utils.py | 2 +- tests/pl/test_render_labels.py | 3 - 4 files changed, 228 insertions(+), 94 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 9435116d..f22c2a8a 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -24,6 +24,7 @@ Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams if TYPE_CHECKING: + from matplotlib.text import Text from spatialdata import SpatialData @@ -101,56 +102,75 @@ def _create_padding_object(fig: Figure) -> dict[str, float]: } -def _get_colorbar_orient(ax, cbar): +def _create_random_colorscale(data_id: str, field: str) -> list[dict[str, Any]]: + """Create a vega like colorscale for random colors. + + This scale is used in case there is a label image for which the labels are visualized by random colors. + + Parameters + ---------- + data_id : str + The ID of the derived data object that pertains to a spatialdata label element. + field : str + The value of the derived datablock to which the color scale gets applied. Typically `value`. + + Returns + ------- + The array containing the vega like random color scale object. """ - Determine the Vega legend orientation based on the position of a Matplotlib colorbar relative to the main plot. + return [ + { + "name": f"color_{str(uuid4())}", + "type": "ordinal", + "domain": {"data": data_id, "field": field}, + "range": ["random"], # TODO: decide how to better do this to simulate label2rgb + } + ] + + +def _create_categorical_colorscale(color_mapping: dict[str, str]) -> list[dict[str, Any]]: + """Create a categorical vega like color scale array. Parameters ---------- - ax: matplotlib.axes.Axes - The main plot axes containing the actual plotted data. - cbar : Colorbar - The matplotlib colorbar object. + color_mapping : dict[str, str] + The mapping of categorical values to colors as hex string. Returns ------- - str - Vega `legend.orient` value ('top', 'bottom', 'left', 'right', or 'overlapping'). + The array containing the vega like ordinal color scale object. + """ + return [ + { + "name": f"color_{str(uuid4())}", + "type": "ordinal", + "domain": list(color_mapping.keys()), + "range": list(color_mapping.values()), + } + ] + + +def _create_colorscale_image( + cmap_params: list[CmapParams] | CmapParams, data_id: str, field: list[str] | list[int] | int | str | None +) -> list[dict[str, Any]]: + """Create a vega like color scale array to be applied to an image. + + This in particular creates a color scale array based on the colormaps that are part of the ImageRenderParams. + + Parameters + ---------- + cmap_params : CmapParams + The colormap parameters used to plot the spatialdata image element. + data_id: str + The ID of the derived data object that pertains to a spatialdata image element. + field: + The value of the derived datablock to which the color scale is applied. In case of an image + can be a channel or list of channels or the index thereof. + + Returns + ------- + The array containing the vega like color scale array. """ - main_bbox = ax.get_position() # Main plot bounding box - cbar_bbox = cbar.ax.get_position() # Colorbar bounding box - - if cbar_bbox.y1 <= main_bbox.y0: - return "bottom" # Colorbar is below - if cbar_bbox.y0 >= main_bbox.y1: - return "top" # Colorbar is above - if cbar_bbox.x1 <= main_bbox.x0: - return "left" # Colorbar is to the left - if cbar_bbox.x0 >= main_bbox.x1: - return "right" # Colorbar is to the right - - return "overlapping" # Unusual case - -def _create_random_colorscale(data_id, field): - return [{ - "name": f"color_{str(uuid4())}", - "type": "ordinal", - "domain": {"data": data_id, "field": field}, - "range": ["random"], # TODO: decide how to better do this to simulate label2rgb - }] - - -def _create_categorical_colorscale(color_mapping) -> list[dict[str, Any]]: - """Create a categorical vega like color scale array.""" - return [{ - "name": f"color_{str(uuid4())}", - "type": "ordinal", - "domain": list(color_mapping.keys()), - "range": list(color_mapping.values()), - }] - - -def _create_colorscale_image(cmap_params: CmapParams, data_id, field) -> tuple[list[dict[str, Any]], float]: cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps # Happens if palette is specified as list of strings color_scale_array: list[dict[str, Any]] = [] @@ -169,7 +189,7 @@ def _create_colorscale_image(cmap_params: CmapParams, data_id, field) -> tuple[l pass else: color_range = {"scheme": cmap.name, "count": cmap.N} - if isinstance(field, (int, list)): + if isinstance(field, int | list): field = f"channel_{index}" if not field: field = "value" @@ -202,7 +222,23 @@ def _create_base_level_sdata_block(url: str) -> dict[str, Any]: } -def _create_legend_title_config(title_obj, dpi): +def _create_legend_title_config(title_obj: Text, dpi: float) -> dict[str, Any]: + """Create the vega like legend title object. + + This creates the object containing information pertaining to the legend title. This will be added to the legend + object. + + Parameters + ---------- + title_obj : Text + The legend title object in matplotlib. + dpi: float + dots per inch used to convert fontsizes to from standard unit to size in pixels. + + Returns + ------- + The legend title object. + """ title_props = title_obj.properties() return { "title": title_props["text"], @@ -217,10 +253,25 @@ def _create_legend_title_config(title_obj, dpi): } -def _create_categorical_legend(fig, color_scale_array): +def _create_categorical_legend(fig: Figure, color_scale_array: list[dict[str, Any]]) -> list[dict[str, Any]]: + """Create vega like categorical legend array. + + Parameters + ---------- + fig : Figure + The matplotlib figure. + color_scale_array : list[dict[str, Any]] + The vega like color scale array for which the vega like legend array will be created. + + Returns + ------- + The vega like categorical legend array. + """ legend_array: list[dict[str, Any]] = [] ax = fig.get_axes()[0] legend = ax.legend() + legend_bbox_props = legend.get_frame().properties() + legend_bbox = legend.get_tightbbox() for color_object in color_scale_array: fill_color = legend.get_frame().get_facecolor() @@ -230,28 +281,59 @@ def _create_categorical_legend(fig, color_scale_array): "fill": color_object["name"], "orient": "none", "columns": legend._ncols, - "columnPadding": - "fillColor": fill_color, - } + "columnPadding": (legend.columnspacing * fig.dpi) / 72, + "rowPadding": (legend.labelspacing * fig.dpi) / 72, + "fillColor": mcolors.to_hex(fill_color), + "padding": (legend.borderpad * fig.dpi) / 72, + "strokeColor": mcolors.to_hex(legend_bbox_props["edgecolor"]), + "strokeWidth": (legend_bbox_props["linewidth"] * fig.dpi) + / 72, # Different from Vega as vega expects a vega scale here! + "labelAlign": legend.get_texts()[0].get_ha(), + "labelColor": mcolors.to_hex(legend.get_texts()[0].get_color()), + "labelFont": legend.get_texts()[0].get_fontname(), + "labelFontSize": (legend.get_texts()[0].get_fontsize() * fig.dpi) / 72, + "labelFontStyle": legend.get_texts()[0].get_fontstyle(), + "labelFontWeight": legend.get_texts()[0].get_fontweight(), + "labelOffset": (legend.handletextpad * fig.dpi) / 72, + "legendX": legend_bbox.bounds[0], + "legendY": fig.bbox.height - legend_bbox.bounds[1] - legend_bbox.bounds[3], + } + + if legend.get_title().get_text() != "": + legend_title_object = _create_legend_title_config(legend.get_title(), fig.dpi) + legend_object.update(legend_title_object) + + legend_array.append(legend_object) + return legend_array +def _create_colorbar_legend( + fig: Figure, color_scale_array: list[dict[str, Any]], legend_count: int +) -> list[dict[str, Any]]: + """Create the vega like legend array containing the colorbar information. -def _create_colorbar_legend(fig, color_scale_array): + Parameters + ---------- + fig : Figure + The matplotlib figure. + color_scale_array : list[dict[str, Any]] + The vega like color scale array for which the vega like legend array will be created. + legend_count : int + The number of already created legend objects. + + Returns + ------- + The vega like colorbar legend array. + """ legend_array: list[dict[str, Any]] = [] - axes = fig.get_axes() + cbars = [] + for ax in fig.axes: + cbar = getattr(ax.properties()["axes_locator"], "_cbar", None) if ax.properties()["axes_locator"] else None + if cbar: + cbars.append(cbar) + for col_config in color_scale_array: - cbar = None - for ax in axes: - cbar = getattr(ax.properties()["axes_locator"], "_cbar", None) if ax.properties()["axes_locator"] else None - if not cbar: - continue - if cbar.cmap.name != col_config["range"]["scheme"]: - cbar = None - continue - break - - if not cbar: - continue + cbar = cbars[legend_count] axis_props = cbar.ax.properties() if cbar.orientation == "vertical": @@ -285,10 +367,8 @@ def _create_colorbar_legend(fig, color_scale_array): "labelFontSize": (label["fontsize"] * fig.dpi) / 72, "labelFontStyle": label["fontstyle"], "labelFontWeight": label["fontweight"], - "legendX": cbar.ax.get_position().bounds[0] * fig.get_figwidth() * fig.dpi, - "legendY": (1 - (cbar.ax.get_position().bounds[1] + cbar.ax.get_position().bounds[-1])) - * fig.get_figheight() - * fig.dpi, + "legendX": cbar.ax.get_tightbbox().bounds[0], + "legendY": fig.bbox.height - cbar.ax.get_tightbbox().bounds[1] - cbar.ax.get_tightbbox().bounds[3], "zindex": axis_props["zorder"], } if legend_title_object["title"] != "": @@ -296,7 +376,22 @@ def _create_colorbar_legend(fig, color_scale_array): legend_array.append(legend_object) return legend_array -def _add_norm_transform(params, data_object): + +def _add_norm_transform(params: Params, data_object: dict[str, Any]) -> dict[str, Any]: + """Add a normalization transform to a vega like derived data object. + + Parameters + ---------- + params : Params + The render parameters used to plot the particular spatialdata element. + data_object: dict[str, Any] + The vega like derived data object. + + Returns + ------- + The vega like derived data object with an added normalization transform if normalization was defined + in the render parameters. + """ norm = params.cmap_params.norm if not isinstance(params.cmap_params, list) else params.cmap_params[0].norm if isinstance(vmin := norm.vmin, float) and isinstance(vmax := norm.vmax, float): @@ -307,8 +402,28 @@ def _add_norm_transform(params, data_object): data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) return data_object -def _add_table_lookup(sdata, params, data_object, table_id): - if table_id: + +def _add_table_lookup( + sdata: SpatialData, params: Params, data_object: dict[str, Any], table_id: str | None +) -> dict[str, Any]: + """Add a lookup transform to a vega like derived data object. + + Parameters + ---------- + sdata : SpatialData + The spatialdata object containing the table. + params: params + The render parameters used to plot the particular spatialdata element. + data_object: dict[str, Any] + The vega like derived data object. + table_id: str + The ID of the vega data object pertaining to the spatialdata table. + + Returns + ------- + The vega like derived data object with the added lookup transform. + """ + if table_id and not isinstance(params, ImageRenderParams): _, _, instance_key = get_table_keys(sdata[params.table_name]) data_object["transform"].append( { @@ -323,9 +438,19 @@ def _add_table_lookup(sdata, params, data_object, table_id): ) return data_object + def _create_derived_data_block( - sdata, fig, ax: Axes, call: str, params: Params, base_uuid: str, cs: str, call_count: int, table_id=None -) -> tuple[dict[str, Any], dict[str, Any], list[dict[str, Any]]]: + sdata: SpatialData, + fig: Figure, + ax: Axes, + call: str, + params: Params, + base_uuid: str, + cs: str, + call_count: int, + table_id: str | None = None, + legend_count: int = 0, +) -> tuple[dict[str, Any], dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]: """Create vega like data object for SpatialData elements. Each object for a SpatialData element contains an additional transform that @@ -378,7 +503,7 @@ def _create_derived_data_block( data_object = _add_norm_transform(params, data_object) color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], params.channel) - legend_array = _create_colorbar_legend(fig, color_scale_array) + legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) marks_object = _create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) if "render_labels" in call and isinstance(params, LabelsRenderParams): data_object["transform"].append({"type": "filter_scale", "expr": params.scale}) @@ -388,13 +513,12 @@ def _create_derived_data_block( data_object = _add_norm_transform(params, data_object) if params.colortype == "continuous": color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], color_field) - legend_array = _create_colorbar_legend(fig, color_scale_array) + legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) if params.colortype == "categorical": - print("yo") + pass if isinstance(params.colortype, dict): color_scale_array = _create_categorical_colorscale(params.colortype) legend_array = _create_categorical_legend(fig, color_scale_array) - print() if params.colortype == "random": color_scale_array = _create_random_colorscale(data_object["name"], "value") marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) @@ -429,9 +553,10 @@ def _create_raster_image_marks_object( }, } + def _create_raster_label_marks_object( ax: Axes, - params: ImageRenderParams, + params: LabelsRenderParams, data_object: dict[str, Any], call_count: int, color_scale_array: list[dict[str, Any]], @@ -442,13 +567,10 @@ def _create_raster_label_marks_object( fill_color = [{"scale": color_scale_array[0]["name"], "value": color_col}] encode_update = { "fill": [ - { - "test": f"isValid(datum.value)", - "scale": color_scale_array[0]["name"], - "field": color_col - }, - { - "value": params.cmap_params.na_color}]} + {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": color_col}, + {"value": params.cmap_params.na_color}, + ] + } if params.colortype == "random" or isinstance(params.colortype, dict): fill_color = [{"scale": color_scale_array[0]["name"], "value": "value"}] elif params.colortype.startswith("#"): @@ -464,7 +586,7 @@ def _create_raster_label_marks_object( "fill": fill_color, "fillOpacity": {"value": params.fill_alpha}, "strokeOpacity": {"value": params.outline_alpha}, - "strokeWidth": {"value": params.contour_px} + "strokeWidth": {"value": params.contour_px}, } }, } @@ -473,12 +595,27 @@ def _create_raster_label_marks_object( labels_object["encode"]["update"] = encode_update return labels_object + def strip_call(s: str) -> str: """Strip leading digit and underscore from call.""" return re.sub(r"^\d+_", "", s) -def _create_table_data_object(table_name, base_uuid): +def _create_table_data_object(table_name: str, base_uuid: str) -> dict[str, Any]: + """Create the vega like data object for a spatialdata table. + + Parameters + ---------- + table_name : str + Name of the table in the SpatialData object. + base_uuid : str + The ID of the vega like data object pertaining to the SpatialData zarr store containing + the table to be added. + + Returns + ------- + The vega like data object for the SpatialData table. + """ return { "name": str(uuid4()), "format": {"type": "spatialdata_table", "version": 0.1}, @@ -488,7 +625,7 @@ def _create_table_data_object(table_name, base_uuid): def _create_data_configs( - sdata: SpatialData, fig, ax: Axes, cs: str, sdata_path: str + sdata: SpatialData, fig: Figure, ax: Axes, cs: str, sdata_path: str ) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: """Create the vega json array value to the data key. @@ -527,7 +664,7 @@ def _create_data_configs( data_array.append(_create_table_data_object(table, base_block["name"])) table_id = data_array[-1]["name"] data_object, marks_object, color_scale_array, legend_array = _create_derived_data_block( - sdata, fig, ax, call, params, base_block["name"], cs, counters[call], table_id + sdata, fig, ax, call, params, base_block["name"], cs, counters[call], table_id, len(color_scale_array_full) ) data_array.append(data_object) @@ -644,8 +781,8 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: # TODO: check why attrs does not respect ordereddict when writing sdata viewconfig = { "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": fig.get_figheight() * fig.dpi, # matplotlib uses inches, but vega uses absolute pixels - "width": fig.get_figwidth() * fig.dpi, + "height": fig.bbox.height, # matplotlib uses inches, but vega uses absolute pixels + "width": fig.bbox.width, "padding": _create_padding_object(fig), "title": _create_title_config(ax, fig), "data": data_array, diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 500aed9b..fb2361d8 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -509,7 +509,7 @@ def _render_points( # when user specified a single color, we emulate the form of `na_color` and use it default_color = color if col_for_color is None and color is not None else render_params.cmap_params.na_color - color_source_vector, color_vector, _ = _set_color_source_vec( + color_source_vector, color_vector, _, _ = _set_color_source_vec( sdata=sdata_filt, element=points, element_name=element, diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index 15af881b..ba72b3aa 100644 --- a/src/spatialdata_plot/pl/utils.py +++ b/src/spatialdata_plot/pl/utils.py @@ -714,7 +714,7 @@ def _set_color_source_vec( cmap_params: CmapParams | None = None, table_name: str | None = None, table_layer: str | None = None, -) -> tuple[ArrayLike | pd.Series | None, ArrayLike, bool]: +) -> tuple[ArrayLike | pd.Series | None, ArrayLike, bool, dict[str, str] | None]: color_mapping = None if value_to_plot is None and element is not None: color = np.full(len(element), na_color) diff --git a/tests/pl/test_render_labels.py b/tests/pl/test_render_labels.py index c1217841..c4ed8141 100644 --- a/tests/pl/test_render_labels.py +++ b/tests/pl/test_render_labels.py @@ -117,9 +117,6 @@ def _make_tablemodel_with_categorical_labels(sdata_blobs, label): _, axs = plt.subplots(nrows=1, ncols=3, layout="tight") - sdata_blobs.pl.render_labels(label, color="channel_1_sum", table="other_table", scale="scale0").pl.show( - ax=axs[0], title="ch_1_sum", colorbar=False - ) sdata_blobs.pl.render_labels(label, color="channel_1_sum", table="other_table", scale="scale0").pl.show( ax=axs[0], title="ch_1_sum", colorbar=False ) From ef646550c5b74858410edc6fcfb28d4e53b92cbf Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 21 Mar 2025 13:24:08 +0100 Subject: [PATCH 16/56] point view configs --- src/spatialdata_plot/pl/_viewconfig.py | 77 +++++++++++++++++++++++- src/spatialdata_plot/pl/basic.py | 1 + src/spatialdata_plot/pl/render.py | 7 ++- src/spatialdata_plot/pl/render_params.py | 1 + 4 files changed, 83 insertions(+), 3 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index f22c2a8a..74864511 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -150,6 +150,25 @@ def _create_categorical_colorscale(color_mapping: dict[str, str]) -> list[dict[s ] +def _create_colorscale_points( + cmap_params: list[CmapParams] | CmapParams, color_mapping: None | dict[str, str], params, data_id: str +) -> list[dict[str, Any]]: + cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] + cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps # Happens if palette is specified as list of strings + color_scale_array: list[dict[str, Any]] = [] + + if color_mapping and params.table_name is None: + color_scale_object = { + "name": f"color_{str(uuid4())}", + "type": "ordinal", + "domain": list(color_mapping.keys()), + "range": [mcolors.to_hex(col) for col in color_mapping.values()], + } + + color_scale_array.append(color_scale_object) + return color_scale_array + + def _create_colorscale_image( cmap_params: list[CmapParams] | CmapParams, data_id: str, field: list[str] | list[int] | int | str | None ) -> list[dict[str, Any]]: @@ -485,7 +504,6 @@ def _create_derived_data_block( data_object["format"] = {"type": "spatialdata_label", "version": 0.1} elif "render_points" in call: data_object["format"] = {"type": "spatialdata_point", "version": 0.1} - marks_object = {"a": 5} elif "render_shapes" in call: data_object["format"] = {"type": "spatialdata_shape", "version": 0.1} marks_object = {"a": 5} @@ -522,6 +540,14 @@ def _create_derived_data_block( if params.colortype == "random": color_scale_array = _create_random_colorscale(data_object["name"], "value") marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) + if "render_points" in call and isinstance(params, PointsRenderParams): + data_object = _add_table_lookup(sdata, params, data_object, table_id) + color_scale_array = None + if params.colortype: + color_scale_array = _create_colorscale_points( + params.cmap_params, params.colortype, params, data_object["name"] + ) + marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) return data_object, marks_object, color_scale_array, legend_array @@ -554,6 +580,52 @@ def _create_raster_image_marks_object( } +def strip_alpha(hex_color: str) -> str: + if isinstance(hex_color, str) and hex_color.startswith("#") and len(hex_color) == 9: + return hex_color[:7] + return hex_color + + +def _create_points_symbol_marks_object( + ax: Axes, + params: LabelsRenderParams, + data_object: dict[str, Any], + call_count: int, + color_scale_array: list[dict[str, Any]] | None, +): + encode_update = None + if not color_scale_array: + fill_color = {"value": strip_alpha(params.cmap_params.na_color)} + elif params.color: + fill_color = {"value": mcolors.to_hex(params.color)} + else: + encode_update = { + "fill": [ + {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": params.col_for_color}, + {"value": strip_alpha(params.cmap_params.na_color)}, + ] + } + fill_color = {"scale": color_scale_array[0]["name"], "field": params.col_for_color} + points_object = { + "type": "symbol", + "from": {"data": data_object["name"]}, + "zindex": params.zorder, + "encode": { + "enter": { + "stroke": fill_color, + "fill": fill_color, + "fillOpacity": {"value": params.alpha}, + "size": {"value": params.size}, + } + }, + } + if encode_update: + # TODO: check if we can give info that na-color is used prior to adding this. If so then add if conditional. + points_object["encode"]["update"] = encode_update + + return points_object + + def _create_raster_label_marks_object( ax: Axes, params: LabelsRenderParams, @@ -669,7 +741,8 @@ def _create_data_configs( data_array.append(data_object) marks_array.append(marks_object) - color_scale_array_full += color_scale_array + if color_scale_array: + color_scale_array_full += color_scale_array legend_array_full += legend_array counters[call] += 1 diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 1351787c..15bf03ba 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -1011,6 +1011,7 @@ def show( fig_params=fig_params, scalebar_params=scalebar_params, legend_params=legend_params, + render_count=prefix, ) elif cmd == "render_labels" and has_labels: diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index fb2361d8..2f8804f7 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -395,6 +395,7 @@ def _render_points( fig_params: FigParams, scalebar_params: ScalebarParams, legend_params: LegendParams, + render_count: int, ) -> None: element = render_params.element col_for_color = render_params.col_for_color @@ -509,7 +510,7 @@ def _render_points( # when user specified a single color, we emulate the form of `na_color` and use it default_color = color if col_for_color is None and color is not None else render_params.cmap_params.na_color - color_source_vector, color_vector, _, _ = _set_color_source_vec( + color_source_vector, color_vector, _, color_mapping = _set_color_source_vec( sdata=sdata_filt, element=points, element_name=element, @@ -679,6 +680,8 @@ def _render_points( zorder=render_params.zorder, ) cax = ax.add_collection(_cax) + + sdata.plotting_tree[f"{render_count}_render_points"].colortype = color_mapping if update_parameters: # necessary if points are plotted with mpl first and then with datashader extent = get_extent(sdata_filt.points[element], coordinate_system=coordinate_system) @@ -691,6 +694,8 @@ def _render_points( else: palette = ListedColormap(dict.fromkeys(color_vector[~pd.Categorical(color_source_vector).isnull()])) + sdata.plotting_tree[f"{render_count}_render_points"].colortype = color_mapping + _ = _decorate_axs( ax=ax, cax=cax, diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index dda7addc..ea574579 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -101,6 +101,7 @@ class PointsRenderParams: element: str color: str | None = None col_for_color: str | None = None + colortype: str | None = None groups: str | list[str] | None = None palette: ListedColormap | list[str] | None = None alpha: float = 1.0 From be65d582e548fe22da0145c40fd9558b980477bb Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 23 Mar 2025 14:46:52 +0100 Subject: [PATCH 17/56] output plots as well --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 28de53f6..688379f2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -448,7 +448,6 @@ def save_and_compare(self, *args, **kwargs): VIEWCONFIG_ACTUAL.mkdir(parents=True, exist_ok=True) with open(VIEWCONFIG_ACTUAL / f"{fig_name}.json", "w") as outfile: json.dump(viewconfig, outfile, indent=4) - return # uncomment to catch tests that do not save the viewconfig # raise ValueError("No viewconfig saved for the test") From 2033b24336bb6c2f8521ddb01135aa6ec87d7b5f Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Wed, 26 Mar 2025 15:00:55 +0100 Subject: [PATCH 18/56] complete points viewconfigs --- src/spatialdata_plot/pl/_viewconfig.py | 202 +++++++++++++---------- src/spatialdata_plot/pl/render.py | 19 ++- src/spatialdata_plot/pl/render_params.py | 1 + 3 files changed, 132 insertions(+), 90 deletions(-) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 74864511..b4f4c8e9 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -151,19 +151,33 @@ def _create_categorical_colorscale(color_mapping: dict[str, str]) -> list[dict[s def _create_colorscale_points( - cmap_params: list[CmapParams] | CmapParams, color_mapping: None | dict[str, str], params, data_id: str + cmap_params: list[CmapParams] | CmapParams, color_mapping: None | dict[str, str], params, data_object: str ) -> list[dict[str, Any]]: cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps # Happens if palette is specified as list of strings color_scale_array: list[dict[str, Any]] = [] - if color_mapping and params.table_name is None: - color_scale_object = { - "name": f"color_{str(uuid4())}", - "type": "ordinal", - "domain": list(color_mapping.keys()), - "range": [mcolors.to_hex(col) for col in color_mapping.values()], - } + color_scale_object = {"name": f"color_{str(uuid4())}"} + if isinstance(color_mapping, dict): + color_scale_object.update( + { + "type": "ordinal", + "domain": list(color_mapping.keys()), + "range": [mcolors.to_hex(col) for col in color_mapping.values()], + } + ) + elif color_mapping == "continuous": + data_id = data_object["name"] + field = data_object["transform"][-1].get("as") + if not field: + field = [params.col_for_color] + color_scale_object.update( + { + "type": "linear", + "domain": {"data": data_id, "field": field}, + "range": {"scheme": params.cmap_params.cmap.name, "count": params.cmap_params.cmap.N}, + } + ) color_scale_array.append(color_scale_object) return color_scale_array @@ -374,8 +388,8 @@ def _create_colorbar_legend( "orient": "none", # Required in vega in order to use the x and y position "fill": color_scale_array[0]["name"], "fillColor": mcolors.to_hex(cbar.ax.get_facecolor()), - "gradientLength": gradient_length, - "gradientOpacity": cbar.cmap._lut[-0][-1], + "gradientLength": gradient_length, # alpha if alpha := getattr(cbar.cmap, "_lut", None)[0][-1] else + "gradientOpacity": cbar.mappable.get_alpha(), "gradientThickness": (cbar.ax.get_position().bounds[2] * fig.dpi) / 72, "gradientStrokeColor": stroke_color, "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, @@ -412,12 +426,13 @@ def _add_norm_transform(params: Params, data_object: dict[str, Any]) -> dict[str in the render parameters. """ norm = params.cmap_params.norm if not isinstance(params.cmap_params, list) else params.cmap_params[0].norm + field = data_object["transform"][-1]["as"][0] if data_object["transform"][-1]["type"] == "aggregate" else "value" if isinstance(vmin := norm.vmin, float) and isinstance(vmax := norm.vmax, float): if norm.clip: - formula = f"clamp((datum.value - {vmin}) / ({vmax} - {vmin}), 0, 1)" + formula = f"clamp((datum.{field} - {vmin}) / ({vmax} - {vmin}), 0, 1)" else: - formula = f"(datum.value - {vmin}) / ({vmax} - {vmin})" + formula = f"(datum.{field} - {vmin}) / ({vmax} - {vmin})" data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) return data_object @@ -444,20 +459,48 @@ def _add_table_lookup( """ if table_id and not isinstance(params, ImageRenderParams): _, _, instance_key = get_table_keys(sdata[params.table_name]) + color = params.color if params.color else params.col_for_color data_object["transform"].append( { "type": "lookup", "from": table_id, "key": instance_key, "fields": ["instance_ids"], - "values": [params.color], - "as": [params.color], + "values": [color], + "as": [color], "default": None, } ) return data_object +def _add_datashade_transform_points(params, data_object): + if params.ds_reduction == "std": + params.ds_reduction = "stdev" + if params.ds_reduction == "var": + params.ds_reduction = "variance" + + if data_object["transform"][-1]["type"] == "formula": + field = data_object["transform"][-1]["as"] + as_field = field + elif params.col_for_color: + field = params.col_for_color + as_field = field + else: + field = "*" + as_field = "count" + data_object["transform"].append( + {"type": "aggregate", "field": [field], "ops": [params.ds_reduction], "as": [as_field]} + ) + data_object = _add_norm_transform(params, data_object) + if data_object["transform"][-1]["type"] == "formula": + field = data_object["transform"][-1]["as"] + data_object["transform"].append( + {"type": "spread", "field": [as_field], "px": params.ds_pixel_spread, "as": [as_field]} + ) + return data_object + + def _create_derived_data_block( sdata: SpatialData, fig: Figure, @@ -542,11 +585,17 @@ def _create_derived_data_block( marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) if "render_points" in call and isinstance(params, PointsRenderParams): data_object = _add_table_lookup(sdata, params, data_object, table_id) + if not params.ds_reduction: + data_object = _add_norm_transform(params, data_object) + if params.ds_reduction: + data_object = _add_datashade_transform_points(params, data_object) color_scale_array = None if params.colortype: - color_scale_array = _create_colorscale_points( - params.cmap_params, params.colortype, params, data_object["name"] - ) + color_scale_array = _create_colorscale_points(params.cmap_params, params.colortype, params, data_object) + if params.colortype == "continuous": + legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) + if isinstance(params.colortype, dict): + legend_array = _create_categorical_legend(fig, color_scale_array) marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) return data_object, marks_object, color_scale_array, legend_array @@ -594,28 +643,65 @@ def _create_points_symbol_marks_object( color_scale_array: list[dict[str, Any]] | None, ): encode_update = None - if not color_scale_array: - fill_color = {"value": strip_alpha(params.cmap_params.na_color)} - elif params.color: - fill_color = {"value": mcolors.to_hex(params.color)} - else: - encode_update = { - "fill": [ - {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": params.col_for_color}, - {"value": strip_alpha(params.cmap_params.na_color)}, - ] - } - fill_color = {"scale": color_scale_array[0]["name"], "field": params.col_for_color} + if not color_scale_array and not params.color: + fill_color = {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} + elif not color_scale_array and params.color: + fill_color = {"value": mcolors.to_hex(params.color, keep_alpha=False)} + elif color_scale_array and (params.color or params.col_for_color): + if isinstance(params.colortype, dict): + encode_update = { + "fill": [ + { + "test": f"!isValid(datum.{params.col_for_color})", + "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), + } + ] + } + fill_color = {"scale": color_scale_array[0]["name"], "field": params.col_for_color} + else: + value = val[0] if isinstance(val := color_scale_array[0]["domain"]["field"], list) else val + fill_color = {"scale": color_scale_array[0]["name"], "value": value} + encode_update = {"fill": []} + encode_update["fill"].append( + { + "test": f"!isValid(datum.{params.col_for_color})", + "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), + } + ) + if (params.cmap_params.norm.vmin is not None or params.cmap_params.norm.vmax is not None) and ( + params.cmap_params.cmap.get_under() is not None or params.cmap_params.cmap.get_over() is not None + ): + # or condition doesn't reach second condition if first condition is met + under_col = params.cmap_params.cmap.get_under() + over_col = params.cmap_params.cmap.get_over() + if under_col is not None: + encode_update["fill"].append( + { + "test": f"datum.{value}) < {params.cmap_params.norm.vmin}", + "value": mcolors.to_hex(under_col, keep_alpha=False), + } + ) + if over_col is not None: + encode_update["fill"].append( + { + "test": f"datum.{value}) > {params.cmap_params.norm.vmax}", + "value": mcolors.to_hex(over_col, keep_alpha=False), + } + ) + points_object = { "type": "symbol", "from": {"data": data_object["name"]}, "zindex": params.zorder, "encode": { "enter": { + "x": {"scale": "X_scale", "field": "x"}, + "y": {"scale": "Y_scale", "field": "y"}, "stroke": fill_color, "fill": fill_color, "fillOpacity": {"value": params.alpha}, "size": {"value": params.size}, + "shape": {"value": "circle"}, } }, } @@ -868,61 +954,3 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: viewconfig["marks"] = marks_array return viewconfig - - -# def plotting_tree_dict_to_marks(plotting_tree_dict): -# out = [] # caller will set { ..., "marks": out } -# for pl_call_id, pl_call_params in plotting_tree_dict.items(): -# if pl_call_id.endswith("_render_images"): -# for channel_index in pl_call_params["channel"]: -# out.append({ -# "type": "raster_image", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": { "value": pl_call_params.get("alpha") }, -# "color": {"scale": get_scale_name(pl_call_params), "field": channel_index } -# } -# }) -# if pl_call_id.endswith("_render_shapes"): -# out.append({ -# "type": "shape", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, -# "fillColor": get_shapes_color_encoding(pl_call_params), -# "strokeWidth": {"value": pl_call_params.get("outline_width")}, -# # TODO: check whether this is the key used in the spatial plotting tree # TODO: what are the units? -# "strokeColor": {"value": pl_call_params.get("outline_color")}, -# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, -# } -# }) -# if pl_call_id.endswith("_render_points"): -# out.append({ -# "type": "point", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": {"value": pl_call_params.get("alpha")}, -# "color": get_shapes_color_encoding(pl_call_params), -# "size": {"value": pl_call_params.get("size")}, -# } -# }) -# if pl_call_id.endswith("_render_labels"): -# out.append({ -# "type": "raster_labels", -# "from": {"data": sdata_element_to_uuid(pl_call_params["element"])}, -# "zindex": pl_call_params["zorder"], -# "encode": { -# "opacity": {"value": pl_call_params.get("alpha")}, -# "fillColor": get_shapes_color_encoding(pl_call_params), -# "strokeColor": get_shapes_color_encoding(pl_call_params), -# "strokeWidth": {"value": pl_call_params.get("contour_px")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# "strokeOpacity": {"value": pl_call_params.get("outline_alpha")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# "fillOpacity": {"value": pl_call_params.get("fill_alpha")}, -# # TODO: check whether this is the key used in the spatial plotting tree -# } -# }) diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index b6384904..9fbc8fbb 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -552,9 +552,11 @@ def _render_points( ) if method == "datashader": + sdata.plotting_tree[f"{render_count}_render_points"].method = "datashader" # NOTE: s in matplotlib is in units of points**2 # use dpi/100 as a factor for cases where dpi!=100 px = int(np.round(np.sqrt(render_params.size) * (fig_params.fig.dpi / 100))) + sdata.plotting_tree[f"{render_count}_render_points"].ds_pixel_spread = px # apply transformations transformed_element = PointsModel.parse( @@ -577,11 +579,16 @@ def _render_points( if color_by_categorical and transformed_element[col_for_color].values.dtype == object: transformed_element[col_for_color] = transformed_element[col_for_color].astype("category") aggregate_with_reduction = None + # TODO: ask Sonja whether length of list is supposed to be checked here. if col_for_color is not None and (render_params.groups is None or len(render_params.groups) > 1): if color_by_categorical: agg = cvs.points(transformed_element, "x", "y", agg=ds.by(col_for_color, ds.count())) + sdata.plotting_tree[f"{render_count}_render_points"].ds_reduction = "count" else: reduction_name = render_params.ds_reduction if render_params.ds_reduction is not None else "sum" + + sdata.plotting_tree[f"{render_count}_render_points"].ds_reduction = reduction_name + sdata.plotting_tree[f"{render_count}_render_points"].colortype = "continuous" logger.info( f'Using the datashader reduction "{reduction_name}". "max" will give an output very close ' "to the matplotlib result." @@ -593,6 +600,7 @@ def _render_points( aggregate_with_reduction = (agg.min(), agg.max()) else: agg = cvs.points(transformed_element, "x", "y", agg=ds.count()) + sdata.plotting_tree[f"{render_count}_render_points"].ds_reduction = "count" ds_span = None if norm.vmin is not None or norm.vmax is not None: @@ -673,11 +681,14 @@ def _render_points( vmin = norm.vmin - 0.5 vmax = norm.vmin + 0.5 cax = ScalarMappable( - norm=matplotlib.colors.Normalize(vmin=vmin, vmax=vmax), + norm=matplotlib.colors.Normalize(vmin=vmin, vmax=vmax, clip=norm.clip), cmap=render_params.cmap_params.cmap, ) + sdata.plotting_tree[f"{render_count}_render_points"].cmap_params.cmap = cax.cmap + sdata.plotting_tree[f"{render_count}_render_points"].cmap_params.norm = cax.norm elif method == "matplotlib": + sdata.plotting_tree[f"{render_count}_render_points"].method = "matplotlib" # update axis limits if plot was empty before (necessary if datashader comes after) update_parameters = not _mpl_ax_contains_elements(ax) _cax = ax.scatter( @@ -694,7 +705,7 @@ def _render_points( ) cax = ax.add_collection(_cax) - sdata.plotting_tree[f"{render_count}_render_points"].colortype = color_mapping + # sdata.plotting_tree[f"{render_count}_render_points"].colortype = color_mapping if update_parameters: # necessary if points are plotted with mpl first and then with datashader extent = get_extent(sdata_filt.points[element], coordinate_system=coordinate_system) @@ -704,10 +715,12 @@ def _render_points( if len(set(color_vector)) != 1 or list(set(color_vector))[0] != to_hex(render_params.cmap_params.na_color): if color_source_vector is None: palette = ListedColormap(dict.fromkeys(color_vector)) + sdata.plotting_tree[f"{render_count}_render_points"].colortype = "continuous" else: palette = ListedColormap(dict.fromkeys(color_vector[~pd.Categorical(color_source_vector).isnull()])) - sdata.plotting_tree[f"{render_count}_render_points"].colortype = color_mapping + if not sdata.plotting_tree[f"{render_count}_render_points"].colortype: + sdata.plotting_tree[f"{render_count}_render_points"].colortype = color_mapping _ = _decorate_axs( ax=ax, diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index ea574579..366308be 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -112,6 +112,7 @@ class PointsRenderParams: table_name: str | None = None table_layer: str | None = None ds_reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None = None + ds_pixel_spread: float | None = None @dataclass From 63c6d78e538dc977d172618e875d68e762643bf8 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Thu, 27 Mar 2025 16:03:42 +0100 Subject: [PATCH 19/56] initial completion shape configs --- src/spatialdata_plot/pl/_viewconfig.py | 110 +++++++++++++++++- src/spatialdata_plot/pl/basic.py | 1 + src/spatialdata_plot/pl/render.py | 16 ++- src/spatialdata_plot/pl/render_params.py | 2 + src/spatialdata_plot/pl/utils.py | 52 --------- ...der_circles_with_default_outline_width.png | Bin 24954 -> 0 bytes tests/pl/test_render_shapes.py | 3 - 7 files changed, 122 insertions(+), 62 deletions(-) delete mode 100644 tests/_images/Shapes_can_render_circles_with_default_outline_width.png diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index b4f4c8e9..1c2029b3 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -474,7 +474,7 @@ def _add_table_lookup( return data_object -def _add_datashade_transform_points(params, data_object): +def _add_datashade_transform(params, data_object): if params.ds_reduction == "std": params.ds_reduction = "stdev" if params.ds_reduction == "var": @@ -495,9 +495,12 @@ def _add_datashade_transform_points(params, data_object): data_object = _add_norm_transform(params, data_object) if data_object["transform"][-1]["type"] == "formula": field = data_object["transform"][-1]["as"] - data_object["transform"].append( - {"type": "spread", "field": [as_field], "px": params.ds_pixel_spread, "as": [as_field]} - ) + if isinstance(params, PointsRenderParams): + data_object["transform"].append( + {"type": "spread", "field": [as_field], "px": params.ds_pixel_spread, "as": [as_field]} + ) + else: + pass return data_object @@ -588,7 +591,7 @@ def _create_derived_data_block( if not params.ds_reduction: data_object = _add_norm_transform(params, data_object) if params.ds_reduction: - data_object = _add_datashade_transform_points(params, data_object) + data_object = _add_datashade_transform(params, data_object) color_scale_array = None if params.colortype: color_scale_array = _create_colorscale_points(params.cmap_params, params.colortype, params, data_object) @@ -597,6 +600,22 @@ def _create_derived_data_block( if isinstance(params.colortype, dict): legend_array = _create_categorical_legend(fig, color_scale_array) marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) + if "render_shapes" in call and isinstance(params, ShapesRenderParams): + data_object = _add_table_lookup(sdata, params, data_object, table_id) + if not params.ds_reduction: + data_object = _add_norm_transform(params, data_object) + if params.ds_reduction: + data_object = _add_datashade_transform(params, data_object) + + color_scale_array = None + if params.colortype: + color_scale_array = _create_colorscale_points(params.cmap_params, params.colortype, params, data_object) + if params.colortype == "continuous": + legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) + if isinstance(params.colortype, dict): + legend_array = _create_categorical_legend(fig, color_scale_array) + + marks_object = _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array) return data_object, marks_object, color_scale_array, legend_array @@ -635,9 +654,88 @@ def strip_alpha(hex_color: str) -> str: return hex_color +def _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array): + encode_update = None + if not color_scale_array and not params.color: + fill_color = {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} + elif not color_scale_array and params.color: + fill_color = {"value": mcolors.to_hex(params.color, keep_alpha=False)} + elif color_scale_array and (params.color or params.col_for_color): + if isinstance(params.colortype, dict): + encode_update = { + "fill": [ + { + "test": f"!isValid(datum.{params.col_for_color})", + "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), + } + ] + } + fill_color = {"scale": color_scale_array[0]["name"], "field": params.col_for_color} + else: + value = val[0] if isinstance(val := color_scale_array[0]["domain"]["field"], list) else val + fill_color = {"scale": color_scale_array[0]["name"], "value": value} + encode_update = {"fill": []} + encode_update["fill"].append( + { + "test": f"!isValid(datum.{params.col_for_color})", + "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), + } + ) + if (params.cmap_params.norm.vmin is not None or params.cmap_params.norm.vmax is not None) and ( + params.cmap_params.cmap.get_under() is not None or params.cmap_params.cmap.get_over() is not None + ): + # or condition doesn't reach second condition if first condition is met + under_col = params.cmap_params.cmap.get_under() + over_col = params.cmap_params.cmap.get_over() + if under_col is not None: + encode_update["fill"].append( + { + "test": f"datum.{value}) < {params.cmap_params.norm.vmin}", + "value": mcolors.to_hex(under_col, keep_alpha=False), + } + ) + if over_col is not None: + encode_update["fill"].append( + { + "test": f"datum.{value}) > {params.cmap_params.norm.vmax}", + "value": mcolors.to_hex(over_col, keep_alpha=False), + } + ) + + shapes_object = { + "type": "path", + "from": {"data": data_object["name"]}, + "zindex": params.zorder, + "encode": { + "enter": { + "x": {"scale": "X_scale", "field": "x"}, + "y": {"scale": "Y_scale", "field": "y"}, + "scaleX": params.scale, + "scaleY": params.scale, + "fill": fill_color, + "fillOpacity": {"value": params.fill_alpha}, + } + }, + } + + if params.outline_params.outline and params.outline_alpha != 0: + outline_par = params.outline_params + stroke_color = {"value": mcolors.to_hex(outline_par.outline_color, keep_alpha=False)} + + shapes_object["encode"]["enter"].update( + { + "stroke": stroke_color, + "strokeWidth": {"value": outline_par.linewidth}, + "strokeOpacity": {"value": params.outline_alpha}, + } + ) + + return shapes_object + + def _create_points_symbol_marks_object( ax: Axes, - params: LabelsRenderParams, + params: PointsRenderParams | ShapesRenderParams, data_object: dict[str, Any], call_count: int, color_scale_array: list[dict[str, Any]] | None, diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 8802ea3e..728a16f6 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -994,6 +994,7 @@ def show( fig_params=fig_params, scalebar_params=scalebar_params, legend_params=legend_params, + render_count=prefix, ) elif cmd == "render_points" and has_points: diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 9fbc8fbb..9883dccd 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -67,6 +67,7 @@ def _render_shapes( fig_params: FigParams, scalebar_params: ScalebarParams, legend_params: LegendParams, + render_count: int, ) -> None: element = render_params.element col_for_color = render_params.col_for_color @@ -209,8 +210,11 @@ def _render_shapes( if col_for_color is not None and (render_params.groups is None or len(render_params.groups) > 1): if color_by_categorical: agg = cvs.polygons(transformed_element, geometry="geometry", agg=ds.by(col_for_color, ds.count())) + sdata.plotting_tree[f"{render_count}_render_shapes"].ds_reduction = "count" else: reduction_name = render_params.ds_reduction if render_params.ds_reduction is not None else "mean" + sdata.plotting_tree[f"{render_count}_render_shapes"].ds_reduction = reduction_name + logger.info( f'Using the datashader reduction "{reduction_name}". "max" will give an output very close ' "to the matplotlib result." @@ -222,6 +226,7 @@ def _render_shapes( aggregate_with_reduction = (agg.min(), agg.max()) else: agg = cvs.polygons(transformed_element, geometry="geometry", agg=ds.count()) + sdata.plotting_tree[f"{render_count}_render_shapes"].ds_reduction = "count" # render outlines if needed if (render_outlines := render_params.outline_alpha) > 0: agg_outlines = cvs.line( @@ -329,10 +334,13 @@ def _render_shapes( # under values in case clip=True or clip=False with cmap(under)=cmap(0) & cmap(over)=cmap(1) vmin = norm.vmin - 0.5 vmax = norm.vmin + 0.5 + cax = ScalarMappable( - norm=matplotlib.colors.Normalize(vmin=vmin, vmax=vmax), + norm=matplotlib.colors.Normalize(vmin=vmin, vmax=vmax, clip=norm.clip), cmap=render_params.cmap_params.cmap, ) + sdata.plotting_tree[f"{render_count}_render_shapes"].cmap_params.cmap = cax.cmap + sdata.plotting_tree[f"{render_count}_render_shapes"].cmap_params.norm = cax.norm elif method == "matplotlib": _cax = _get_collection_shape( @@ -357,6 +365,7 @@ def _render_shapes( if not values_are_categorical: # If the user passed a Normalize object with vmin/vmax we'll use those, # if not we'll use the min/max of the color_vector + sdata.plotting_tree[f"{render_count}_render_shapes"].colortype = "continuous" _cax.set_clim( vmin=render_params.cmap_params.norm.vmin or min(color_vector), vmax=render_params.cmap_params.norm.vmax or max(color_vector), @@ -367,6 +376,11 @@ def _render_shapes( if color_source_vector is not None and render_params.col_for_color is not None: color_source_vector = color_source_vector.remove_unused_categories() + if not sdata.plotting_tree[f"{render_count}_render_shapes"].colortype and color_mapping: + key_diff = set(color_mapping.keys()).difference(color_source_vector) + color_mapping = {k: v for k, v in color_mapping.items() if k not in key_diff} + sdata.plotting_tree[f"{render_count}_render_shapes"].colortype = color_mapping + # False if user specified color-like with 'color' parameter colorbar = False if render_params.col_for_color is None else legend_params.colorbar diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index 366308be..b23a6ea1 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -79,6 +79,7 @@ class ShapesRenderParams: element: str color: str | None = None col_for_color: str | None = None + colortype: str | None = None groups: str | list[str] | None = None contour_px: int | None = None palette: ListedColormap | list[str] | None = None @@ -91,6 +92,7 @@ class ShapesRenderParams: table_name: str | None = None table_layer: str | None = None ds_reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None = None + ds_pixel_spread: float | None = None @dataclass diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index 6d856c25..4606a2f1 100644 --- a/src/spatialdata_plot/pl/utils.py +++ b/src/spatialdata_plot/pl/utils.py @@ -23,7 +23,6 @@ import pandas as pd import shapely import spatialdata as sd -import xarray as xr from anndata import AnnData from cycler import Cycler, cycler from datashader.core import Canvas @@ -586,57 +585,6 @@ def _get_subplots(num_images: int, ncols: int = 4, width: int = 4, height: int = return fig, axes -def _normalize( - img: xr.DataArray, - pmin: float | None = None, - pmax: float | None = None, - eps: float = 1e-20, - clip: bool = False, - name: str = "normed", -) -> xr.DataArray: - """Perform a min max normalisation on the xr.DataArray. - - This function was adapted from the csbdeep package. - - Parameters - ---------- - dataarray - A xarray DataArray with an image field. - pmin - Lower quantile (min value) used to perform quantile normalization. - pmax - Upper quantile (max value) used to perform quantile normalization. - eps - Epsilon float added to prevent 0 division. - clip - Ensures that normed image array contains no values greater than 1. - - Returns - ------- - xr.DataArray - A min-max normalized image. - """ - pmin = pmin or 0.0 - pmax = pmax or 100.0 - - perc = np.percentile(img, [pmin, pmax]) - - # Ensure perc is an array of two elements - if np.isscalar(perc): - logger.warning( - "Percentile range is too small, using the same percentile for both min " - "and max. Consider using a larger percentile range." - ) - perc = np.array([perc, perc]) - - norm = (img - perc[0]) / (perc[1] - perc[0] + eps) # type: ignore - - if clip: - norm = np.clip(norm, 0, 1) - - return norm - - def _get_colors_for_categorical_obs( categories: Sequence[str | int], palette: ListedColormap | str | list[str] | None = None, diff --git a/tests/_images/Shapes_can_render_circles_with_default_outline_width.png b/tests/_images/Shapes_can_render_circles_with_default_outline_width.png deleted file mode 100644 index 2d0b11c6216644d5eb853c91f3464af0f9c888be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24954 zcmZ_02|U)_+bvGfK!YM=D56NBR4Ot?rp!Vr$}Ay6W|2~vr-V?3C=a@$By)o~V@O42 znaZpT;jG>B`@ipd{^y+M^Xb!*;l983-ut?)b*;6o?XRJxu#t|9j*5zEqmrVW78MnB z82$*ZTZ6Cs%o})zzm7Y}>pN-NnLD{$axkM(z2tQDik;IHD`PHaGY3a2JKIA-$Au0E za#=b#U3C-_7Pk4X9}u#0un;~>qxcFhvi_>#Sw||W4Qk{MwYN(U4;9tLK_xjE9oP7u z-(2*y2Uk`mEk0|@OG{@97-&AVd@G?jDqCK>ZS9NXd_PM-#)uSD^iyZ5{#ujxIBY3&j z`EsoruaX|4!r!t@ymWWD*7<61CHt&%?`u|#v{fm5oU!w;#Aj<+b>0pdy&vX}ps&N_jRkbiOZC z%JSpm^#dQGEvCQMQPsvDk4#gIa~S@(8}CEubRO?4J|-rX<2mnOSmIe7ZFF6!{gsV> zXlUi<&#XR+zsLK=$JPDlwpG>E^78WDBELG>EB}uk!npBjpF+C>&IUd z`X(}#?G;R_(oWYYtEl*x?>Ok0=Q8@~r_oNA-m>*Y#l`kluWEFC@9)2rmv@v;Exsx* z3;*Nn>^#yXAt8~jlfKoW;o+Gs=U+e0etl)55-VbMKt$x-=g%?hM{Te6RRsV3EH2Y{ z0lO}5=-?o7{P^+D?d^kw-|Fi(t-k4fJ@83tYR}Nn+}EEWAt8@bQwIvOPREK+YzDi# zrDbJTO^nQ($A4?AfqyTWJ#b7Nl?OYUu3T!NbE7 z5g9rC?O{ZOtgY>slw^HH#chSq9mUQb#>TruMMdXrRg{(8Z3^+V$;rx{tFLyyp?)ao zRrBmZ;S^{3AMNn1w|b>HZmg4kn3TkAXlQuL&u^e`Y4DNva$DsQtB<#ahK4-Lxep!; zH>nJ1daM-b*?vkvVR~-TWOkfI=zMp5f;e_=vrkaa1|~Ycf|H!xpR-LmO1(=H3wN&* zQ)gmG(vK0fVLN#6;N1MYJ>L7iuu*-od>~e9p|V*YFIwKxa_>{tx#{T!sc8gAQ^7Us z+S=N68#dJDWd#RswE6myTTn1)=k>W8c;w#RUfHe^FKWv#IlI@aS+jxlfX~yX{P=YR ze08thv-mWZ3k;?_2phqdc3lt0OBO>I`P3TIwfSUaWk2Vb(F;TcMC?{6nLLQ2JUBPm zhf^zZwOd+pX-2yyYG0*4Bj418ck~E@wF@)D@1JU>u%2)|aONMKo;NpEkMM+qN-o?T zFI{;!+D7Rc9sMxUn(^heJrBO$G*?3Jd!8wRH_eeH;7L`LqNk_l-H?#9voFjYD!1G+ zRv;^(sIG4D^`+HI%O+nugu_71wvy!qYeY~3&YuQ9lY;^ie)7EEZYKJQii(b6kLaHF zcOoA=P#*r6YSs3Plb%J0sr)3vVL9yA-}E5XL@UE^Yt`?da|n7fWo}vc=Wa)$->N;R^+F z`ueOrJw4}NUzPFl$afgH>gf2st}ghWGZ|WGr?>z3@q_*YQ%`JAAh8Rwny}m`y*IH)hQ^TfEW4#Ds&B z)85IcKP6N$8L>pA7$Jvvz%i6lP+(+ad>_uEu#S!{`9h&H4Gm4>E1Pp0Hg2T9CWYmc zqu$Hw@9!^Y@bYdj`_YK|_irPOek-_^f~4sAXR?xYyH#5HHac20H8teNgt2dhk>TNQ zhnt_Q-@MskWqCH*{`pVcPpEl84n#g zByi@RGMu=>+m^EW`}?0?`66=u{P~ze7Mt*&;Dv&F-wIutDMnIf11h_ast%ghvToXO zq6*PoRa5h>t81r=iwla&ZkH1>3<1Z2Id7aVbPg`|_^p*^dx2NU-NrBP#GXBSIK-U= zyKKCTdUKP*_KuAew{>QvAU2?OoIiBJS`MWW2jV=iMH$bYpD zjs%8qieLV5xOGwF;K3xL((6uR9kC?L_Mdyzm}{+9;4)s1=$@$s!)y?S*}P|)*NuhOo3$vJlX_|jlafG-zIu&P-^TwKQW=EcRu7v3w^ z$2yDS?BY;54|p&CSvfz|Tv>VN@#Dvyk-fp&58Vz6W7x{b*fru5^y0;|hml`YWaRsI ze)O>iP1ayhHgFsZ^YNiVYNGoS@1UrpbZM+3Urt{Bl7&Sj4*XD4N~MPs<+be4HRaR@ z>$YcG*x56d^X>cAs6Ra6HabWSIi9U0^K9gL#yw#VABIFnN9zx3tfre5$XvU52b1is zZ)w?-TEE%gz5DhBzQ42ikVSpGrwPZx>}Vy>!m(>3_jJ=n)J~s%?D2c7tgK8UU2C^_ z!$Z}&2S<)97d*I#$LK8&JbtyC%E)`^h=j+lek4;fRDAhotRu<&{ieHi?OL~a^C0qA zk?W+aml1Nx{KWgs*?D<-MkO}Z)`98i=?iwJ(sibK%jvPS_=w!ckH_BGymRaJ?f#{u zQk-H=REdBu*xKIFQI(~I+43l7-%r)o>vxNbv#(vdc8An;at^nPIq~;ZhU%>x>?pVv z_~XYF)cJ?w_O`aRRArTw)%RCtRfwFY7mKC_^bvp`=^U`T4%GY1b-rwn;iVQnv+uXH}Lc9EZ*PV7%z5B*^9>Tg}LhGwr9bGh2mplW5egC0^$Hx~I>JE;M{(*sgI7l24?)P%7+j5+L8nB68QA8F&dB(ore&FDU&Neno3d^|_Beg@ z>hp!)Gc!)fDJfmUQ>}vykEZ*p8Ikk$p3O1ME}c1Y=uqSn^+&5HbRP<@&kZ#nX2+2~ zfpmqs-refa)X~A==;-(*EmBh;s>pLb0ziyc>0M)E7?STrE33UK50jrh?|d&QDVe-k zZd0-QtTCbk`;2;>yd!t%w^}9OQj%8s@+7;Vh6aO-jLb+^LPEkpQPJz8n{w<*=5H%S z?$OM5F#GiELSR(XnYYeQ*Bv}^WT3Oy1Nk`&g$Y1oa&ppbv~u($-$IH)XpDr1D8g(v zAKx8hyMvaETqB>dGNRsvM@7ws`h9C@VcNHEA42aPlFjELw?o)Ioh*YWO6l?g90ULI z+~u2+MR({U>$ioSaI>31dNDCJmi6>3Dwt;A5)#_fom&$Ajsb}mS@5Yrt^g{&a7!~o zLH+ypH#f429=P)PfSAizEh>44hus~JhP@@Zqf1g`88Jodsc*SeuzKrc-7fC z&Ajfx>%v03{;uCb+X6Z|&g*6wl;d>?z}vB72hEx_BmLi}k4^v);u{{m zC4v_VSDqm5a?E@A1Om(iIAvrI_3|w~@7G-GW;6@{x*3eC1-n`iA=?3qDnmF^kkdSu zX4?R1WCu&@&KVep7?-VcpB*VD(5S>qJoj>|F&Yhg#DI)fw|=K(ONQY{As12UBgW9o zn4*kRwWMp`q1z_VJv{9H=+RDmHp1}}#i(JT=Y4DYs(4AS2SD{A7vE6*`Sa(P z$1g$cw9}V*-udB`OU^vZ+rHLeq-F1eqjn)#S^K%UxdFFXil_r_?9+R80E?QLnK`$- zI6mKfbMvzOxhQ3MXJ=8D@y>w;sTG|DCXSsuDJ6|>(W}_m*?D?-4S&tuXZGQK>!)W- zcX^dEFBIOl@2dz850{}B7PE>wXJ&fQtvJ(-mg0bmcr7@Mb(N}P$v+od+lN^6i+^s( z*eBf?TtQcbxJ9e*k$t@Vr4{3&>kE4k8ND6(j=X#J>{8l_9oev56zj=f>;mA4hFpDkfU}x zYV6B-5ttlc^9E3HVDID_EK(Zs{787~`1_9^BhUrBz{w_U?2|{=mGKtT)YLi@!vxYh zbaZscDldK?DyK(lov0CM^>FXcaEg~NIvzsg;C0ieef^e14oZq3^gXn zojN6gliu6cH{Tzr4q*A({bEYmg(BDR`}@yL{h4>fU$-d~imsua?QWI(B<>E|b;f6% z%j+E+vjgLxAt0QP=X|p|k z+aka#3$Bf#MOuSz`z;%IZ)0JpTicG1kN9H$9|hRtoGg@pySweqD^GvG+l zwb4(fV-CphbOmW^Y2hQU9v&VRJezat_C|K*1#2c+G);o%Ux)2ceem3>dC&Lygncf& zN$VQhSBaQZY{<#UK~u@}4t|AU-BLKj#z&(MOGor z$jr=)tjESwEhT&l{n;iYoFp7Kzh52l;n~>-k$96YxBhcFK`aVk{()1e(cb;6GzuPR zGx4OY?RN3wDc&o~NU}L3sFs!|L&bHdQ|NFNr0q$_t}3s!f80uqG|gxC?&g&9*utUM%wr@f}&cM=7&AFC@bty_voW zN2aQ-E>-=Jq=UlVk3qq~!+3GDJMqWtWvwa5liIq^&MN`Lq4DoQpm;s0REa1<5l~W5 z`CF6*R^4iw9q)P+DzzMg1#Zx7n@>`G@%PJ$A6VX+yY<>i$xS~vFwmK0GxMjyO^?XY5e%~rz{ zJz8GiqOvkM_n9HhOa)f!z?2l8y11i!d-mLxTAn+ZLHU*_vl^JL40w0AC7lr`WwD|1 zgvYO-#6+$uHa7E9AB1zma)vVWvv-+P1oa>{p|4aNJLVhGl(A}RYCwgmc)MBVMx>-w z-BsZ{2HrohR@3u?j~r)5&Y;jOJ8sHCu!hCQ*W%lI&-`=GS(bSM<1ciofzI5pln7iqnc`9mZ<~Zd# znfj#VwnTon0Ad96biu2x3ayR9i>=T_r4&-&fL5Lc=mv(sCi?e%!v2s2`eirK-k+zGtHoc&WbQ!!#kpc zaHMKgV~hX4m;3VN3o9F&R_^69`6*1|NYbkebF0R#pp9avny!^v)>P@C#m_V|_AL&8`ubeYTCxGsc695wPH|X=p%(#k&e`FIrxJ1e zewvAnmT}K%=?LCUJ0)vLL`Dl;pflU6@6`s*LQqgpKlgG}%+v)2S~-3Wv`C5(W%wZ> z>kzc;jrooi0PM$IC%8!6r;>1=2|J=^f62;9>CPt3*RGSh^q!p$7Z2e&R4l;NJHlR< zuA9Xsom6*kQSwv}>kW`P;J!>j&5|NGHSpmBXU1oe&8a+o{Rltq&vg{Pwq}icZlS?I ze?Ltk7vocb9}>BAo?D%SYPCLN-E>@@rlxqOXu ztw$QQTVMJnj$>SoTV>STr_%)_`NwB&oRmTE&ucV{ zg!T{d;RG4~x$}K56J4;d{i4w2PnrH18T;^wn$pjg-vD$1=LuX^gGUVqTO=dizvJ|r z9*zzgi2o2Z10mX(NMe8lubqasDyM289#6|rZ=s8Nwo&MVxZX}q&i!^_#z<4a$c-qd z10lPr;k-&qNy#esupk&gx>a+g>Vq$A)TciC(sB#3ouK}6A0(6}ur+CF z2{mYFTHDdLtT8e&I&tCz%9QEcL{HF8sfXM4>Gpd(>+Zg|M=ky?_y7Q6&zU9#l*-A3 z63u|=t_M*^eKc4?rE#jCBH^KNj}%wV)=HLJk4E#F`NY#iFSgOi4)nSub}5KH1+b;6 zaTUI_^jEK5y$Iw1Vv!VXgbcnrh~=t{Ik?)}+Z$B^B&6}LA78*AJpf0$it;QoAA5Jm zyw>%}`fqYlcfa%Q-re)#M`ok~*Te|FDcIo0Po8M!m@4J>G11fctwJ5O-%i=l{CP`N zoTOq=QIU^cg6-L}XE`K2V^D?%*!$Z+fN5!Kw_2ZjgkFPB{b3^-;uU(Ei_-Y_-GBi1 zC$oHI>=zuT%zLic+lL>ojypp!y-c2-HIwIs}l(w@#@8^R~2ZyL77l}{P^*};lpL%XStMuP;i5aii(g? ziJ(ioY?6*ZU|osj%?kP|G#-}VtC5>Qx0+a4t^d=tr3{$Wu-!0KOS8bqYStMt>z1Q*?@*4i&!3O`rE>0-bMVW+rtPKl%q4V`LHW&99kEgMfbmjEc6BMoLPm{-MMN z5F2M-Urj1F5cA-H$h8rjJ?amE5X`_%Z94brN)O5_s_gfyX}tewRn_B;-!}jw0aP+A zNRFleFor>XKqL=@Og)0Y6BC}uuml;2$`g6%Z!*hXl>=s#iUcw;`_wlVKqcS>tHwlX zNCT%Io`?mn3e_P-%3JcrjT`f?R(b=4spfvQ+bJn3zCnten79gjxu_NkffJw~lxkDD z_7mUn_(bL{Td0fJ`2QKz5r}$i{FI@*y!?`-r6Ov4KS{_Y-m2J6uMB`pYXzvF%Z`P@ zC3CVD6zOXIrK?Espi|_os;c5TaUy=R)Socm*`nq|H5+Y#DDdDzPEx9xq~VT>WB>mB z`}pjM*x1R74jEL<2f!tx^Oy+;@0o#A?m`{edVo;0TDGdk-rg z_Dj)K&wchg;m)@@d@pQYeu&^UM;3Y6UVO8CKk7Z4(tQpK|eHQ3=ZJRub z1DJr4*67mG2ws0gEzaAiD^~=wv$Mgl|14fJ4|s9M)y=JEU_c%vA{|6({qM?cEbeEd zsaCC8^%)&EP8ms^4wZXzri4tNzkK=lv#&=|VfVF{rDn19~=~li7aI_!cXpmNZgn zKg8r2NF<8q!?@@aduj@u3eh30ysks%bhglWKfCCaDwlFyBwEXsr(3|~jyuU&UcRi1 z1oc!awZ{54`0Sv$Iae@AC!L%Q#~rmZ2QLv57uSrcg@u@ynenVFW?Bx!1Ncx%7Kjv{ zeYsTt#M^F{_+5Nxm#|ltE?=&Jgfb8^t&1+4=B~EBA2+@O?5>?d_M{6x;D{RyH=Ope`Ua34wq34nWE)CidX&-F2c@KEFXD zN;-M)4*0ZdO-%Y^8xlij%;n#eUT#j?*xA|nqqBH1VUG!up?^?Ne_q%16uYhx`S0u0 z+AQdWlz}vm`jSB^&)Z6Yp#Zg?q8cX(L5UCtU>x3KRVRP{u54{RW9?;z^pygw1YFH? zuSI7xI~A!a(X7X=a_#h**@E^YMZYtNVaSYHlb@+J?x^~bs)4Hqm~p$(C1z`D>)RW) z?{bOHW5)3Z5$mocpVSS6y1|D+5uW(RM*P}{T*|3n!joW&_`pq}`Zqq+LybQvQ0oI5j$7=P$CXtwPnW+HK^d9@eL!d*(fzN zJ1x|6AX^zzQ{JV;--BQY(6~i_(JU6_doi`a z5yk%6HM8zFHykS6tV>sx2}Tzy)K$`SKy?A$B(;Gstst04Qv_0kR7Bvb{*bvx%F#k~ z;H18wS48eH#>oSlo3XZ>&Q6^|uL#{!zrbm4b#=Apblp*h$|fr;GI$KC0}ya_wXTmn z8XUsvx4ew7K{v`xSROz~@E}1p?XNVUVC1J1zkn8;?LK=M=d~Ou+^VZY0_~63p$peF z6WeHMF5$H z5zB#2;%u?|5pc|exfQ!Ma`$)5xyHp+t0jIWmVApTm~@MCA7Ur z2}H6gU0%p=XUd)Ey1ugHLNp$CcQI7;0r(Pxe@&mh26Ta7yabT|?9Jz5kGzg>r~CX| z-jiP}9&KS@cms-P4yCxu+BYv*NJ4@WxD|3@tfZG1HY-B>qj(`Wq|!fA^jQ1y&d!HO zhbFeRYEWj>8aOid*>;uGVK?1C@}lRYY~&EE2mJmFcfoGudx>b{f3)YRk12{NF@=?$ zg_noWr$92N<3v@30~HM?iL8#GOu{2OCRHmZrX}qPULQ#tq@e_9$dyeyUJY~2D z`NFe21?kX1;bQ@)Hyo$qvv&yy#7s1*G`79x9EE&xrytaKX!B$y37 zUS|5{djK}%kO86&f%|b8>j)Q*P=h|c@$~7_a{w2u3cGkt1vLhS%z~$BF7@^%Axx|o zM=sy%2&el|xzoEJ!3dgGq-)3#$ex&}5L(S?s*F!^mQSIrP)qpd`sSB5?Yd)%ImjVw zK)HNJj%-6u1GR0B3vU89U6s^i?4Od)3?a-`B31n=G*klmdXJ{`~w1#QQG9kB5YKr ze*H4XnLA(Xz71du`rbguV@5gZc^0g1ra^81xW=%U7{$`-OD&Am+gMO?J%4|5L5stN z&qO>eXx#@wW)1Q2Y5|^OjyvuFP_*kX|M*x5SnD=CIz1xw(i#zar$jbB~!*q49B`)>uF$COj@+9q4y0-utOb z!fQ8ia0v(mfKW|u`)5uVY7SW3n^3oa0@9-OzMKd3jzXf9p}T+K_qZ^20I?%Mw6ScH z%9&+{tM+smJ}91Vz`L!dr+<&84jcuXa+DV-xqW?oB+AjBux{VpROn&{YW2cXzmxUa z`e-oIRHB8zFF64Ex)>gV1b$&=sA)AjJ3G#2q4$X++UmvsQ7<~D!nWx78>!RnLhi}yNw<#QN0Rj4utK$#=%gj`N^x2FH2{X~td z9kfZ*iVfI*Ebk%v-ZEqR7HY~bM*vXlXEv(Xsw}b3sVXe5?7Hf4WLXbeGJvCMlGggh z2w?<0F+S^^PL@y?P?0jwpn!nE*lUa(%h{s93&Oa#y0W8Y3DX%Jupr%ifO`sV?$Rixq|+LJ*pBg+-FwVnhol!R4B z9YiE1IX1g6nX^m5iUgFA-c<^w&u^+o{!8IYigIc)A_3;atJB|A(XO=o9{#Z9E2rAjFQW9M5n(2)1QZw1;9S2(eHpngmiwghe0q?6gwjd+J4uOBT=A0 zScYX%{Dv>I{|5i-xja9JtVbZ6u2&&HS9#DYI>m=z0$$mEt3etjc}pOQ&h^L<-?+HA z1%g<|XOj4owjxBiB_$uC!+<{V+W99NL_(T39UbvFsvmRAR1ETLvsyPh*|3ClU0>XY zWCad@xN~-TPRJxlxcs+T2d`f!EN#POVqN3y6%o8!(1!k*pC-->IGu<_q_5Us$T0r3 zB!ZWmS~zY#;6Nz>$Wv)b2XNvYN|iz6gTq1>atBz)5gY0G8^W=%on0uJ5bOzfX7qVr z^RaCNp+HO9yLT@Lo`JaQ@6lg@=|V%~2R|keEJcqiqIVr%7CqOOGo}y zdrSeL(aRpN?KlPspL>+5@V8YTw&fs*S+WVh93+}>UeKuKhiNlkptb5k#w6V=5C-cZ z^9|@%vUx11=L?Z68QIxYuww`*9Fz%oP+?~SG2_u^f+}$n4Ix^p^94@+c!!?8zW1mO z^aC$dFE#2?=evyWIC*;m_wL<(sLaIE6kO7YT_?c9`_JTB_;ko?S}8rqlCj4vt{SbP}!u$xK&f*JXtis&vSEA zu__Qb7IGJ{2w-w#({+q5Ui5*;kLoe6yUO#|kL|=&xoej%5cHu-?`Vo+oqJJlHgJmR zcm-%Qm#(`Sa za7TaxF zYx(u%UWDO5pl}Hn56{W8vagO%^`V2fPW7(`7yu(DY2fh_zfAxHtP7T)8PKgCf+K+s z>jjjNHQ>tb7Hzi~&QK_11c8ZN6TprUb_hFrPdQaLfKpOr{h{cH<%}ORdLnWI&d$La z@cjAnH{ZS`ln1g5o;yc69DZV^>vWQ@LP?yQnIXn&9KLM$_f+MDw`OK#p^YPcERGYd zVR-zAurMybhcI4$Nr0)7k2Mn85Xm}I}Dr04Wl`HQEh6IMgBt9lC6mmh!x&;0MeP!w$Otn z6_#F9CYM~2S0JPVMh9b;nqUN#J$bS4wy&;ykwwEZF%qZ&cL8zT5UZKE zc&UpFObY$zEYSz~q1HK!bsV47^g@%ne%(3(*jJ7P6Iyb(BmWR|7^Z2%;uE;>GT)mw&%z9c zI*;o80unx{(%@2W=q>TLX6QY^(S~gXGB>gAB9XwE%>;irDjJ&Gp84rPq~LHc$H>R1 zA36;dqHyDMw>Eho#wT&2P~q&3=pVL|V7FiRXQCBWM+EBCp+@ff6w6>;$~&>^e~y9I zoqzVHs=mJB?b{m&2W?noNk0b@Me9yx^dP%nQby}A=pl6U=+W+0-W$n2MZF^LWLurx^(FmJMnBx_Lhqs@l%um zS$qD%1yCC04Go)Jk9cc!#yo;ia|$I1%$6L?P0FcTPo6ya-=~x&YST|(0ReIfzf2rj=QS#R=A|7|72cJzl?l{j~I;l-pE)?%F0hk8OA55%TPUrrs~dn(#~fYVh*iz#rz{nuQmapyU!v^$)?u08Z4A)cQGkvE+kvZd8x3hh1BnC%Ws7dqUyYT%|8^4| z&ZRF8kxfd(mJ`YtNAdZ!QC(C3|B#UH0H)+Too?Fr6k5Wbr zhL3j;&GE?go1l2D^X0?n6KuideBD{~syc%k#Jr2#=3UR+=np|l;q42gf_96xhGcZm+8}k0R%ImVp z(id%+Mn^YCoAnP;)olbZCpWYnlNrFQ{UMq^%q%QEaLQOim8X$FnRA9j9FYP)~z6E7KlQ3oKVUYMokTkCb%=?Ie!^)qMGgb6(k?D8@+y4fRk#%t6o?)Hq5=w>M+Z2Ch|u3mcwiX zDrLMogC&^#)oVB5^=_l@$7@<#K$}H|2C)4lf2LIMm}=w)sbK6_UteEOh%G#772X{* z-2o5?sOiMd4zHtwLPP=%9v2lw&CJiw?-E>$7cX)tDJg;3-Hu`lYji|ROcfyN>~hPQ z9po5kOixW2qlf{?ZDD2Qzh6Sjt3-Siq-zDj8vS<5e}x=XhAD#ku@B#Y7>MU`+~UUt zSOGxWkg^LPP|d0E#4^)|*n5EhOe`$!fEt1Q8JH#$&-nO-|Y~H*XNN_ubsvzoFU?gMy;XdFII7TpSs}9+S zNMmTgc|}EawI^w1DBD?CpSw+)lK~_2Z!=?xauK}5uZFg1a$*9q%j$cAXNjnwz-={| zJdR#?8g#$?c&CKqT=#0s_$ewY6GQjN+hhOLa>)H_S9#ae6b@->3kSyrY2ZPWEs#Md zCBKSVt;NN~8Q~Uy!K~t!de?;#&$BNnx2+0;;X1y4{W^S>!PvAHmQBgVOEM3lqWpje zFv4;Xd?>_VGDV5zscYB``GU}ug$WO-(QCl3>pEbt%?kUCEdo z6m_a&UJHi_SBoBch2`rTAK*HMZQJ04eJ zuss7e;!|wG*d1ur)zaT$mw$V6LC6F&S5j3yV`qWFgUOMSpI5G2p=xPg@0)lQy(Ji0 zI+SaSh?K+B1S>$8_$Lnx{h}!*9}$G|2ZaCGY-2xG{yFBL!%M4xq)bgsuVQ!z?ZHXR zIDpdsIP(E|VCL8%YK(9yAoZdK2A94n+4?iX%^@!vG!iV(u#OU-Yhb_z4i1&vd#|AyXD*6AOJonL+I{i!rGZi$)$5@IMiqRv;Lh0&fB;2NWyM6(RVge$4 z5p2^HC|1ZTC%QBhJGY$fboOTX-@&XrA7zcdnp0hKlxTfjof$-c)A7f`!9o`}|5OIU z3QEdB!DAmPLHFW#DVd!b(fkg=wg+;ISW}6-A1q6lXhsqy>FVDxn5nPswcg{?RsXTX zye%)6r>~}kI~YDEvXa1@IGePnB#$AJ(5zjHS|{XEM@I*tu&4HplD;mL@jlUrU zpE2E>K$~>zs=a*=G%_e*n?XQ`+I+nQQ!BLk#`IiyL{gM!aB3e%XqJv}m@o2g@<)Pa;SgKk1bl`+^2BXTtc z09*au;-_);MBJu`9CQ+HUE=X3N*I#Vg8<=m@6JJ2g+faPNx>fw(GMMk2^Jd+NHdI# zutW%dc&9@8ID`@ps5k5oHkY_!(Bv>HaQI1^&=Pa@m2U-6SXe4DLkedD@kFuQfgH)O zV@ExJA++4L0ETGB8Ch9l#`8<&dg-Z3mVTWB6$$*!1EUKn?`44!atQ&rQp7*uVUZQj z<~!_$;eHUg0h4lM3JuCHK2=CXJxBld?+#chVm3uDfx#gf!vx8l@IAn|!t9sAV0DeR zAihkIoU%=wy_rvQC&4i2!?=Mb?FS1%1(H<*!=P{>UB%+o)om0PFI*+Df_e=Az$YXW z0_vH#k&u?DpXcROwzWk!NG=9J7cOeuqH!sgQW7NBHg`tfmurZEGx!1|R>}N#b~qx4 z>JHCJ{0X-RK%!aD!_LRV#6T8Pma|{JEQ4bd&e9z)NXKU`!#&Xp>TKSy0W2Q+=pKwI zqAZv9-(lMWT(XYsi3b0FW|UD9Fic;KHqJjdcmNbOY1YWBBj{A+)P;t@96Ti!8i=G9 z<{Lobd1zRHvnMVTD3bd4vK}W4D_!y_G!~*1C=u)o@TD*M1rR0}Y^$iP-2fZ}F0PE< zo|BurzZlqSs^j7y+2y}&{r_!v`~Nq~y+!ZR`gbc&w9*yf!P&nb;|TuBsqd<) z)?Kkf=Lwh z$e1cFF&ZE@pcsb{J*XT=2;?zL?;CkNLdh|!xt9d57(~U59v&Xb_XYh?A~1CiTK=B$ zZWt6s_8um(HDKPljT_HMsU!K2F?E1Y!cuNwcrcg@c~Lj0n<=0lu7$@l|K4xlgy_)8O}4;0#o>FE?iG%M@fXQz@} zfkXLqF?ZE~EzmE$E&eU{Ce}%c5G}dTZ2_&nzyK-nN8ylv z$+O#ebM59&%9E~BnJ8 z^Z_5y*WLXFYR6pH%JLmdC3iF}hojfW(i3n8Rwqe=pWK3g`QL6R;`hWKaxp;}lMTl_ zXUtK%9XLtgX>VY%YXaTLN6>7$4!vmrAq4j_AU0->grPW(r104v-oX%m$8boJi9*nrt58Id`EFs6fo2^P7;ohvj1#BP5zC+<_)_XE z1rTkH5{-d_lVkdR@4$@w$Jv6U^mi7?!6Bz3o2Do0?y6lwF9BaPk)?>i10Loov`Sn%PlQt$BLQCB^1@gu9| z!MMTgh#V3nexK{lK49zwCT8YS5Vf*%a*QD-qpQ#uQ#5FTgrb|N{}xgXDV-=dk>U|t ze|X3*01C>W;*-a~9=(IR3%}3`vlWm58C1mje8&WpgTmHZN67>2B{U=sGOV~c*O%PE zy!40g1|kx2FxZd(CMG9)kOs-mw~@~sgbo-V>XufzDIl>YEQRPC&Y(EOVuluJix`4{ z?182%##?I<9h19YFE`5kuVp3<`Gzr`I!8^Ar1hF?+uUC;j&Xw zS0BXKYcy7c3J)OyW@kI1qXJ4jN`Q$e@BOE4j2P*K?CQs>1hsU?sLhsz#s(H#GPecr zSb@t`aP0+_14VP!{{5=Ob#R`*^-fs=pd85^Y{!AYVTHV?iQ)PCf@hP{hkTh;0hd4m zp&hylmwt!66A?IoSh&!m!SsgCi{WtIE_eq8kXMKg{y$fDnAgWwBfyS%&OLV*$4N!& zcz-+__ZiGzmx7BHNpR+8do*+nfUWHnp*uq%z@gNCY7tt;=8P|qaS|Yjq1KFOOuo_J zqmhe1P~wMS&qVM=iAN+>qU!-W{$Sh%gQ?(o=6<|rc;n@Fjr9~@qf#fEvo_r{H5aSNhoV##y}B8Los!nlEE zw$a33DWmS3p-#F^$*c*O7<{+`;HqklZq|ZJg`jh!Q@@AWjYZg+t(=^ykaV76z8D|i z9*)Ws%sbPt6ZvntCZqd*=@F`b-w01g2!?Wl;2|S8fH8xkTt(MLnGxWaQjzGIE`U>> z0rR-S7Z~WyqHn^eJjN+*!Dk3l_i;Gfpz4A6gCG(m9)bljltwRf@aR!Ii5S=)W-anAI@BHJH@7htgb3Ec6fCzJ6r`jvzQ)XS( z+u_oTNE|crQhyx~95U)we;!l=ejvDB!&!$NO@aVHZhwFu8Cv$VO?#RuJ1S%~W|(47 z{5ZS`CLHNj#%$W#Fsus0D9ShS*~{ki?xxg{D8Laz9W&njUUrux z59WvI6+7=S{qG$@69Cy!+b$qVOg9oO8XY(0P^l>Q4=-i>J7V9mBtUwEdv+QR;PnAb zfT@b26}9ztPKdIVD_!XE2qPgm-_K~j*O?mBbUI55?%lZb#)q1hk8c{JxG^UB9Sf4j zZ93n-TWPw?R{%>FRvxz7<-u2OoZo@}E6U3Hb4v)U^J!Z+Mf2?yE-Rq2|6x=yol_r7;(=|9Of0a! zc&>C7#iD=E!jT{Y94I|+kO**{kJ=c&?~ae~zytj^!nx4#?Hjo#0FcKFBs@MU8Jg;D z-SU6Tk%yv+Ae?oi+8}CLL1%^>|F)qa6c9DXVL+K#h-e!A&_DT2p)&8m%@@!MncGvX za_exl7Wj5@aT3~>a{2YXx>lJ!Em`NHk(eC@>p7_ebTi2<4dhmX%}c~*4p@nyXM`PK zLJlTeq430x=i~E917e}-?cwF6ff_?L{o=*Mv|f5P;_alu__`3Loyt+h(EdKR>yrHI z(&dl|<$qlIkVT+^5QKN{GH{x*%@}cpL9-hKX#?F@hR61x1jt z`IWUk2&1x@F<)I24a*M9PgBEn5O!Q?QWs$6p_F$$_6!pML+epIg8{9maJPpV7|(Nt zi{EqexGW!l6ss8Eym4=@_Njlr9Do-JBwyXVdp9+OnT7E%AH{2@ggY;W&x}waEzfrj zSst8BH6O^O=$}_^WG1itp}Ly-4d^GlL|k}NM!sg0a%!y-jTfMNqP?4m)QoAT+81^}0 z-N;6s79=4D6|m@&TBU$ISRxp4zMA}nEQ86rV9<$NuJL!2P3y|uC}jX#C6s6kwhe8; zZ)Xu*8g6rqMLIuO%;fDLZ@>o6Ch|R4XgruMI@B9_KliQs3Mia-gxp9&#%6I! z4T-V>I|*ct2=RbK3vw7M(7%zu#Y76stNkI`g5=&JaErvxa?nSkQH(q)+d*R*R3F@X zMn>ZZV+in4DpRz~m|s$$tdp|2o$pBm5uNhj}2b-!J0 zuQcv~PsRfgiNkAMPLnbL_l9$5bzOdGrWlEuCA{|d+Gf$J?E#0`xSbJ z{Y1A6GOZGE-yo;J|H%p33^SbW%G_3S`?^u@(K+|E+m#X*J=&*_U=_O0RCYnv%D*;x ze<2iCLBwGEil9cAzp3%lDPV5ULTE1)0Stj8y@NAabY>H>5w5P7n3&-2mtdMYU*b8R z)qWKD7A=uBM#Esu^Fw;M-Mnoxjx8BN!B>b1bN+n1Wufeh(0Gq`-;W=)cp^IPaNFj& zEs9{hNzZBXbtZQaFFl0!DzVc5WS0k3hqT?@s;TVhiR)};s(*hbOf$F+Jol3?oD7HG zL8&7)CqTeS7z?U7pD2=v6f(w)X_I8vbvYj`sY$B=D>=CtfbuOGu2Ga>$ZPH;?VOyP zd*LT{|MaQo?5UNK1ni$r%(vWi?6?dI^gX=h_rNMZv`~c34O1eq#}X?VHn0IzgqTg? zb1zvK$vFC~DgJ0!CIAZMn+2x+FJB%hwZ;FePV7|UcZb(#eyngD1m;Efl9Ep@N#R$g zV1|ch`ZF#US+k~hm$Hl@8+!qaTIcaac-Ml`410}e*RI6{K$*+n_&A}cqcWLQr);MC zSOPWx`usG;k}xO%0M({}ijVk*Jv#t7H!>k%f9D4_E`mf((N*CClZ%vaHb=G%;r>9n zBC%^x4o7KJ#npU9sPu%1zDcTH!zBG zV;&tF2kzr$aB#4D)^{|W8n{zIaQ}XCwTt2CdsmbZyy}Q#Xb}!#q4x;;mH>j-r!be0 zs3QP%rk1@_XXpjG^#k_3a0YqMn=++vZ#n93pW;mzFCW* zx&H`B2OavWJUPc<_eloS1ETjwO2Oq^)mW10VEQcqB_JN`aVIBvYs3H&L4l!g*kgQb z7_ESA%^+lws}ABHu{Z@}M%#l8BK904N79WGHx+EelncMwQxrB6-xIF)gHiAj3WMj$ z(r;|9d|JP68o6-;p4?kxKpE#{^k>vrw{mio3z=zwVvVaX7!2WH?g4-+nS7s!R?_ZB z`a`%Uplv+3yJv_2`-hm82NQ}1!gQ`LPDruXR!sj9?iz;=q{mM5M_GD{!c3gKvJNtX z`e)CAM36z#`UT<_4EORl%$zFwfXHzpk08Jcu@hi)-q7g*y_gCpIzH50U%)8R5@DSx zP$ycWeOdIN)0YAF0lyP#C5|4KSRHKwAr@Z1ghJ+>C%WH~3$-v0j7zL|VCcgQ8mo{z zdZ3@1Kr90|JjNijnNYE>>J0ed0>f1ky!M{Bsw={tRB_fmBBgy^G1epSu2y2r9 z8G#frtSN4qk%!cb2NraQUcgPI#F7CLpaPsWx%+^O=zy#zw22G3NA@w`&~373u%?(; zT2{gCKh#w!^_PkG>W%qBT%-xjpyp_o=Sge}glKcH1>hKJIMo?CV+rBYg3)cD;#0u7 z;OI8&I1#gj=hRUD!hs0h$q&M%WW_MX3#QVXT+~zI8H+Be8oy0<8pHEd0@`UCPyvW# z4iNkfU@*D%Y|SPPMc6P=vAYdz#ICyG87Qk#mqy&`Z))z+y>$=Ya!V;Do z)e*%PTe1dPAVh_msi|fq_N-V)Rt?Y^?E# zI~tkftDDSuQv*K}qe#j09F0efrYZKFG#oeiZ~XG$}Q;diKFy+zOh4 zj|XI@3C}LXkx0Akt7Q1cn6xwt@0R#r92jMxvZh8E5bhI175T->F_tEE0-3*5@pMr1 z7`6_J;y#9n%NJ%)9jiD~J`+JKIrxam%kjc3(UWxlxx@JH4ak^T#o_1=!9)LQJ%MXI zcYpo;ZRpI-zxN}%&Wx=4dxt5mE%%~kyTHQp79UIoyS zq+e`)k$vI+Au8V-zSi}Bb@gHdcG`yTYu-iYu?{70bJ;ImyobjTmn)NFtD^EDFTt|w zU3g^VO%N(bOR#he6pn+CMMqBqyo#~k56E+XbZ$S7!*d^iYL7<&blb9ZYjW0Hfr>yf zZvK0W^QlC*FqDVgXP#>GU;(Xg zh_v+eW1N6?tN<}{R;&)H}Xj)U?|)Z^Ec z^0_qcZ(KMQYtuvL5=fkQ zOSmVD3WcHILDDcWH%}|cf|D9HHw;Qry+P9ruN!Vum>B8mMIz}abWwjHp7=iC3iZ73 z|8Tb!euG9PUF>k-{CSQy?0FyXpfCd&D4sivNhc1liEz*fe$D$|ZJm8clTjGOmncLT zMUjyr6>fb@%z{9ixFmJytTZFVq**DHnvT#+ODm$ZFlkxQ{1|;r%07|il**Y}nvx5( zC>1eLL%GrC&pGEguMVk&h4e@N#ivbr=5~{IP0xS8s3tXl ze=q99Y)qQ#$dFv$6Mb}HnC5U2X3xpK^uGy~W8=u>31va;B(en687zf`g^8?e?sWHI ztghSm^(uV742HlLe;pcn1F0$b_S44|AB_;@8Lb{GdM2_u%!((pcu{`9u>JY0?fn_@8`!<>IuD z9waaBPT-TsSCn9PaM2iEs3Rj|SM8puD;n5qpRF#MGG}CES!))JXgz{AE1iVW!c#pn z+?ug}fB(v1NfwkYW!I#O@ni7qk9!l7$ohEm;~&Zn%Y_dVCfYixRH)r@A3&)?{pX<2 zyfid7=VLi`+LZKe32jY5MTLw}nugRg8!3^{j{Ogd94G6QadNYHLu=I*}WHEI?}!TEJdO96ZIT1iRe>7yi5s8lLOMclAU8%FV+E_0IZ`po3GQ-$+~-cADyW`WqZmoXIf!HE7?hKTRKsCM$5Do+y|G9 z)MnCRz#?iW$WB0om#A!_{)xkD@Xt`?2X-w2>)n(jgQ+?J$5XR3*Ad0i9$Ov{weQDp znbt^2P;-NK5)vatgluhU3T|s_E0%_vvb^Aj?&LegDv=ZL) zFzU`ZA}#OwDf=-1R1i%W#_ot_g^awb&-kTu{-SZKc>=imsrM3_4k2Al`j!p|Nobb0 zs6@pa7VqQ7tX|ZPSCwb^Hh_3*GVZU^x~=tBDAf3DDo)-WP5=gn5^{fonlD8V9mS~e zIVRH}BTJk>?*+y$)4%h+ONB*m?qdS~-mG(1=A=W?l@e8(t+Br0I|!2S&|M) Date: Sun, 30 Mar 2025 14:15:26 +0200 Subject: [PATCH 20/56] initial refactor + pydantic preliminary --- src/spatialdata_plot/pl/_viewconfig.py | 43 +----- src/spatialdata_plot/viewconfig/__init__.py | 0 src/spatialdata_plot/viewconfig/data.py | 0 src/spatialdata_plot/viewconfig/scales.py | 137 ++++++++++++++++++++ tests/conftest.py | 8 +- 5 files changed, 146 insertions(+), 42 deletions(-) create mode 100644 src/spatialdata_plot/viewconfig/__init__.py create mode 100644 src/spatialdata_plot/viewconfig/data.py create mode 100644 src/spatialdata_plot/viewconfig/scales.py diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 1c2029b3..69c0dc8e 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -20,6 +20,7 @@ PointsRenderParams, ShapesRenderParams, ) +from spatialdata_plot.viewconfig.scales import _create_axis_scale_array Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams @@ -40,46 +41,6 @@ def from_matplotlib(cls, alignment: str) -> str: return mapping.get(alignment, cls.CENTER).value -def _create_axis_scale_block(ax: Axes) -> list[dict[str, Any]]: - """Create vega scales object pertaining to both the x and the y axis. - - Parameters - ---------- - ax : Axes - A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. - """ - scales = [] - scales.append(_get_axis_scale_config(ax, "x")) - scales.append(_get_axis_scale_config(ax, "y")) - return scales - - -def _get_axis_scale_config(ax: Axes, axis_name: str) -> dict[str, Any]: - """Provide a vega like scales object particular for one of the plotting axes. - - Note that in vega, this config also contains the fields reverse and zero. - However, given that we specify the domain explicitly, these are not required here. - - Parameters - ---------- - ax : Axes - A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. - axis_name: str - Which axis the config should be made for, either "x" or "y". - """ - scale: dict[str, Any] = {} - scale["name"] = f"{axis_name.upper()}_scale" - if axis_name == "x": - scale["type"] = ax.get_xaxis().get_scale() - scale["domain"] = [ax.get_xlim()[0].item(), ax.get_xlim()[1].item()] - scale["range"] = "width" - if axis_name == "y": - scale["type"] = ax.get_yaxis().get_scale() - scale["domain"] = [ax.get_ylim()[0].item(), ax.get_ylim()[1].item()] - scale["range"] = "height" - return scale - - def _create_padding_object(fig: Figure) -> dict[str, float]: """Get the padding parameters for a vega viewconfiguration. @@ -1031,7 +992,7 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: ax = fig_params.ax data_array, marks_array, color_scale_array, legend_array = _create_data_configs(sdata, fig, ax, cs, sdata._path) - scales_array = _create_axis_scale_block(ax) + scales_array = _create_axis_scale_array(ax) axis_array = _create_axis_block(ax, scales_array, fig.dpi) scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array diff --git a/src/spatialdata_plot/viewconfig/__init__.py b/src/spatialdata_plot/viewconfig/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/spatialdata_plot/viewconfig/data.py b/src/spatialdata_plot/viewconfig/data.py new file mode 100644 index 00000000..e69de29b diff --git a/src/spatialdata_plot/viewconfig/scales.py b/src/spatialdata_plot/viewconfig/scales.py new file mode 100644 index 00000000..6750ba5d --- /dev/null +++ b/src/spatialdata_plot/viewconfig/scales.py @@ -0,0 +1,137 @@ +from typing import Any, Literal + +from matplotlib.axes import Axes +from pydantic import BaseModel + + +def _create_axis_scale_array(ax: Axes) -> list[dict[str, Any]]: + """Create vega scales object pertaining to both the x and the y axis. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. + + Returns + ------- + scales: list[dict[str, Any]] + An array containing individual scales objects with the parameters for the x and y axis of a plot. + """ + scales = [] + scales.append(_get_axis_scale_object(ax, "x")) + scales.append(_get_axis_scale_object(ax, "y")) + return scales + + +def _get_axis_scale_object(ax: Axes, axis_name: str) -> dict[str, Any]: + """Provide a vega like scales object particular for one of the plotting axes. + + Note that in vega, this config also contains the fields reverse and zero. + However, given that we specify the domain explicitly, these are not required here. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. + axis_name: str + Which axis the config should be made for, either "x" or "y". + + Returns + ------- + scale: dict[str, Any] + A vega like scale object containing the type of scale, the domain (xlim or ylim) and the range (`width` for + x axis and `height` for y axis). + """ + scale_type = ax.get_xaxis().get_scale() if axis_name == "x" else ax.get_yaxis().get_scale() + domain = ( + [ax.get_xlim()[0].item(), ax.get_xlim()[1].item()] + if axis_name == "x" + else [ax.get_ylim()[0].item(), ax.get_ylim()[1].item()] + ) + + return { + "name": f"{axis_name.upper()}_scale", + "type": scale_type, + "domain": domain, + "range": "width" if axis_name == "x" else "height", + } + + +class AxisScaleObject(BaseModel): + """Represents a scale configuration for a single axis in a vega-like format. + + Attributes + ---------- + name : str + The name of the scale, typically formatted as "X_scale" or "Y_scale". + type : Literal["linear", "log", "symlog", "logit"] + The type of scale used for the axis, matching common matplotlib scale types. + domain : list[float] + The domain of the axis, defined by the minimum and maximum values. + range : Literal["width", "height"] + The mapping of the axis to the corresponding plot dimension. + """ + + name: str + type: Literal[ + "asinh", "function", "functionlog", "linear", "log", "logit", "symlog" + ] # Common matplotlib scale types + domain: list[float] + range: Literal["width", "height"] + + @classmethod + def get_axis_scale_object_from_mpl(cls, ax: Axes, axis_name: str) -> "AxisScaleObject": + """Generate a scale object for a given axis in a vega-like format. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance representing a subplot. + axis_name : str + The axis to configure, either "x" or "y". + + Returns + ------- + AxisScale + A validated scale configuration for the specified axis. + """ + scale_type = ax.get_xaxis().get_scale() if axis_name == "x" else ax.get_yaxis().get_scale() + domain = ( + [ax.get_xlim()[0].item(), ax.get_xlim()[1].item()] + if axis_name == "x" + else [ax.get_ylim()[0].item(), ax.get_ylim()[1].item()] + ) + + return cls( + name=f"{axis_name.upper()}_scale", + type=scale_type, + domain=domain, + range="width" if axis_name == "x" else "height", + ) + + +class AxisScaleArray(BaseModel): + """Represents an array of AxisScaleObject instances.""" + + scales: list[AxisScaleObject] + + @classmethod + def create_axis_scale_array_from_mpl(cls, ax: Axes) -> "AxisScaleArray": + """Create a list of scale objects for both the x and y axes. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance representing a subplot. + + Returns + ------- + list[AxisScale] + A list containing scale configurations for both x and y axes. + """ + return cls( + scales=[ + AxisScaleObject.get_axis_scale_object_from_mpl(ax, "x"), + AxisScaleObject.get_axis_scale_object_from_mpl(ax, "y"), + ] + ) diff --git a/tests/conftest.py b/tests/conftest.py index 688379f2..e5290163 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -429,7 +429,13 @@ def _decorate(fn: Callable, clsname: str, name: str | None = None) -> Callable: @wraps(fn) def save_and_compare(self, *args, **kwargs): # we need the test to contain one of these parameters as argument; the view configuration will be saved there - keys_to_check = ["sdata_blobs", "sdata_blobs_str", "sdata_raccoon", "sdata_empty"] + keys_to_check = [ + "sdata_blobs", + "sdata_blobs_str", + "sdata_raccoon", + "sdata_empty", + "sdata_blobs_shapes_annotated", + ] sdata = None for key in keys_to_check: sdata = kwargs.get(key) From 288e419c2e101a7177c4df2ab97baa41ab492e4a Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 30 Mar 2025 14:44:37 +0200 Subject: [PATCH 21/56] further refactor -> padding object to layout --- .../{viewconfig => _viewconfig}/__init__.py | 0 .../{viewconfig => _viewconfig}/data.py | 0 src/spatialdata_plot/_viewconfig/layout.py | 19 ++++++++++++ .../{viewconfig => _viewconfig}/scales.py | 8 ++--- src/spatialdata_plot/pl/_viewconfig.py | 29 +++---------------- 5 files changed, 27 insertions(+), 29 deletions(-) rename src/spatialdata_plot/{viewconfig => _viewconfig}/__init__.py (100%) rename src/spatialdata_plot/{viewconfig => _viewconfig}/data.py (100%) create mode 100644 src/spatialdata_plot/_viewconfig/layout.py rename src/spatialdata_plot/{viewconfig => _viewconfig}/scales.py (94%) diff --git a/src/spatialdata_plot/viewconfig/__init__.py b/src/spatialdata_plot/_viewconfig/__init__.py similarity index 100% rename from src/spatialdata_plot/viewconfig/__init__.py rename to src/spatialdata_plot/_viewconfig/__init__.py diff --git a/src/spatialdata_plot/viewconfig/data.py b/src/spatialdata_plot/_viewconfig/data.py similarity index 100% rename from src/spatialdata_plot/viewconfig/data.py rename to src/spatialdata_plot/_viewconfig/data.py diff --git a/src/spatialdata_plot/_viewconfig/layout.py b/src/spatialdata_plot/_viewconfig/layout.py new file mode 100644 index 00000000..5ff73246 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/layout.py @@ -0,0 +1,19 @@ +from matplotlib.figure import Figure + + +def create_padding_object(fig: Figure) -> dict[str, float]: + """Get the padding parameters for a vega viewconfiguration. + + Parameters + ---------- + fig : Figure + The matplotlib figure. The top level container for all the plot elements. + """ + # contains also wspace and hspace but does not seem to be used by vega here. + padding_obj = fig.subplotpars + return { + "left": (padding_obj.left * fig.bbox.width), + "top": ((1 - padding_obj.top) * fig.bbox.height), + "right": ((1 - padding_obj.right) * fig.bbox.width), + "bottom": (padding_obj.bottom * fig.bbox.height), + } diff --git a/src/spatialdata_plot/viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py similarity index 94% rename from src/spatialdata_plot/viewconfig/scales.py rename to src/spatialdata_plot/_viewconfig/scales.py index 6750ba5d..76d2824b 100644 --- a/src/spatialdata_plot/viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -4,7 +4,7 @@ from pydantic import BaseModel -def _create_axis_scale_array(ax: Axes) -> list[dict[str, Any]]: +def create_axis_scale_array(ax: Axes) -> list[dict[str, Any]]: """Create vega scales object pertaining to both the x and the y axis. Parameters @@ -18,12 +18,12 @@ def _create_axis_scale_array(ax: Axes) -> list[dict[str, Any]]: An array containing individual scales objects with the parameters for the x and y axis of a plot. """ scales = [] - scales.append(_get_axis_scale_object(ax, "x")) - scales.append(_get_axis_scale_object(ax, "y")) + scales.append(get_axis_scale_object(ax, "x")) + scales.append(get_axis_scale_object(ax, "y")) return scales -def _get_axis_scale_object(ax: Axes, axis_name: str) -> dict[str, Any]: +def get_axis_scale_object(ax: Axes, axis_name: str) -> dict[str, Any]: """Provide a vega like scales object particular for one of the plotting axes. Note that in vega, this config also contains the fields reverse and zero. diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 69c0dc8e..f71ce33a 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -12,6 +12,8 @@ from matplotlib.figure import Figure from spatialdata.models import get_table_keys +from spatialdata_plot._viewconfig.layout import create_padding_object +from spatialdata_plot._viewconfig.scales import create_axis_scale_array from spatialdata_plot.pl.render_params import ( CmapParams, FigParams, @@ -20,7 +22,6 @@ PointsRenderParams, ShapesRenderParams, ) -from spatialdata_plot.viewconfig.scales import _create_axis_scale_array Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams @@ -41,28 +42,6 @@ def from_matplotlib(cls, alignment: str) -> str: return mapping.get(alignment, cls.CENTER).value -def _create_padding_object(fig: Figure) -> dict[str, float]: - """Get the padding parameters for a vega viewconfiguration. - - Given that matplotlib gives the padding parameters as a fraction of the the figure width or height and - vega gives it as absolute number of pixels we need to convert from the fraction to the number of pixels. - - Parameters - ---------- - fig : Figure - The matplotlib figure. The top level container for all the plot elements. - """ - fig_width_pixels, fig_height_pixels = fig.get_size_inches() * fig.dpi - # contains also wspace and hspace but does not seem to be used by vega here. - padding_obj = fig.subplotpars - return { - "left": (padding_obj.left * fig_width_pixels).item(), - "top": ((1 - padding_obj.top) * fig_height_pixels).item(), - "right": ((1 - padding_obj.right) * fig_width_pixels).item(), - "bottom": (padding_obj.bottom * fig_height_pixels).item(), - } - - def _create_random_colorscale(data_id: str, field: str) -> list[dict[str, Any]]: """Create a vega like colorscale for random colors. @@ -992,7 +971,7 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: ax = fig_params.ax data_array, marks_array, color_scale_array, legend_array = _create_data_configs(sdata, fig, ax, cs, sdata._path) - scales_array = _create_axis_scale_array(ax) + scales_array = create_axis_scale_array(ax) axis_array = _create_axis_block(ax, scales_array, fig.dpi) scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array @@ -1001,7 +980,7 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", "height": fig.bbox.height, # matplotlib uses inches, but vega uses absolute pixels "width": fig.bbox.width, - "padding": _create_padding_object(fig), + "padding": create_padding_object(fig), "title": _create_title_config(ax, fig), "data": data_array, "scales": scales, From f52a3aa37e1a2e1ebeb2ec497147c2dd52dd8a5e Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 31 Mar 2025 11:48:13 +0200 Subject: [PATCH 22/56] refactor color scales --- src/spatialdata_plot/_viewconfig/scales.py | 189 +++++++++++ src/spatialdata_plot/pl/_viewconfig.py | 298 ++++++------------ ..._can_plot_with_one_element_color_table.png | Bin 0 -> 37015 bytes tests/pl/test_render_labels.py | 14 +- 4 files changed, 284 insertions(+), 217 deletions(-) create mode 100644 tests/_images/Labels_can_plot_with_one_element_color_table.png diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py index 76d2824b..f6a23f7f 100644 --- a/src/spatialdata_plot/_viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -1,8 +1,12 @@ from typing import Any, Literal +from uuid import uuid4 +import matplotlib.colors as mcolors from matplotlib.axes import Axes from pydantic import BaseModel +from spatialdata_plot.pl.render_params import CmapParams, LabelsRenderParams, PointsRenderParams, ShapesRenderParams + def create_axis_scale_array(ax: Axes) -> list[dict[str, Any]]: """Create vega scales object pertaining to both the x and the y axis. @@ -57,6 +61,191 @@ def get_axis_scale_object(ax: Axes, axis_name: str) -> dict[str, Any]: } +def _generate_color_scale_object( + name: str, type_scale: str, domain: list[str] | dict[str, str], color_range: list[str] | dict[str, str | int] +) -> dict[str, Any]: + """Create vega like color scale object. + + This function is a helper function to generate any kind of color scale object, whether linear or categorical / + ordinal. + + Parameters + ---------- + name : str + The name by which others parts of the view configuration can refer to the color scale object. + type_scale : str + The type of color scale. Usually either `linear` or `ordinal`. + domain : list[str] | dict[str, str] + The domain of the color scale, meaning the actual values to which a color must be mapped. Can be either + an array of strings or if the `type` is `linear` it can be an object containing `data` and `field` keys, which + are derived from a data object. + color_range : list[str] | dict[str, str | int] + The range of the color scale, meaning the colors which are mapped to a particular value given by the `domain`. + Either an object containing the `scheme` with as value the colormap name and the `count` stating the number + of colors in the colormap. Otherwise, it is an array of hex colors represented by strings. + + Returns + ------- + A vega-like color scale object. + """ + return { + "name": name, + "type": type_scale, + "domain": domain, + "range": color_range, + } + + +def _create_random_colorscale(data_id: str) -> dict[str, Any]: + """Create a vega-like colorscale for random colors. + + There is no way currently to create a vega color scale object with random colors without serializing those. Need to + find a way to agree on this. + + Parameters + ---------- + data_id: str + The name of the derived data object that pertains to a spatialdata element for which a color scale array object + is created. + + Returns + ------- + A vega like color scale object for random color assignment. + """ + return _generate_color_scale_object(f"color_{uuid4()}", "ordinal", {"data": data_id, "field": "value"}, ["random"]) + + +def create_categorical_colorscale(color_mapping: dict[str, str]) -> list[dict[str, Any]]: + """Create a categorical Vega-like color scale array. + + Parameters + ---------- + color_mapping: dict[str, str] + A mapping of individual values in usually a table column to their corresponding hex color in the visualization. + + Returns + ------- + A vega like color scale array containing in this case one color scale object. + """ + return [ + _generate_color_scale_object( + f"color_{uuid4()}", "ordinal", list(color_mapping.keys()), list(color_mapping.values()) + ) + ] + + +def _process_colormap(cmap: CmapParams) -> dict[str, Any]: + """Process colormap to return a Vega color range dictionary. + + cmap: CmapParams + An instance of CmapParams containing information pertaining colormap used and normalization applied. + + Returns + ------- + The `range` value of a vega like color scale object. + """ + if isinstance(cmap, mcolors.ListedColormap | mcolors.LinearSegmentedColormap): + if cmap.name in {"from_list", "custom_colormap"}: + # TODO: Handle custom colormap logic + return {} + return {"scheme": cmap.name, "count": cmap.N} + return {} + + +def create_colorscale_array_points_shapes_labels( + coloring: dict[str, str] | Literal["continuous"] | None, + params: PointsRenderParams | ShapesRenderParams | LabelsRenderParams, + data_object: dict[str, Any], +) -> list[dict[str, Any]]: + """Create a vega like colorscale array based on the colormap parameters for points or shapes. + + Parameters + ---------- + coloring: dict[str, str] | str | None + Either a categorical mapping of values to hex color strings or the literal `continuous` in case of a + numerical column being used to determine the color of SpatialData shapes or points. + params: PointsRenderParams | ShapesRenderParams + The render parameters for a given SpatialData points or shapes element. + data_object: dict[str, Any] + A vega like data object pertaining to a Spatialdata points or shapes element + to which the color scale is applied. + + Returns + ------- + A vega like colorscale array containing in this case one color scale object pertaining to a SpatialData points + or shapes element. + """ + color_scale_object = {"name": f"color_{uuid4()}"} + + if isinstance(coloring, dict): + color_scale_object.update( + _generate_color_scale_object( + color_scale_object["name"], + "ordinal", + list(coloring.keys()), + [mcolors.to_hex(col, keep_alpha=False) for col in coloring.values()], + ) + ) + elif coloring == "continuous": + if isinstance(params, LabelsRenderParams): + field = data_object["transform"][-1].get("as") or [params.color] + else: + field = data_object["transform"][-1].get("as") or [params.col_for_color] + color_scale_object.update( + _generate_color_scale_object( + color_scale_object["name"], + "linear", + {"data": data_object["name"], "field": field}, + _process_colormap(params.cmap_params.cmap), + ) + ) + elif coloring == "random": + color_scale_object.update( + _create_random_colorscale( + data_object["name"], + ) + ) + + return [color_scale_object] + + +def create_colorscale_array_image( + cmap_params: list[CmapParams] | CmapParams, data_id: str, field: list[str] | list[int] | int | str | None +) -> list[dict[str, Any]]: + """Create a Vega-like color scale array for a SpatialData image element. + + cmap_params: list[CmapParams] | CmapParams + The colormap parameters used to color a particular SpatialData image element. + data_id: str + The `name` in the vega like derived data object pertaining to a SpatialData image element. + field: list[str] | list[int] | int | str | None + The part of the SpatialData image or labels element to which apply the color. If `string` or + `list` of `strings` it pertains to individual channel names, if `int` or `list` of `int` + it pertains to the index or indices of image channel(s). + + Returns + ------- + A color scale array containing vega-like color scale objects pertaining to a SpatialData image element. + """ + cmaps = [param.cmap for param in cmap_params] if isinstance(cmap_params, list) else [cmap_params.cmap] + cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps + + color_scale_array = [] + for index, cmap in enumerate(cmaps): + type_scale = "linear" + color_range = _process_colormap(cmap) + + if isinstance(field, int | list): + field = f"channel_{index}" + field = field or "value" + + color_scale_array.append( + _generate_color_scale_object(f"color_{uuid4()}", type_scale, {"data": data_id, "field": field}, color_range) + ) + + return color_scale_array + + class AxisScaleObject(BaseModel): """Represents a scale configuration for a single axis in a vega-like format. diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index f71ce33a..5f7e9594 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -13,9 +13,12 @@ from spatialdata.models import get_table_keys from spatialdata_plot._viewconfig.layout import create_padding_object -from spatialdata_plot._viewconfig.scales import create_axis_scale_array +from spatialdata_plot._viewconfig.scales import ( + create_axis_scale_array, + create_colorscale_array_image, + create_colorscale_array_points_shapes_labels, +) from spatialdata_plot.pl.render_params import ( - CmapParams, FigParams, ImageRenderParams, LabelsRenderParams, @@ -42,142 +45,6 @@ def from_matplotlib(cls, alignment: str) -> str: return mapping.get(alignment, cls.CENTER).value -def _create_random_colorscale(data_id: str, field: str) -> list[dict[str, Any]]: - """Create a vega like colorscale for random colors. - - This scale is used in case there is a label image for which the labels are visualized by random colors. - - Parameters - ---------- - data_id : str - The ID of the derived data object that pertains to a spatialdata label element. - field : str - The value of the derived datablock to which the color scale gets applied. Typically `value`. - - Returns - ------- - The array containing the vega like random color scale object. - """ - return [ - { - "name": f"color_{str(uuid4())}", - "type": "ordinal", - "domain": {"data": data_id, "field": field}, - "range": ["random"], # TODO: decide how to better do this to simulate label2rgb - } - ] - - -def _create_categorical_colorscale(color_mapping: dict[str, str]) -> list[dict[str, Any]]: - """Create a categorical vega like color scale array. - - Parameters - ---------- - color_mapping : dict[str, str] - The mapping of categorical values to colors as hex string. - - Returns - ------- - The array containing the vega like ordinal color scale object. - """ - return [ - { - "name": f"color_{str(uuid4())}", - "type": "ordinal", - "domain": list(color_mapping.keys()), - "range": list(color_mapping.values()), - } - ] - - -def _create_colorscale_points( - cmap_params: list[CmapParams] | CmapParams, color_mapping: None | dict[str, str], params, data_object: str -) -> list[dict[str, Any]]: - cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] - cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps # Happens if palette is specified as list of strings - color_scale_array: list[dict[str, Any]] = [] - - color_scale_object = {"name": f"color_{str(uuid4())}"} - if isinstance(color_mapping, dict): - color_scale_object.update( - { - "type": "ordinal", - "domain": list(color_mapping.keys()), - "range": [mcolors.to_hex(col) for col in color_mapping.values()], - } - ) - elif color_mapping == "continuous": - data_id = data_object["name"] - field = data_object["transform"][-1].get("as") - if not field: - field = [params.col_for_color] - color_scale_object.update( - { - "type": "linear", - "domain": {"data": data_id, "field": field}, - "range": {"scheme": params.cmap_params.cmap.name, "count": params.cmap_params.cmap.N}, - } - ) - - color_scale_array.append(color_scale_object) - return color_scale_array - - -def _create_colorscale_image( - cmap_params: list[CmapParams] | CmapParams, data_id: str, field: list[str] | list[int] | int | str | None -) -> list[dict[str, Any]]: - """Create a vega like color scale array to be applied to an image. - - This in particular creates a color scale array based on the colormaps that are part of the ImageRenderParams. - - Parameters - ---------- - cmap_params : CmapParams - The colormap parameters used to plot the spatialdata image element. - data_id: str - The ID of the derived data object that pertains to a spatialdata image element. - field: - The value of the derived datablock to which the color scale is applied. In case of an image - can be a channel or list of channels or the index thereof. - - Returns - ------- - The array containing the vega like color scale array. - """ - cmaps = [cmap_params.cmap] if not isinstance(cmap_params, list) else [param.cmap for param in cmap_params] - cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps # Happens if palette is specified as list of strings - color_scale_array: list[dict[str, Any]] = [] - for index, cmap in enumerate(cmaps): - # TODO: check why listedcolormap is only passed on when we specify channel. - if isinstance(cmap, mcolors.ListedColormap): - type_scale = "linear" - if cmap.name == "from_list": # default name when cmap is custom. - # TODO: complete this for all types of cmaps - pass - else: - color_range = {"scheme": cmap.name, "count": cmap.N} - elif isinstance(cmap, mcolors.LinearSegmentedColormap): - type_scale = "linear" - if cmap.name == "custom_colormap": - pass - else: - color_range = {"scheme": cmap.name, "count": cmap.N} - if isinstance(field, int | list): - field = f"channel_{index}" - if not field: - field = "value" - color_scale_object = { - "name": f"color_{str(uuid4())}", - "type": type_scale, - "domain": {"data": data_id, "field": field}, - "range": color_range, - } - - color_scale_array.append(color_scale_object) - - return color_scale_array - - def _create_base_level_sdata_block(url: str) -> dict[str, Any]: """Create the vega json object for the SpatialData zarr store. @@ -226,7 +93,7 @@ def _create_legend_title_config(title_obj: Text, dpi: float) -> dict[str, Any]: } -def _create_categorical_legend(fig: Figure, color_scale_array: list[dict[str, Any]]) -> list[dict[str, Any]]: +def _create_categorical_legend(fig: Figure, color_scale_array: list[dict[str, Any]], ax: Axes) -> list[dict[str, Any]]: """Create vega like categorical legend array. Parameters @@ -235,13 +102,14 @@ def _create_categorical_legend(fig: Figure, color_scale_array: list[dict[str, An The matplotlib figure. color_scale_array : list[dict[str, Any]] The vega like color scale array for which the vega like legend array will be created. + ax : Axes + A matplotlib Axes object. Returns ------- The vega like categorical legend array. """ legend_array: list[dict[str, Any]] = [] - ax = fig.get_axes()[0] legend = ax.legend() legend_bbox_props = legend.get_frame().properties() legend_bbox = legend.get_tightbbox() @@ -305,48 +173,49 @@ def _create_colorbar_legend( if cbar: cbars.append(cbar) - for col_config in color_scale_array: - cbar = cbars[legend_count] + if len(cbars) != 0: + for col_config in color_scale_array: + cbar = cbars[legend_count] - axis_props = cbar.ax.properties() - if cbar.orientation == "vertical": - gradient_length = cbar.ax.get_position().bounds[-1] * fig.get_figheight() * fig.dpi - label = axis_props["yticklabels"][0].properties() - else: - gradient_length = cbar.ax.get_position().bounds[-2] * fig.get_figwidth() * fig.dpi - label = axis_props["xticklabels"][0].properties() - if col_config["type"] == "linear": - legend_type = "gradient" - spine_outline = cbar.outline.properties() # outline of the colorbar lining - - stroke_color = mcolors.to_hex(spine_outline["facecolor"]) if spine_outline["facecolor"][-1] > 0 else None - legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) - # TODO: do we require padding? it is not obvious to get from matplotlib - legend_object = { - "type": legend_type, - "direction": cbar.orientation, - "orient": "none", # Required in vega in order to use the x and y position - "fill": color_scale_array[0]["name"], - "fillColor": mcolors.to_hex(cbar.ax.get_facecolor()), - "gradientLength": gradient_length, # alpha if alpha := getattr(cbar.cmap, "_lut", None)[0][-1] else - "gradientOpacity": cbar.mappable.get_alpha(), - "gradientThickness": (cbar.ax.get_position().bounds[2] * fig.dpi) / 72, - "gradientStrokeColor": stroke_color, - "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, - "values": list(cbar.ax.get_yticks()), - "labelAlign": label["horizontalalignment"], - "labelColor": mcolors.to_hex(label["color"]), - "labelFont": label["fontname"], - "labelFontSize": (label["fontsize"] * fig.dpi) / 72, - "labelFontStyle": label["fontstyle"], - "labelFontWeight": label["fontweight"], - "legendX": cbar.ax.get_tightbbox().bounds[0], - "legendY": fig.bbox.height - cbar.ax.get_tightbbox().bounds[1] - cbar.ax.get_tightbbox().bounds[3], - "zindex": axis_props["zorder"], - } - if legend_title_object["title"] != "": - legend_object.update(legend_title_object) - legend_array.append(legend_object) + axis_props = cbar.ax.properties() + if cbar.orientation == "vertical": + gradient_length = cbar.ax.get_position().bounds[-1] * fig.get_figheight() * fig.dpi + label = axis_props["yticklabels"][0].properties() + else: + gradient_length = cbar.ax.get_position().bounds[-2] * fig.get_figwidth() * fig.dpi + label = axis_props["xticklabels"][0].properties() + if col_config["type"] == "linear": + legend_type = "gradient" + spine_outline = cbar.outline.properties() # outline of the colorbar lining + + stroke_color = mcolors.to_hex(spine_outline["facecolor"]) if spine_outline["facecolor"][-1] > 0 else None + legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) + # TODO: do we require padding? it is not obvious to get from matplotlib + legend_object = { + "type": legend_type, + "direction": cbar.orientation, + "orient": "none", # Required in vega in order to use the x and y position + "fill": color_scale_array[0]["name"], + "fillColor": mcolors.to_hex(cbar.ax.get_facecolor()), + "gradientLength": gradient_length, # alpha if alpha := getattr(cbar.cmap, "_lut", None)[0][-1] else + "gradientOpacity": cbar.mappable.get_alpha(), + "gradientThickness": (cbar.ax.get_position().bounds[2] * fig.dpi) / 72, + "gradientStrokeColor": stroke_color, + "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, + "values": list(cbar.ax.get_yticks()), + "labelAlign": label["horizontalalignment"], + "labelColor": mcolors.to_hex(label["color"]), + "labelFont": label["fontname"], + "labelFontSize": (label["fontsize"] * fig.dpi) / 72, + "labelFontStyle": label["fontstyle"], + "labelFontWeight": label["fontweight"], + "legendX": cbar.ax.get_tightbbox().bounds[0], + "legendY": fig.bbox.height - cbar.ax.get_tightbbox().bounds[1] - cbar.ax.get_tightbbox().bounds[3], + "zindex": axis_props["zorder"], + } + if legend_title_object["title"] != "": + legend_object.update(legend_title_object) + legend_array.append(legend_object) return legend_array @@ -399,7 +268,10 @@ def _add_table_lookup( """ if table_id and not isinstance(params, ImageRenderParams): _, _, instance_key = get_table_keys(sdata[params.table_name]) - color = params.color if params.color else params.col_for_color + if isinstance(params, LabelsRenderParams): + color = params.color + else: + color = params.color if params.color else params.col_for_color data_object["transform"].append( { "type": "lookup", @@ -492,7 +364,6 @@ def _create_derived_data_block( data_object["format"] = {"type": "spatialdata_point", "version": 0.1} elif "render_shapes" in call: data_object["format"] = {"type": "spatialdata_shape", "version": 0.1} - marks_object = {"a": 5} else: raise ValueError(f"Unknown call: {call}") @@ -506,25 +377,24 @@ def _create_derived_data_block( # Use isinstance because of possible 0 value data_object = _add_norm_transform(params, data_object) - color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], params.channel) + color_scale_array = create_colorscale_array_image(params.cmap_params, data_object["name"], params.channel) legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) marks_object = _create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) if "render_labels" in call and isinstance(params, LabelsRenderParams): data_object["transform"].append({"type": "filter_scale", "expr": params.scale}) data_object = _add_table_lookup(sdata, params, data_object, table_id) - if data_object["transform"][-1]["type"] == "lookup": - color_field = data_object["transform"][-1]["values"][0] data_object = _add_norm_transform(params, data_object) + + # if it is a hex color then it should be directly used in the marks object. + if not mcolors.is_color_like(params.colortype): + color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) if params.colortype == "continuous": - color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], color_field) + # color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], color_field) legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) - if params.colortype == "categorical": - pass if isinstance(params.colortype, dict): - color_scale_array = _create_categorical_colorscale(params.colortype) - legend_array = _create_categorical_legend(fig, color_scale_array) - if params.colortype == "random": - color_scale_array = _create_random_colorscale(data_object["name"], "value") + # color_scale_array = _create_categorical_colorscale(params.colortype) + legend_array = _create_categorical_legend(fig, color_scale_array, ax) + marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) if "render_points" in call and isinstance(params, PointsRenderParams): data_object = _add_table_lookup(sdata, params, data_object, table_id) @@ -534,11 +404,11 @@ def _create_derived_data_block( data_object = _add_datashade_transform(params, data_object) color_scale_array = None if params.colortype: - color_scale_array = _create_colorscale_points(params.cmap_params, params.colortype, params, data_object) + color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) if params.colortype == "continuous": legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) if isinstance(params.colortype, dict): - legend_array = _create_categorical_legend(fig, color_scale_array) + legend_array = _create_categorical_legend(fig, color_scale_array, ax) marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) if "render_shapes" in call and isinstance(params, ShapesRenderParams): data_object = _add_table_lookup(sdata, params, data_object, table_id) @@ -549,11 +419,11 @@ def _create_derived_data_block( color_scale_array = None if params.colortype: - color_scale_array = _create_colorscale_points(params.cmap_params, params.colortype, params, data_object) + color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) if params.colortype == "continuous": legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) if isinstance(params.colortype, dict): - legend_array = _create_categorical_legend(fig, color_scale_array) + legend_array = _create_categorical_legend(fig, color_scale_array, ax) marks_object = _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array) @@ -588,12 +458,6 @@ def _create_raster_image_marks_object( } -def strip_alpha(hex_color: str) -> str: - if isinstance(hex_color, str) and hex_color.startswith("#") and len(hex_color) == 9: - return hex_color[:7] - return hex_color - - def _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array): encode_update = None if not color_scale_array and not params.color: @@ -675,7 +539,7 @@ def _create_shapes_marks_object(ax, params, data_object, call_count, color_scale def _create_points_symbol_marks_object( ax: Axes, - params: PointsRenderParams | ShapesRenderParams, + params: PointsRenderParams, data_object: dict[str, Any], call_count: int, color_scale_array: list[dict[str, Any]] | None, @@ -759,7 +623,7 @@ def _create_raster_label_marks_object( ) -> dict[str, Any]: if params.colortype == "continuous": - color_col = color_scale_array[0]["domain"]["field"] + color_col = color_scale_array[0]["domain"]["field"][0] fill_color = [{"scale": color_scale_array[0]["name"], "value": color_col}] encode_update = { "fill": [ @@ -767,9 +631,18 @@ def _create_raster_label_marks_object( {"value": params.cmap_params.na_color}, ] } - if params.colortype == "random" or isinstance(params.colortype, dict): + if isinstance(params.colortype, dict): + color_col = params.color + fill_color = [{"scale": color_scale_array[0]["name"], "value": color_col}] + encode_update = { + "fill": [ + {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": color_col}, + {"value": params.cmap_params.na_color}, + ] + } + if params.colortype == "random": fill_color = [{"scale": color_scale_array[0]["name"], "value": "value"}] - elif params.colortype.startswith("#"): + if mcolors.is_color_like(params.colortype): fill_color = [{"value": params.colortype}] labels_object = { @@ -797,7 +670,7 @@ def strip_call(s: str) -> str: return re.sub(r"^\d+_", "", s) -def _create_table_data_object(table_name: str, base_uuid: str) -> dict[str, Any]: +def _create_table_data_object(table_name: str, base_uuid: str, table_layer: str | None) -> dict[str, Any]: """Create the vega like data object for a spatialdata table. Parameters @@ -807,17 +680,22 @@ def _create_table_data_object(table_name: str, base_uuid: str) -> dict[str, Any] base_uuid : str The ID of the vega like data object pertaining to the SpatialData zarr store containing the table to be added. + table_layer: str | None + The layer of the anndata table to be used. Returns ------- The vega like data object for the SpatialData table. """ - return { + table_object = { "name": str(uuid4()), "format": {"type": "spatialdata_table", "version": 0.1}, "source": base_uuid, "transform": [{"type": "filter_element", "expr": table_name}], } + if table_layer: + table_object["transform"].append({"type": "filter_layer", "expr": table_layer}) + return table_object def _create_data_configs( @@ -857,7 +735,7 @@ def _create_data_configs( call = strip_call(call) table_id = None if table := getattr(params, "table_name", None): - data_array.append(_create_table_data_object(table, base_block["name"])) + data_array.append(_create_table_data_object(table, base_block["name"], params.table_layer)) table_id = data_array[-1]["name"] data_object, marks_object, color_scale_array, legend_array = _create_derived_data_block( sdata, fig, ax, call, params, base_block["name"], cs, counters[call], table_id, len(color_scale_array_full) diff --git a/tests/_images/Labels_can_plot_with_one_element_color_table.png b/tests/_images/Labels_can_plot_with_one_element_color_table.png new file mode 100644 index 0000000000000000000000000000000000000000..d158657382197c6fae9da9c45e8e662b68909daf GIT binary patch literal 37015 zcmb4~1yEg4*PaQGK!D&9oZwD?;1(Q$yF+k-y9Rd%?jGFTJ;B{wgS)$T^Yw3M+G%In zJCg};;oN<;th3hpJ}X#OTJ!@P4jcpo#0POPA$bUhH<92UE$ln+lcV~r4)7m`y|Aji zf|ZfIldi2Hgp{tmwYinO`42rJM?+h?A6Ayk^c?g|v_vNM_SSZs3=9_k^B3r?Y>gQ{ zNkh$pi@diMQ?rABK#+d@_r}xd7YPJJB(%5?zoK*MVVcuV^y&M+jQKPJ1=hEysA8G^ zUrpX;zC(_q7YiaH_US5qMwV@)mXZ}Z5#|?07Jk!OK&e6x7ld4hN*i<;FDqE!EerXn zb>#T*8CDJUM{~+DY4ecX$^9qhouSm~YP+`lmL2!EYVn5X|9MFYDNVkWeSK9(p}&!P z{o*sc@K^Mbo+`sZWN7b}7Vhkcm*v}*77;&wXL?7S;hDIWlTn9k?f2HxS;?SQ`9 zh~T5Q39Hoa9T-kwV|)D27mCGDXYcTzk1bKVldmv*zTH4lq{fJfiVD#8@bIt)_oTSc z>UKjcjvB%D>>Ruy!+i!lK0Xenz0=yfFY;4>=fnN|M4Vo8x7$15}$_!Lr5uh7IzW2Y(BNgoK2LhxZNd=IV+r?s}$F1LF4fHkMuc z(Md!^q)@*btZ7VoI^rKNR_Ei!ow;TwhU4So8mm0CUGdYRobue3=z^>hLs|B`3XQf;BKQLwBs@by#!66|X)6;Qa zj-%q^d#u`@M0Q5f=wxxh1r_9=h5nj1IUEEK!J02Mj9VXW52qY1)D|l)&}%gjh3FN& zy#V)yhKj0({L!maqaNqkeQ$#7`e;!!f`CU%TzqXPiTM{UTR8YL5?Dyr*7Q}6hYxBt zdwIWQk0=#X;f&Dm@P=Y!c>5C>^~I#5x)&Ey=Btfk5)uNxDOFj?muvI%L=cX0owWGU z4%+XId4oM1oS2v>udHF!dWC6Pn+(RrWVbE(`1BMU9^M0P!^;Z-d{|&}Gnc==|Ig>U z9XuXabOwg<{gNghA4qU;6r&j0ZhcgA+~a1o-9E&9>z=FBx3RYVGd*3axBwRQBLf2i zCWH3S)xqqK=^_lUZRl$&z;!Y%z($XWjqU10;u~71H5)gr{W>0G*x~mc0iQFL(_#M< z9EOXhn^k7pO)*q7v>)Jv)lO;f^S^;s!+xMi><`0bySqR(1cd38o{{W}~N}p<%3ChYwt-)Lp{gR3Ll&v*V#^y4x{FoyB4g z*di|bh53C01MB@186|t`RFsse*u`*t6S)$v*JNnDM5R$FBc-DYYjb~yPDwEvUZhq; zv$V7X>lg*zIlbM8U^buo%*4!mcQMLWsMGEtg(U;VFraDyClPOm!)7@YghF!r&lkyy z7(OlF1Mc}=e#ZIZ#i+(c-G744wBNJ{QE+guW{Y!W7rh~vwkD?&?G8x=e(?IsTAA!c zN=gcWjE=6j?i@od73+WucGO$0Kc`gCJ;2H8`TTQxG{frlVIYnMY*me7XQNMpwn>KNR0e7RSuZLb0zc<`oiLfdSas{8-Iy=5_6ZF5&@ z(s58wYc;Qw{x1B+#>okWh=!)PE3ay3NRpeI`&(`XyA3fKh4h!lqk{vD4SpX|apJQv z4qogV!m5d?H>a0ZIjejGc{d73|JJuPvkl#hr*=rmG+C%t3ua07cuL?+|7t-%K@1!pD3pXH7)%)BULULCN&)I7>ND1379kvF(BS0c} zT0r=wAF1UILPJACSZ|r)V99uD>n;QgQ>g4|v+x^URdsWEW8_!(`1-zKce^$Z-T-Gd z+vQ?=rm3{MPjYy3F^TVVCFt$DGYGNfcyNXuhYliI1_NHq1*3Cts8(x3*(5QMyew#( zu$K>%DhQ&r*OmEyw@@!l@r=M0rPDH0( z^9Mv2a6E9sms?z7(zu)^s*R^zX=cdx?3olEM%Hf#pXu487N);=-2OA>b+tq(oSi5t zw}!j+CO}-GKC+)s^jQ`dgUwy;QS_q>VK=2^zLV|k#iuY94b?0T8rbYq#?^2uiNSa) zgbe-q6kBSvOX6{3Wn^ST`1lz@M@L5_9PdZzqHpMlXT^FAe#T0BSH1^NjuM@ID- zmZ|xdtnY55J87RZRPL-wm^6jxvKGEDB12=mB;K)yk08cTl=(f6^H|StD&289k*J(k zDjilzD?8-f?iZIwr=<-WXSjo~`);|}$+$ZNgPm)3X@Or@EV}FFq>S+!_c1xy9{CAE z+F*qW45PI}>X=(vZ*1x4?G;9p{N$$oBd`PZ{ zM|zIW=M^e9Kd)68ikp~FpuMq~jUrQ1C6$#iHR{X@r&r`X)y`>ppLu^MYpXF-yZ&V` zf2`V`5k@!V1J_^8c!@1`NhtnF_hxs0y0@jpCxn0W>Wipn$a(RvDcxF$*DrchxUw>XhA>LxqPfO1m)f3EM$E`)zwxnMXbCSI3N(ffwi{=xJJEDtPC`Sv zQ}8ra`@ccv>iNW$fSL{s%w`YxdSxScSg&2u^DaM8Yg-l%l%>Jd7{=-V=GzxnHH)Gd zRFcToApaWdXLUT&Sj=X|O4OL|Z%#(NppRX9==`?!&`og#zR`w306;<`3 z1Tm?}j4$*C^8{nMMXQWxZuMF9?vAkyF=5d{W&COSVu}B!@s>2^T$uN!qDn;J1G<=t z=AguSI~K2KG~H?vG6W%o=a@pS95RbU5Dbr`adCJ&vV$}a`fI5&v(37Y z(NLl{nDXPLMn8Z5O8Y%|2rvaQdV0imJ0pg7=UWB_1{L4`LT-Yn8Uqbj!!$Z~-B?oG0H;GWUBX2(no zI`@?to~Zk**KgEDJr>t*&_2fE{LWi8tj(DQ!mrikpm5Ze0vy z;V7&f?qDmD6F5=ga2yx{yoIQ6cXf?g?i=PidHUjL%xc~{Pchd6jWrIqa7+{=FI<($ z`Rn%R6r<%0WhoTRZF>78u^HDveP#jpEf3s%kh8QY#uLiO#-DQl*J^Y~-BdQ(y zSuM3BC>Zh~_>rw0obnuIzi0Ju|FROaGCb<+*fqefk|xjnhpJIlN>26gQwpn}lvI3u zJI;QayWMY!W{+%S`s%7{akN^*gE_7?UrkMo%=P)^e!MwhZ!-U4T1Dp!WLA?!N;H?Q z?u{daZ}|(xP!5-WP;=^FvX-E2Wz|r6?Gm9bwFP&-HRw!O+Y3$s(SMDj7gK@?6SWPlRUSD8*7^N^HOXn%bzxF1SchTcKqO~t8o+E*}MHK*ViK-fT9Jq zSV)u$`c>EGY+}(rCUbg%L>U*K>tmJbLP| zI>-X8&o}YQ(Lf3EIsg!(a3{LDx;}EoR?(uNq3K&gFP3Vs;o;*;u!r)1GAUmsgML!2 zgvD`|LAAmwC@9Ew)bny&)KEHK&DJ-En5Z5FUnroBY0P{U(eTrO{rC4yqHxpUV8FZw z(5tBosEFb^s*}Rh!t&P~(nbVdT*tMeNoVL+jAET3mYS5mz!h2+EzG5}+xUQdX}sOj z6RhKWt6Tk=-QgVL{q>QAvokv=_)65Odx)6O$R$5Z>PRJj2?kXkDn9;jo>WRuc=+~M zrl4fHCVGA6@^TtT))_&h#iUd3N@g+p$nE?Y1qJ1De|m7!HE95pSxKA@rj0ucnhk$I zA)~P0kjo}Ut)S{O-lPGa9KgDL7;U_xmGtekTbR1u7?VVif$YqkNCYua|RVQ!XBsNVILT3BCk7Vv2rOfDXE{s!3+wf zqp{s7NVY&)lEiEbj>yyfmHt|XKL%}z&PQu zOn2`?^Z@K8y%0^%cBf~+^t0Wr%;NRM%QN}r4SP)C46tmbZ%_5_`%1+l~!B`Pft%!>WDfzvZ|D6 zu7T=Gw3PlwBr*m@_t{2o|KQ-p>00OI$!dF-i>Rn5CavlpP-TfpNNn^HdUnmu&X%}h z4}zNRwJK6;`^n)8gGA3f41@~~P@^Tq|A=29DunIhsoBLFD%NT7>gi@8uCki^WT`1# z+gFQT1d~=4>0anL-<6e*fG55v6RvodH=WIeCfU}eO%ap!BY9U5gGa!hP@@~w0bCTz zcqEmIEl(b#j-aH2%lLUN9xS`=rNk;m4QY#HS{uT;tZ}{{T{#7RT6BJOUUhNzbw6ocyPScv(;5K%xH#o-LQs8U6xRpLNX|rKgkHn*jI_@`*)&fQfz3!Xi`P$I50^o zSaeC!GjhKNH~LE3`{JwSJP)iccR%bbPg(l8IA+y~VlCnC$A>VM+SumwZlKtE)QE}2 z4?lYQa8Ks38>nrMvNXSUYhX!(si_xhMK2LFyP-F4tU}acIias7&!S{{oPN`S`^3>C z;J$@@yuOy1CL4-z;+$ZQdcU};5+6HqHuO|;@e@Ln-xqFtS30J2R6Z`S_8<;a{F#D* z?Do5|R2Nz>Ffc0~4;CvfJNThiku`2_sAA#fT5Djv7L1aHTHZhP+ zVHP<18qi@PC#{x0A$)Dvfijt*|2jTsF%%(7anO+J9Qa_zoQ^^gE1GMkrJQe!?tx6;A){FK8KrzC+Q92NNUoelK{r7PDyQfO8m zAD>GA((?)Y2q80liDfg4#`^T{%PHYX>qD{mZ>E2Tnes;s)B*__Qd7DHLSO!la(D&) zB*=|26Z22^Gn|)x+ZA$UYj2+eGA*+3qt$l8-(6?oG2|e?@&k#HL^Rw0RA_jd_CaJ4 z@epKeV*B=-Ki%DvSS{2WaY@ZA;K`x5JBK#Z=Mnr}n6WQ;K&Gd@kq@iT zo{7mH)V&GQnUA^8@5lXXVDKz9ACkS0M8D!bAW0HpO5mOup#}+QZCk&UMM$k0$eG2E z*6LcZvyGUd3U4FV{5#LKH>6CRV&&F|7RVJ|FT-I}PMm||{odED>K9Ax0ddZ~q^(`S zm#r9ZqH2A8nj=!{fuR!EILK1W^<%ceIoFO+%~`XSGU&Xcg%OVyN#|;aaKtK^aFA!U(o*H! zZ5Y$NYc#3Ng(>G57aIHJVkPQMlW<+W@B{f&;f}W6kzh33ob#32`UIk~xZ<==-`F3M zPfX7UhcRQAwG;QH$&wAx@r5}GA$qP!f>r^QUx=A8K8je;y+@T@0AvL2jLVZwhZZNHJ~$kugf_#c*P~45AQX?}hI@EN;FjE-H5q zM)R59-c;q%((fc=W~|7=!uq-KewQbZLqGd)+HuogcIi@Omb*um*5zHpS42wy!Kt>M zpL6mN=c81GhALIU){2dGUlZS49jDa||GW9L2ZbM0y|G z^>3x$oEHlQ^6GA-Gen4{pA@QopZ`Q%3uo*wZ)P+@EVkIOpN-@d>r<@ENG>+O+grcG z$NH$n-E3xc)=5*GP?`lRMrMFv6no$!gg*T%i5Z+=PVXXCxiToO(=$Q5t@Bawu7DRv~4C~U@P9lOYpFs)7QygyM2 z4ubt{W3$k=g zYiAV#w>^}l{n%@JH6?ik=DWN6CsI=Ft&VP7hyq1Zfko)CQa8IM#}6VUT^Rm8TgVm9 zK83}*J&|5J*3`X2OPI3o#DY-i z{aGXXB8|EPXbt{sMRdSrImPUF7U4g^&L zwS$7_!pUYD8k_2nW1Y=T@7c(2vQ%~F5y3Qng|DCa;$WdM*-hEKujD3$8lh*IXJmIh zB+v*6Q9IUv81)vmntPTx3=f~_bSz8C%c== zr$s)o@H5Xk-m*`#ad}oc|APIAB3h}Zk4Q$^bR^rX-mC88^>y{$_sssXa4#$NYyNBs z&wYV~L5@+S;avva^9FPRY8lZW)74|E$z0W&&Sws<`>=hrZqw2xYm{Y^oq2yPHqZJ~ zL`&?}5>c|Hy$A7o;&Ca42L3kQdLdJ`Ku-4JT8y66&+p{WUB-+dKv^ZskWv?J6yi*@ z_=6jnt29Bbz344GW`*t6H^-9|3-?=cONW0sEl*FI*s?h=WO13_ zlF7x`#5x~dqU;ag3HJD zH#jEo9Q6gLdq-TcASjBDNEOwv1~d@TXOb_E#^>8pcMu#X9V-k25BB}m?u(K?2r4@5ts&cMVTD-#47Z}y zkj#RD8VwGr=A+JO@|hzTY5%>P+A}SG2#MM4=o3Lxwb9jWBqoM+T#DL0|Koqk| z;dWT)>poMwMDYN8(<-2k#53rOfZ~k9F z`@xEx0TvPz)j!YsDU^%8jqh&oXNZ1NEey&E3KDZ(Ca7^}M`PbHedbu|YHBF53e65t zr^17f_wIU8KF<36=W!gy=TAj1*X*uH$8B1EqwR__O-09}zzqGu0DN^um0n@V=rXbG z>5OGeC#?o5b`p(C!rgI4KKK3&X_%&fBrAHMn2@4RasYi8HUT?g*si%Y_K|fd#9_7e zmb&iM{&Xm_@yKV}%|7`ZR8&-0IBM+h>CsW7FcCo@l+Mr3lTuJ5e4ES>M=R55mp00C z=wCry!I@oiIJ2u)T_nf-v_$W$&(U02427M9PgVJ-^cDqs{e>1%cv9IHhnt_d-cji>O{oQ@ z%Q4>@*d|8FXF!O8&OH1E@8hLi&i2^c^5urD^z_;8Er4&)k)V)3W|NdYVi|aD%ga7V{uR>ig^(@a93|Hr!eAZc6|PvN%R(L5@=Y; z(sWE*Q4exncLk$?=;E){?6|hOD|WKdn#AV`%nGMEQbi;D;@Jb2gVOq2;7;@b9s1uN zZ(7X;WF4JVdBe{VUze7b`v(T79k^*|;DJXEzWw02Ds|Sku_El^6^ur~1azOyRo*t< z$Gp4of^%3{giAM{v8Fsxn37?!=y3lGOQREy$&E6sjm^!z5>Gzp9 zy)tfh_oalA1Cw=b@Y))enqd*?CBdZP=55z}h^q@4$HZ=!;Tyti{4 zJ9}cau>`AWe}Dhx&dy|ui`~-F(&;Onuni=l+lPmZb-j7~CiU^Kx?>c~RwD}{F0Kry zKzhYJoaLr3*&gmr@NosEHT!seF~N+R%?Jhiv0_J}=)(68yur$}Jan2`eSPLF=OjPw zsN(YIBF|NmYJ%+4-tTU5Dd;dUnK8KcHV$R)N-mkJR?%K_Eb9kzZf$OU*6%?GK*07< z)|kjTe>iEU;NnUF68i*C(r^fNFUw+rfDqB}%Z?eA1Tf{%}2%#)UMA(zjWs+bb$(4;dWzLXSJ$b#BKCmY&4xmTuh8oH>uX+$yHNRb9bq+ z`jeETB*MAHe4JrYV&X^F>%$)-bc5YWM+1E#8%LH$P+!Xv#`lIiQPRGIBZTj(n&JH8 zyy6M^IM;UWSN~(ID{utr&`eQ{05OXMMSJ>y^h|pK-s)`mPNtt)lHsBSxLdIf$uDH? zBi)D9hT(CbSS*rQRTLMB6}~)gT;y~-{r8t_4wxb4#3UpiegJd_*dZ04hL;n`h`_y*adW5k^@#x$uuf}o zzV+f^b2{A#`{)~l9@;A-z8aTURRk-}aOO7ft~ynJe=CHqE`)4fG0NevRkPJKj!GeK ztkun_$$sy3;IE)gVdeT4L$y(y=_X(-mP|4JclA<5x2>Rn667$y8vW(i3)2cWR1;wK zuh`~!eCXD<^F9>>BN>k*9s9Jp30aroxGza*5h97S5r}trIUX*%`fWHJRe0W>!MbwK zpomhyq&Vp69rX1*x@ViTadk8!Jy<>W=&;q{(h+oPjx_dlFDZO+U}lLAqKjan&U$n; zG&GFcy;?O>G@z!UqPjeojp*nQ@ZCYuFVUx|u4qkAUxb8*aRw;lFvDHXltpzKN5i;gv7i{t6Mc;T z&!X2J#3m*6lSFX)&<+Bp(s!m*LIz*i2>-u)3$=ES)=#70alr0=Z=Zx&Q=8wMElW=) z@OXRrghKmr%y5lQtFMqrguFDBkf3v%9~4MOQed)$(zB-FX4XXN%;9?B<)l-#rDHTY zjBn(I;waag#Z;N$$|tR><^y;ryX_%t-lt0i%cX|DVYp6@J1iCp=!ArX)o+W@w94?=u&n-2M-4$%9`8*LECVl<_GxAF#t2k-zY+Ni4^Q?{N>X* zlCeFfW3^-#`1UPISoq@Kz5U6G&%Fmht?RI0rmaw|7*hEgJSnaqgLR);vLCw(ekk4y zStw~yr0?H&FSEUTkq}y#-t#l*ASlhE!hb-E+%Hf8u@d6tafeSLO{2w`5dcois=d+~ zylG0s$|$I)@&lZJi)#c>BS?^ePT=u$UunH2u&6GiLK#LG^2J;=!e-;)ce90DrZQD^ zSCL)sa&2~g==`;bCkYaGnSlzZ<`?!gvC=xnQ8V^43e>Jpq)&})PZQvdOvAIif z5izY+xm&3|;Ll7I+XhPX@$vE1K-7oFq%F8q5Am9#46&Z0$WqTKzJUO8pX6Qbf>4*n zhM-J_xA2PniCP~PxGt!IvW;(s`F_#MNz}7Cb2_V}pAsC}Kto=uF{EHbrVeQ;BAQ;l z<+SJI@%i?re_Af7N3OyJOc>jVH-s`4N-YuU`b@IulSn4Y;EkLLH|lsn>YUSoRaI_? zAX7u|v5@l(6Nf6sTwSh`@SJ|Dd0Fl7K%eg5Ilj3@BRrdo3X`Q_OiEgWy5hLScdqnw zoZy&Z1t}~A{>*Rap<;IRpFJei;d+GM^hnwFt~QQqi5iR;QGl`lA|x*^x#=AV9Ab^N znV`OfM0O{8XqFh#s+hW)yx>%21s(i0;A2|YtwEYXkf6%t}*uX#$|Msl(+ho=i zUsNZR=41ay->P?dTysN0uIk_35&qKp<|v}wh$ImIiRug|G_Q1XsWNn0_}#_n7;FS0;;c=*XOI@6Kxa*Kbb%Km}ZXUD~N658}?`A!%IoC{sH>$L^`~F_w zaX6=!rmWxYY`&SguxUPNXOPG&|8DFgvPKu5rt^n6OsBguK)4H)=R7qP&uBD#7`P1s zmunz2jRH)jT%IIGZ^iva3$TMd;2ntF$$X^YWEOp34FfSF6o3-SC8~eHyB|M)hkyVX z`D?xCwCbJ!p7CnA+O;225<3>opLED~sA#8b&i`moO zd_G~m@qanpD;{L`T%T~~(27Zq?|gXC)&Qgy+1|QTp44MHpT3OZ9S0@)6XvKfg`&xD zjJ9*A)hNSnS?Yp1+i4MMxEA}3o)2K{MN(J|1L6CIhYe@Tw8(s@IXF3ix)Slxhx+My z(aPit4gi<+#U}G*2vgJ2?f}hMDx19!ECn0X_;|fRP^8E0bY{SGBFwPvyVL$}%&NC< zq))hf)=uvP``U_YfJ??>;GRLhzkjG!Gt*!B*ZAW3#r3U*f50iP*yW$9VvM={9>G+KLB?P4FhxWx=@c? z{(gRAjdsSYmP=x3oDN=9P?Q*i%q*v|Yd9MAL#ZM$jodtB(A%anK-g_0=y*`MXsD6%@e!6POUTM1`w+!qI~TGS$O8%l zi$S}knm>k^Brqo@hY5;d-Yk|j#pHt!$k-*^v2P`jvW2?lg*zj$9+G)*=FTp7V??+h z?p)sD-9LeKs3yw_aQsY@kuB22@Vm@k!tUjF!qsLXB@q)-Qj?NK-f~adRy!CoI-WMBrJ-@GRv%+@9cz!;dV9 zio#F!TX}I6`AS=}RvMQ2jhfZM=*sZ$`*sMK1N3iy%POuFM+X_&hd`1!9QjG`m4s@r zUW2r1IeP~PKhm`|;e$k=KN{|iW!~Q1jW;`40i;h1z?VRqKQY3Niab|QpkPGc0N6-Urm-p zeZcjeyTqjnAr6;DWM>b?L_?y)krE2uGrY`djR_6NWVoq!gD=tJ=GIE$Fr&P}byiMS z_4?GwxxQ;M$ybXb`t^_0<>$ipwz3@SJ5ybzhE0UD!V5(^LDcQcu1S zl88E*S+9TN1=gvl=H)2GVL;PIc<+o;i$c6!Ffle?%x3x*(=$PU4DcY&`#G>;ZyTC8 zF6M4|e>SW+^o+QK{2mK%zHdOA$tK%a^$dw%ZIu=a%)1$$Qc`nvZu+ceucDoHZjz*+ zE{*e`gH=Q?6em`p!4>e1J1lgecF8E;`EsqGZn!UX06pF&76Y*6Wd0~5BLDXGf+Hf3 zz$1xaOTgs+fxOjhR=!?Xd|Eum4yFugm>!?tse;ma=NHFbCJSh6KPPja8L7@@W>10q z=8JE5e6GO+Jc6+&g91U+QQvQ@wQViB_j4E;6YU7nG^@N#b{ArgwIk+sccChDS7kBu z{<_9t?HGW7oRgPVWj@bDuhTXZOQjHLm;|IHLdtU}Ol<7_0=eu&W@E%v&les!Il05d z`UudF1YtCi+7I%YBsMDohy5vCP_l4e&*?t`<|lW?KdycO+PoHpb~HFM_h6E=59S4e zfnK{|qs!`MHGiC)>oj7AP{6)o_@ulp6LYFS7)#{K&!mGptT_+5fP*`g{-~<45Q57R ztYAvc8GFXzju}zxE!{#_CG;HwfVv(oHO7DtFj-|N0WoFD0;qq3o?qA|wdw$il>iL0 zL<0TW-<~heq~zpGpqU5=-_ii`0h#1?P|du9uK_CfE5itMBx#_#Nh~S2WFI98i0kd- zh90)qd$%SqB(U!s7w9^t)Y)79i%5v67VaWt%lEo;!;>9gdPH$c)fbI+wpbu~eB`lE z4l={dQtuii3qtvzBN7cSHX!~xNQf*_i;RrE_=~WsZe)z@6vo3UDOpD z5zP==UY^NiCrpX^)*4oZZ&45h1)jJ_SV+icc@g6%Y+`Smgk&W!0RLLrCKXLZMMcoM zSP$sx-?~4aU0euek4GjZiUFbvNQ;I&9E~1NoJmPZfD-&YZt~5Ui(XnmITdY-u8x^h zT<`3!dkLRQG&cz(+!i|K`O%thUzMc&qN5SpVO7b_pA|cdJgUBgpk-HdwRr5OCEt)B z)x^t7^O-WPKdYW;S*u>37wQm63x4q6KBT{Gw!Z^Q&SE}Sv1GT^O$i!!42+DFKkh(( z&H-QNmaT1X8})gz)m;wC7eI?g-_q@IYmBC{e&Y@q?>}9R%1XT04iVGqP>PPWR8E$T z*L^7Og+NEC1QgTRU9?3PA+;@I^>!dn3EItMmJ(F@M@(G>0lj=?Rg9V9B1Y-o=O4*j zTUSm`LM9SXce+?TuoC1++_MF zvh=)T8?7By{@eA*Fy;LXy=`Xqnw=` zl{@vb*|Mlqi=R_mUcjT<%w&kTfqtT`F8Ola2X4QkQe>ip^L(QYDs|CqZ z_qjKPlCq$cIIDq)F(RGEEgIn09ZY6`R($Q50=b`HGEiy-3*gk^fgHrx#j!V2iVIv+ zuLawMCEPw)H*-U-j=sNbDGVRWCAD|z>gVFFo+Ps&G;MZ>#B9;*r0=t z6|jfznT>`%Z!)YL&1DM0%#>+Kn3zz4XbYGiwcTQQN|F58>a9cU>ip7y^=9V{TvCbC zofC@0+X>r|jAm(VZQa_H#hJ$RXyE?mg?%){MkM4Or78c}TZxunx*8i#tN2){RH8`{ z_e~f`KA>ZOn3FRZ42My-!w=O)`u`%#I`$5VoRN0`hV-?O42^(bWR&kkbDOw{Xcf(o zfrlpzwDX;VstR;AjG|9##Q&Hr!#`TAH@@5*2i*wGU6#E7^ZE=t7vRH%D;JZ2&-C+y zel^VdRsli`X1WJh$zk_QfB_r4YR|HU5zpVqm0|>akd<>RT=#buHZR@~U<$A`@nU;x z&GuRtZQkD9DVYT+QomtiGj6&v@pj^21Njdm1;w~gNnnY%%jjB+f69F8Ma}%IQX#Z@ z&3X0@*{C(Y8DT;2v6R9^6!GfZ-s`G29A1?iiGi=oDE=m2Obaeb~QZ z+S}tWzu!WJJ$;WZMOiM%-$wyA zUQst=XuTog`(?aP3BBh)+`jremN*EKY{Ku~4H~YFuwGUzEd-S=?#BnF%@hw&(Y9)j?v7`x0VS2t{Zj5dn$~|}6K(u16x`Pga(?H= z2IW1@Qb8yei~Veq66|2v0R6MtvB#PKXZ!DNOH0L`Lh(`Yoheq2eK2;OYeVzJn+7{- zn@t0}$cvehZ(hp{fa-rX7iz@)&xP@_)Q5vul?V&3Oc!ERIGuz`i<<0wSf`1IZ30JP zQnJl?p{VxuX_sSJ8@*SXw>s#utEq&nQrJ0gHEV`RG;1S1wf-784T#gM_PvD$Rzvc=*tzVx~4}3SyqM7}OV> z$^l#i3x5qZrl30`7|`P=TR2^FKp?ph?{UjgNT9O+${e53Bj6y5$lKz0K582v*j#K^V6Ff@wB?BeT%G;ziSelxn>H78355lv<6%_g+60tX7T1at>?s$2J< zr241U8)v36S!(;V0J>Ly@_8~hvl4z{cnB99^lc{;l`S?|E~M(zIo7Zc0G6~+sL|Dr z@shU8pB#;-3G}P~dI_&1t(h7Z{76|?LNNxNqBF`#sF_+O?g!`UI=jv*W?h$^v>?T! z8?3iEY1-%i_M`Rp8Fh_NhLQx1RO`(nwzMpN{M^8UbY-SNClE~`{mY&^=#!+{ICnLQpkwHPrrDTGTMY(=VK0!_Dg>5yn6XUPJ zQE?+#%VJW6V5W>A<&R533|H6bzBR(bLY9VPRI-*f>-n$iOac=vqPfw9B<98A3Fbsn zjXw{Yek6>4;-E1;uHR~Bu0)YYWLmOrfJIK z2ZqWo4Jq{aDKod#3Ka;Be2~CK=|by&eB4MkMT^jjre7j*+yJ<*@ihw=+3~99`SA!} z;++O9u1v;u-?SMZNWAhDu2j1<*`0h-*l16hL}cG{b2hYgmzz=VNNZA6ZtEg=S{1pR zz){zR9BXO(lgl@C^BDScCBj-*Use3n1~>D!>@ASMSxZ(159?-cvGLqf-R-krOYY2!vuj)3q!;={_D(M-$22< z12UyLd~lG7GN2G~4QZN&zt^KhMUyh#=$Q2nm%65&7X6;w>tnS^CV8%NHo#Kt&6qkn znB_=vjbY_&Q*Pu%cYkRwVQCH2#?DUP)1BHCq}b~l9@%&tC!O(ZODd_!`Vj-Tc+?e| zSP=`zB5tJBCVe!-XOEV1Kc}^Sn_}N9uG*XwWDDOyXSxnc2+K*ukk^^D0K2gnBT_$* z-gc|XaKk_m2HV9&83V~npmhif=H}eyzp?h#QB|&O+b<2G5>nELbcuvC0@6xKr+}n% zhqOqS2uKNvAl=~pT?dH1v5Z@ljx-xzz1bDxR43hKxZYL3k z{8v{Py?dBX{_J+8#JY4wTg?im?Z4WxIT2x(tN$)t<53e6YexC1wanhtfhMQy{D*yX zgTz*efvZ3ez1$rK%%SmLW9knBG9(DcrL*8E#dZ5D7e&;O`5}B`V@1n_>?zHc_|>(k zaVvjKM%?zET;ppUsDLhTeGj*V9w&gb^XT2j_m~vLaEFk#U)1J(Mf^__P)`EP#JEvlwuc&nS zTaeX8&X=_n$KPwWS?9$WM0Y-S6is}3jyEqFA5DCv*O;<;Z4lH{a-h;$c{n+JaBOE* zj2Zg5dynKI!!M|5b?~ctil0?|V*W&ElebQ$hUUZ;R{U#gqKo{vIc!-Q zF+4TleP=$&;9jp(xSZopfoc!iE9G93xOFq=ea@F6YLk(^%jFU;Vf~B@s}c z+S?$|N{lVWX_+3Vy_94j`Y5{7z~x4lEHAA*4(*jUx~yR;JSWXeR74SxOdh10klOISo?e}CTy1`S#B`!+wS@TsVx%FDTp zjEt=38>Y8dm{E-B(Zr>8eQbV>HP)(ZEZgbb-$_O{2_qMG^|z^cvirR>S0yw0)q0WB z;vf3BqBIxQaBi7?K2{iPKW=Fwh2 zzXuN0rO@v|xMM`2*>Gn+b!mAyG$P{5lVF?z{rUvx@PGoMKk77*0otgpV6p(Hsd(&}2wq7nPbF>v?DLTI_8 zZEzkHl{jY-$^%kfD?(@jqi28v8n6=OAoU^RwQB#rS7|aNc5&3B!Y*%N(Ph>6l_n?W zxn^G=_&#>Jlt7MwB!G@?EiY`ddMBZ?W4KOah(Tdf{fvxKkd*H{2m6d6SvxV9DGYoF z`HBh~BVXB}(fz8@y=B{tenhbT935HE)w1(V;>E=IZmR|~%(>h313uqXfI1dhYj?=W zq2nJTE{ueMOND5>3%PC~(L8#T0MkIy!J7eMFJICDM~63G*!4n9xB50fe}>DlzXXV- z!9iiRD$i=70a@Rx0x4|vNd?X;ES6_J+CG9Vsk0KBx(0K7+@H1!&yA@c+n!_e*5gZ! zZz}|Lva5myUs)hWK?fE2*OBbD&Qy`@Ox2C{o*sYUo1LW(s63dKjI=u=$-BVh*j8fH zhIRY4DJWr)B&DSfKwJlQZZ+D*|I;EJpAE$@sDjf#xi~xfY_ni`JMQ>sVq`s5*+<(A zuU3Ao0mWcm=k2ZCXOwoh5;GVX8b3>ubAI=M&fDvOVcv;~mp+NPj=Q$g;{dVs5VHbZ zle+vfS7P`Hsup-TQ5uJDimT@RZRDlvrBqS zK^6p1sRoBZ7}x{cTt!vKM9l+isRv@%l^ou#RF~d>j`4;ZNK44?Af)pGm4H zXu03_IXgoVOxv)F3e2<^`IY(WBW5CAyo-C*|?k(1Yfdw+M+p|14Vt2z7`{|ch(t>+d}Mr!e2y|c!}y}u;ic)CdUDtBu>bcx zY4~c|xzEQOHI{rVnTK7fMVZwSdhf!pa@X5TTJMEu6p)CGnu+q*sz!5%PAUwN&wnb_ zenmY;z1jcq18Vy&zlxStCtmC`PMqnrR3Tndo3tj{Bo#vapkeICm*K9t z)7O@ZhZQ?is*4zpaScI@_3-@yj)Fo{aN`IsZHRyLTaz8>{XzWRWo|AbD8*yae^}Y25H6x>tzQYENGgvN{I-2? zJ&)8ln1JlD2evE(iwuMk$S?lWYeRxRl7kk|Kh{FDm)eL@3VL$M>e&~+ElEx-0Zjfp5RPPqMbak{MtLXoY%wo#hm}|a0kUVMLWB#Mp#eQRf>CQya zz2&RvYWXFH^(NZLA3QIYMjQxNh#gliT__}pd|Gegp~aVdDx{E9S?OU6^Q`F%2{9DY zH*o(%BCg=wPxf#=+(zhxiTdeSzCy|)1fB_qE(rooYj}8gExy+mhOS#vtzhK-^`rX1 z;^HD=g#y%?)AkH6_)-zJi(8|b(5{2dTL4sqK%40SlRY><@t!8IJ#9y%$H6&hEL8c8;}9P4l7e9O-IOeHwzt1}6B znn9lOk3n5aULG5yn=cO62KYgk04+3b=mOqxnXa-Sf1dqpaiu2?#BHg#qJJ_ZhYSI^ zGNEg?Kfw1hCN{RU#UE9>#{OPY(`wCTwOC`*-xFN}-@h)|ifQt&eE{eLkQ-#uc>l9u z{0z32|H&|J_K~@smgZ5EydR@ZwUOEn*D;5@7V78h0MiOxyLa{M<9tTDgDH>l1u!l& z?jbiEo+!U7{u2A~W1pcA!Cg+8Tbd-dU4-@7I8G)Ix74#V!FcfB+a^!|oh3In7etg1 zze*x z{!Ac6#M$6NZh)oP{-jm0v_(y+?d_@;Ny(eO=!l406*@M#ub^K~dXV@H=WEG(;v9_W zc;{G&#{H=42L05exqRx@@rJ}Ft>-K2a$n~9Uo3~s$yU#m9NoPuFBXG46BeMZ4P{n$ zPd_7{PtAy>)h@kDOFgu{n=CO&1oC#?&&qzX(vh*atY#c+v?$}P4ck*<3lop zA<~aoT(}VW5O=g9K7Fw|CO-D5xWT<2lhi9?vEivvPg!Dp*Av{^(g6feg)eSF5q@AG z=o{F#u6oO|@AIF_;5ZFVm-+7B1o*6X0E!2Mxu+D|M^YG=~Y5AVhrSD8f4q`pVN0IUpCfqN140ZozUSq0IlAg!XkLLJM84j+C z)m@N$g~(89A}LbUiD^hZoZCH5+n}QizLw|AZ-8rf&2NeB)I=WsHPHq2wKnx7;qN*NCc`sITso;m% zySbSI2=Q4eKYp5GaB=Yi*iR6QDT7AOaoI*Ilq}Oc3;?jL9WjgksK42xh3nE%gOf(I zpCkT~8THGPZte7dtF^RcbRqFQF;}uT3&OK6@5RzlGU6I?3Yy8;EbSJ`Y)m|OpP^AD z6rZJ<%eHi2@;?Ys^S336Bbf@H^Vvevbpq16242DanOWAX2P zO}8*(90gZ=qEnmkg+;~fIq8|=`>7uWvuRBHrsHFc4mU5-))Zr#eQsD~t(|Lw|0bg++3k+MEA! zZ{o2!Ey#0eqoecc-$K71ndlj+RCBpgzZ7$MJ&#exwL!kPcN(%)=+RZZp7 z#PcFQLSo{7j_P;shQM%zi>vI7zB6n&_oX9R03iv2<7}n$D7yI9{vhFz1|`bi;2;7j z1;@9|@%F*J@w(401)eYH(Vq_oiq0KbqhE-pzfx1J)R78zz3uRQYW|Q&4UQwP3%m$w z-$fT12fMIniopidi*O}?9|hFOYp{X>IVC(b^>gh!NMGVC0ZjhJ8qq3Z2D z-_pl_!8%alx~&6fJw$U9u%+jfWvBt0o{PV8ayN`;eOK&Iu~`)~)Gx_A@F#e?*RsoW z-tc~LxnO|zBS=RgNka?f;B4AuZ(y%%S=ej>c`}dHSO~1Z3yX^?roQLcLz#naS9kg30TK37FNYpG|y(cZqS zY(M+8ht{N=P}xj?7x~i*?Bw|j zS1#u8Uo>1-X6Q6J|_2E+{#<*aC^JgGemH9v>w{8FYwVv z$@yDpa&{{PSWi55#8FbTJeViuB|-n<{iq~TCC#2%in8f>9!AXZ9og*K$p;ca85>bFALhA14ZUWAs=YV* zSituj(I0%6>QuZe;a*LgBgqe>u}}DJg4R)rwzsH%rug5lFLmhnxiv+hWT1##R&+2N z7nq6qc`Zsy?o1H-X79%;0yUP`sJ}VSGQaK}O=$FWYWx8G8)iCnCNhWwgSu^ zu;q8PwYAY+9qp1JhhkZT1ji9nM_^IVW22Y|xiWCoNb$aZ_KDE*#=&XQ2RWo*4VvU; zjtq@_vBJ;V`AEr?*g3*&Hj*msqxmowkKR4991d|WujHhnmY8K0&38nr<-YPSQzk)k}tOId~ zYV_mxwWPWvd_O{u{(Q(VH_3yFSy%jmtv&S^ZlHx)6nfIg4KhK-l zd@3pVZu{}cs%%Djn5A7EQeIulzz^!p7yVAk_2MbP6ktP=qLP;bxo6!pnv4IbN&Nq)sZcFy^kp>f_A79L)nvaXC@rYJF(dIQ}zC8iI* z^{>MBiifYxdkJ?E*I#U!6|Ne8@gWRy#OywM{=JLPNXuf#=1cXD5jGz>!}xbsIcN;+`8KWI=iRkW&?;JKCE~^FvbQ9 z4B`*sSv5b1cvY>U(SZ*QN(^E@-^*ocF_pXBAZ<#6rA)Uyy-9>d?#{;a8HHSpWdDgf zSDAc~6Td*%Gv7~-k(*oyV@vLsZeJ0rb^1;^8lgCL>SjD`bwAXX5+=+`2a;DQ6k==r zNza%5z!hV)_+A}S^N`*4K0kVxx(RA(csZ9qrR8}w5dl71sG+05=yGoWK6g?PPaas} zYU=8e)v~#K|3;GWB0#Y(!SnUYSrBl!X9s-`KsaU&Vr*xa2=`tc*`!tUQ~1odzS*u< ze3zzs)mfgDe)TOiROOFnt)|Jw7P)qUSmN#T@b23DjJ>I}IAbUKts6KBVsl^g9>Na8 zH1#(1FMW6RAC^(SQ6wqhf>04fBk}l6mo2T~UA;n$QBYe#-6am^{IkjCs}4X&KZW}c ztY2*Ra6U8L0r@PLZIPh7q_5Hxi*+e5C|(CwTZPS!2_VZ{U?7l({iyFcUV=IRkY7}K_DJy>kntJBv!}FI+Q-;pB|K5H!&y%wel;N$7kIPCsmFuTgX~4`Z zwHTD{`J4G__xdUt7)fz3x;&V58d?PHN|8%JN=k~+-`WBmH{Gse`C2>w@bH_62MaN+ zOkyr`nSzi~u#Vk;5= z))G54+!^VL42SS@*UBALI;vv-_ZHGSmp{I#sHfWc5)!h7Yviv2I4eHepSD`r4e|NS z`(Aqs!ULV{Vr^!Y-Fh%SH#bMOIn`T|PMl3vdQ=2gT5Ze)&QNoI6|D z=Ls$a;32X!J~z{n5{rNdRg-=-X4;L11L3vt9~E93b8SC)cEd}@N5DAYZ>v&x6>Z`& zwG_*D{OV=8uefO@oqP{Qm}-_HO)IJ9T)M9#$?UYzcmrOfj|PrQja2GhdaqEVxTeu? z3sK9NdpRt=3PV(T8RDpj704u7#EicQ4nm-bl?N9oNZX7+i}_Zi_djZ9l&}I5%>pfO z$@{l9F9H`XG$f>DIs$LzG}2G@9gZC16H=6nJLnXwNjtUhR%U*EH&9m%_UNABPX}+L zW8S;RrxV+VKQi9t<6})vPq^%TgDX9=<*Wf_dU7#K3u{vNz#A?IA76Qf92JBuXHR7g zG39tR!iIW%KH2QP7(}vnc$f*C=K{UjcW@%vht}Ko&r&x7<#rl84*h6fO)a(s1CRSw zOZbDPZct*v(F&nhg2uoB!trm^hEd-8GNmvq_Ls9K_RZteCg(J7nFl2{>vGPf{3(ad zPHUeA2ln?zMhf)_D5P9MF{<5WCE8%-+z+)x-i7@f`h*p!)z^*G!C?)!50Tp3`)2Xm% zg}2XR!5kV?Dc)ZC`}-q$x(Ea;s0t8nc~EWIPB2K6 zm>|Q*w5I*#nm5r?AOAN+C~h^A&&#zc&uCc07y9CThbz4aetTGM%+aIa77}dwg!6eF zA!`*pb=mX;*5rpZ_9~jxpb1S`@%bUSlBxamB5q2E^)q4?Fr?b1Ur zt$Faf!KYhW6J;aA-K+0;j9sa?m4vOX9CR^-3KI1j@nQUWUB3-X)2B3f>JdH#+#FK0?DT*dvpzBWFoO>^@EFVQ{dE2c9| z#zz_Edp!fJFAjGIE-$@=H?-I6rqoJqZ^?^s=qs)74L_}v7B;v$oE9vEq5JYkh3JxO zGM|{0O}qDVcVP&3fCVG@4jOyFW}mCj`Bd2j9qDv7&k@%}l>UqB{qPDqQrV-Hs4)lD zgCffM2mUU;6pbRkbH3?nksG{t^&ta!I2mLzc_o9?zS_SR6|JGkvaqr9;`nFAYLnt-R?swXfG7_FGOvORQx-oI*I(dGcX@ z-9#gkSwmG|WYe^1-1}4=kIyX1)lsZ=Q66ZF3O&W_?A(}XiqXLnJ$WL3=cC<>GH-0s zSYh%iDNwu#pAgJMuI0oR*yLssmI!_O#0}Y*B=+!;Up7h26@fU#y4F9sI`sAGJ`N7(3TV_fAqh_~7650{y{>j)HMjDdCpNKI z2>153o`w3= z=bKXO4MQ+nj&-#Ob$XO^<6~IQrdV9H80+z4bV&s?(wgp|`BPCQYj2--0x@i;Y5y*F zvqxympt#ibZ;^Bih2Q&o%ldyT<~E(TsjY}q;<9w5mWpJ%u^CW z`!4Kk7}7<#Z_66U>T7Meq&U1P8uK3F+2vlF{rW>UkG^Ik|zNjn7krWdT4~s*@?fApTerd6)rlv1_I5y@eYNZ- z$E_XBkxUcrhJvyW98UD~1K5*=q+!JE%`7uR_b9vSh!x4uCe0Q27THn7>1k_jiS21= zx!~i^?p(mED8!0)N5}k1WDP$%Vkao4h?Lsa)Y^_^{~u(UDAuhe;=N)kQ%$AX>*qCS%HyU$qA{Q(T(9WBoTUmxY9fn@pFPHbAY5pc=sp zxy>FttRI220ifv?=-=MBeVZO83=jcP-e**eg0g4dWhOjEKlPi|kxyFy-TM45fANs6 zjHA3~<=iCQn>;~X!j^lt#4iN-Zx_<&Q#qcvnbkY;-7KXKnQ$=jeZ2g8OSYNgo?72s zv7~Q#F(AQk0<-0vE~tVKh$#?X-;NeJxr<2tfTqOysM2G4(Et0@I<4O!ChmlTyvItc z4C1_G@v}(;v=6-X@{bs4IyP?uRCwz2!l7;5YGgq56+WWN)q`oVuxwCBixQKZ(6;s9 z(PZ5Qn>c&GA%S`=3jZ708gJ#7ikreYODkv1wC3Ih-n5_Vu|~46=CpaEuyCI2IkyE{5L zO_!Pk-y6sfcbnG~#|w#wcnN?Lv&1fj&i#%^`){#yQM*EIhRqaokE{K*j)aiE@Nkgn z0fqT{$SuzkBZ(Ql&b}^68I_k;64u^}TjHvu2tXrtGp72;qzTkyK-vLyVm@4V7l zA%*km(XT_NgPtK~E4*e;b6!ObMd2eY%#WAmz7$fi25Gu`VizC}8(+vP6~&bK&=fSgujkq$p!boKae^e4K)-@wQluh6OZzk_rhX#iO;WeO zHTpK|cv*`bE}Z0KhV(mXu&Pj8X47Cz4T2-BY{&2a$I`4nZkZL*(EPEZ!3wt{2+3|`ff;{k+JQ_kIzHE!&<*Kd~H$T z*H}4`az)8}t-}48;6Is|h!;gy<2AoLY zrOa#lP3Q+on6TG{NlBvHE*F-Cu&;OdiFVYqdyu!3-sEQlFE~;qn>5m+T8%w8}y1h;ZQ+drQAZ0j5B5&yUYZeWhkLraf6yb(89*`q zw5iwV9v6rC;Cr@{a?-k#iX@r=#XgOUl0Jjbpxm@=sQY%`MDn=tb!OIS$`PPLZ67P{Qm_3n+n z{_88ZGRK45Uy)m5b@f z$dnMA1Bi?QNIIhD0!9i1q!0<@dQbk{BZS|$ij~!KCZR?JHXa@Lq3NR@1HthU64K1t zL+}gqb<0rWA@v19i6D5aYhd6ugxU;#6w##}fYlmw-w#~$O-cn=*+6jYd14!0JVw?# zHy&!c-A7F7d*Jc~v{9DA+^@31wwfr$xk_@X+wZkDl14zfnGA zZNp4#1xAOTa+SMUP{2=db7K=ja8Zy0)=y4OE>+m$9R#kyqagM2<(I{V%uJx-9LUDA zCFFer1$`@oP2EZdT@T70w15Hb{{)&LfYe$5X~J9K{{#S_eg{Xmv9WQC-Gi4sW!BxV zI4WJyjO7$5_;oFlq4XU)dqv!6C-Q(#ST7AxA;BnoWy;h?uR6L-) zV~!e%H??)gg3LF2mtmT)1k2fc7n8IsnS19i2_}qpKJDSXeV~QxH%d~x-&*~HiK&3p zsIoni-}8v+9UaI9dJ%dS92_$k1>U0Ij{z^yOtqaMt#=%Q)Q&48Z$bWp>^rsWjuCJc z^>aK||2+<)syn_U#r{0DvmfBZF;eI93V7_Gb6f#=!a8jF2-4gQ0*1TU#s3?f$Jn)& zW&6=s0{fx*J#OCcu}xBs7q$4 z;=@M=(Et#2fUvtf`@rdcI`1_UlMNhh2u64djx)}e-FP7J)P_8{q)v=ZRm)9{`Gm8v zF*QUw&T3y`5)3KI*bYHhgX&h*A5F#^1_GQtc$WwO-Ve74=mUB4ULOJ_IP9aAx&1`w>B9Q5;zf*D=BT;p`oqmkL;ghP%#okZOFyvboM0m93-Oju$+pv} z8N`2O#+~C0FMQmM-VEAGY^l^b_cQ|Y;*|I6y^*)x75)5NS>-u9p=MUPva-?+54I)b z+W-t*Y?w^C-gVpkbj~gRW$DYJ%6C}~j*cwj20&UXx1FoQK9qvoA0i^tQb#o=8X}vd z$3B-eMw6L3g=XN+gR>rLp@yz;pRm~V)n8CQy@VTx&9G@UCqVrxubMyHtnTkRc5*dt z2y=g7{b<|C{!H#&dx1x1s7&ZIssNK8c}gZkA9nj>7IEGw zcEyhNVBDmBzL&plnIv&{_4Ih+3@gmQC1|R{HfIy57TfWzc0&Hq z?%OPi-n4IdHo9wta^n8&tFIFFb+h2-^VSe-KZ&@hMkja2ck9{0>k)-=AH#QwL+@6F zx(AD*rl?L;JAy_7D3#r_7aO5ZtRIoguz93 zcfZL-So3$y#j7CnJDZQF${LUH1a1m=bDeKp(>^6#JL`L=D6zQTI~pIjaPVa*>6C*_ zAW}C-LhUm54LP4Jr_ZH3FzR0NCnP3zA%t7QnV2G8Coe%wH{0MbY7bl1F&YL2XiVQg z2VTF<*$BSy_7FnlKr>w{PyAFp_qk10Ki}6!wn@dWOt*2gFQ}WdEchqm^Qp;?u&{;88d!bK%PrZV{wk$ zLG|Y5j$l$y>KU?Gac6#mn0{66`rqCs+ksPm5-kI^*7EKRy^(TzH46SqzzB7~J}IZ9 z^c55h{V9A1`3>x&VUSY@`-O3fA9BO-gl>CR*Ws`X_5QSZI_U&IVl)mpBjB0NblaT= zEM*K#0RX0I*jAaZ|K4iD%Bt@YvXWrv*R;6X(4hCx%h%7LG6$_vM?w1P_R^B=dk@hs z{-}}Z7P?tpSSZkwiE-wLr6V}t-J9U{sW{WXdwYTURWYrlr{`1eWL*lJh_IK?e~Dcu zNbPDqx?mz>yZOGNN)>g;sLBsZN498&P{&1O->HOxl1y;)^5LlDxb||(@zZs=TI(b( zwek2+8mt0?#$>*E_dvv?1oX$lfX72bXtsSmhiA`YBP-E;DU=a_WUDZRcYK zQ+=@n=KA$(d805|4++q^Vv;#RRMd_r*r4KVIN2BEFi_xSX-vr{c$zKZKhaU~S8)P9 z1VKdpPe(XOq6b1JaCxHJG2w*(NWwBO!Sr!X+3NPn4*MYxI4mlqI1VIUZ-+Wc;&&UBuFf(J)Zi98}Od&x5G++fGq zda}E~>(80{-dIbNS#3^&>9i~R1@>|{aS72@lp;GS>4iJr>&-fqkDx})&4s_=gu6X<%a##iOG4%xWjRbFlp-R)@{Z$@+GuB+p0>q-5E1)iR7MWR zy%p1!+SxA3-m{g84M%@aYm$CtcWG^n=gm-UnmSh3y7yheyg?QQywFII&Xy1&Gvh@eadRBa`9aEv|;?-Z2pUMegT0!i&KrG-I3IY)YmbsbLxQ~KTip2 zv>9B`yJ{87`=ayKn$D|lwwnx{e)$=vU;A1#D4qDacfZj*>|y^M2DI!(-9}&|kgbpKGJDW4U ze<*^25`GBmEYOT(rntxh5N02c0L9>4# zMO)p`(D6Y45|Fmz84Iw_Q{Ude>oISg{D_)@SiEXawaf@eJ6Si8S1t7wZ)g?Rvt^9OzwSOH|ZG3Cz zz?*FuKKIEY>~F{M`t7Gb@s!km4Cx|T?@LPnu@-iA2Gmset)Gk(NF>Eu*Holwuut)$ zGCZ(&yjhjkN{Mok1LVc<2%iMbM7?OcXTbXH&avn5xF$lc0)Q}t&*C+lb`W-4*g0Wa z!32=*|0RE2d*6%@ITxAid~#7b&qhG?y=myXVWfQ0hj&|D*!U}0O-1OjmeTx#&p-Ws zkP;xl8}sqwAoQIO3DF*q*NlYFTSK+^`efQXf=VPA$^^&DKMv6Pxj`spk_K_BfGiNp zA4ecoU@y|Db7n^RdvVGLJrgL4%3hy2#`S%9W~9yyy*Q_^;MepgR&m ztAeO%wx*E90AwDBahoOfF(Bxn;7wMiU$v<~g@aclN@Jm`w{}9ti^s|@D!tx!B2(zl z)Cl87*@R1zVxMAGvE3n3>F`9yz$mjA{(PqkIwH`?!h}iv{d@QPGcq#ntpB~d{BFSm z6q$EvX;4`@=JG(Y7-AF*Ad;oEH8a(u_xQ567gp$Wj>7GT^r%%TmN=aCSwO#{)|bNW zPRJhR7#%!T$a0YZ!;kB*!fo_!Dl0&Nn?zq0=5?q_y~pEO#AT@Uv6 z^PF9U`HdmrI@`WAp*M1klv2BSEBg0K_0t2#6F#v|E*u>0es#zpg?O{qLCWj(w2St) zG_&&wcgX+U;6SAC8d`q*x8=SR(js*#t%3}SW$=1;WU&MMu1?lg0csL<@OA>}b6{AB z2J)7Gb5ZZ4)#$f$hR6msf4~|_AA-lY-7W4%`%h09uhRPqLdLXE$fM*wg5@1cS4*idT zWAuIjq`2|6qk=_tXUE#rN7G!!tl^wVf&4H!e3bJD@5t1SDUO$SOZoP<`r1f(vd5Aspe}-$6;8e7{1Bsu zkirAA2q+}wpdxA$fUEdVx?KZ=%R{JpBruFQ0nX5NG!D>6h}xq8q(3zwma9?upUh}Q1m;n_+n-VVsF z&kE19Z+?;Zibk#0;QyCkIx_=%UMVrF4{wnTUUMEg3>wO=RyQj-p1hV%+Q2x)y$=Ls zm(7}qs~T!JKaCY{s4~H@FppZja1#0s5Qps;WC@ZdM5!8N2`2n;S=5lF#I4a+*{eBgwLM<{-O)Me>dc(%={`k^x}(N2E3E(FyyKAP)(NYFVquZ# zquY55Ew>4{E%A78buxK?nphd3Ghsaa$UI8_y1+=^Mt+MEYN`Ae);TPB^k!AREX3A*o60+!b!oOaNxxRHM9eluOu>38T zRf8iQ9Zye;)3Mb+pSsnw!ni8`g(#O)_yCc&b!_i%(@Z85<9jF9KB=1|3Mo5hPIEra zsy4VB^fc~+n5CxZmTFSA6C$D-&)kUE{J79ciQX4|M*l7+$dOiS=Gf%a_2B-GmS`D! zER>-j<-5VD_1M_a0jW1w9^mQH)I^}DQ=+LP)v1;sRbIz);=+iZmWFttv(mZh%1s7# zuskdle4cIiH#SRGj4DG4Pr>QBAOqG@cumM7c4o1OX@(G1^$4w0QGrCf^<(KGuRmgr z%KVCkxMgmXC^Fncf#eAYXg=w{R!!XUV+b`}%^gi^*X!r zfoBuGhnT)LVfXn?6>Fx`beD2=4HLzO=YGxd5i&AL$r7>!)5*=&X|H6}MkP+*Is9_}VORd&6ZZS~8xxj#Sr`)mc~WdlVj-{K!#Zy!`U{QX9W85CUAvG^)jIq}jr}m;B_Y~-F{zgeV4;m@eWG&yNCz5|HWcLI?K3FFxDq9Vn zlN7yB-gf(D5&Vmea)XbHiHYeza6x5t*Bh>+v#K?EXX78=K1 zR9XLgb4G4p-sbC8vJFwJ>Ca#Ma={7^3&&Bodtm%H;0bE}(YwEHR}35sWVp;>wofST~h={ilDueVVmS{E!2U6`=gP91)HTUD!TQ`63doIXPpZ zMbC4_c%c&xEleyBTRLyg#Dn2TyO^OGMm2>$uMCRZXBB*0Mf-dq)7BBVsxj=JDEa{I(av_B_u`N8pZd`G1a zgtfiE;6r3!gMX|QV5QJNaaav=`TKa)bgk57dRO|ZlBjo3@lPG2VXmBUmefkcik-0t z6#{D0UsIwrFxNF+9(c8(C(GkKc`-qKI(FXKOVvHZy0A===xDv3i#@u5P2c2g&MP!A zVT)huz#CbSk|h0gNOr(%Q^_mOzN>evO+yz#-k+mC*Mbvah3#B2Y(A>%O;_iyU^oWM zb6f)h1L5;unQ$_K2E27=6lFLKR>Q?k{VnoG5zsF{`VJ6Y1n>!A9^ieIpw0s5<>sqX zr83(j;;swpS#-EVC{nGiodarTX=ih@jIqD3HPMumVF*(NuQ@WKMJH|C?u_eni&BUgV*=g z1c-YK%*>%MDnh`-03ZzGN}g0VXJ;6-QW?SAl97+w_hTGv>wN{B%*> zVln@yW#u)hj7xbax~?w6;&%b;otbD8w#mV)SD zLDT;i=mdO$Bn|Qx-MW9jC-Ix#v}gZ|&9~Gaa;=XlEL=vkjmg7RxBOWn-#+Jl(y=!& zF>!MIuFsPMQ>qZ0%+2nyuimWpb>j^dPxT0f#1l+ErVRf)qAH`YU$YL-eqLB@XKm0l z6Gb_Z{|tH9f(J6ytJ@y}X;+N13 z2G7#)UiH8A^Xk&?=(11F_?Q_mTv7fkOeXz7ALkP=Q~(h;b>oR)6g9u0rH(kByUz@b zgje#3J~07=%O5z^P|JyW#YeyOwQ==nrZJq?eOx(f*_rH)0|L3t_+kNTgRoY~JIVc_Vj28%Uxw`ZK=)VNqkfF<96@y`HKw#iMr&XBp6aDQ5b*$pQ z@W4sg0O(6#yY>b)MTD0ZlYwY_aPsy@KK&fV8}%o-gj=^Erf{w_spl-9jVy_gsydeS zEWOY;+J)u07$STCT9|;Wi(Ax!l?5h5pJk${j<%-b5QW^~nnK$dWU&x{jvId1zaYRt z@CEWg5<)_R#TyZw((&6bFfOpiL+vwmd}Qs}-jVCqq2)A|XPLwNds9xhtl{g}X7JxM zIT7h$chHa()YIHp!hbz_l7uqypDwC4K{G@@3>Pt*fKe53KjgMLjqU7{+Vw$>O|`WL5T=CC{vtrbhXZ^b z(AiYZAHM`yEwF_@jawlAo#4|H-ft&(z28Cd`p;r8Oi>5zBma%`Edv7+z|Y|+!T_Z2 zL$+SsaK9KNogAg36l&!2+dOYrD2@hxr1=R;^!U6)A@}BA5B57&;l$Ys&IC_dF zyjuSw2W_Rv>PRUYF9uM16ly#~F0$PED*y`lnDlfdxOf&9x3LWIK&$$)Oqa$c~2SaU{i0uwq|3}aRc5roNU}KAb0fVL+ z?^YPZ6hTo7A9~W_hXV>iD-lQbrN`H2(QIL#FBgNUdtsH06LJCLo$ajFU{4R^_e~Rl zJ0?I6j{6=x@8}O;AhiPQ{2r@Ho%v?pX12bvS?EjGn)W3ez`$;GNc7^FtE+1Q*gssJ zT!AuRx~E6Z2b{vIU>@%QuTRC+uU|~m0*+s@^Ijg_BIA+8Sg~t5>$HF7frDL{rgNXh zv(dnIs^pU}+=*?aaFcbz)gM6P<5kJa6Db{?)75HhSQ5(me0z5owS6z>YaU=(=^Hp{25cHQnm6Q^Nf3IR0`!9TnZJn*;i zq*B8q7aCJw`angbvw^Erjn)^2xd*BJG;maanSBtLO={X5Rt1=*P%5RxV243^&;MHk zXc95N$i~OBXDsprCI9App>sO?{O{(J61|FSd`(f$H| zNo;E%W+H!)FebWg#spT#9ht^81e{w|Ny!`(=BAzXnBdTkhu_|to1y@acln21^C~Eq z*j*IiO|B9v#K&`5%3)PY`|nK%^(^;OB1%oBp6hD2>!Q#=hr2D*g!l#yw)ugwz9G*Y za_XPfpOLi7*)s*pCWx2w}V?wi;bB7@#8M5$^e@mNCr-&HYoziG=J8} zyRWW9kxFF#Qu0Rys^+5UPr{iq(6e!;sBzrw`rsg7)iD(G?Cr}A);2bcNzb{G-l+c8 zFS_^ZR-2!xwzB-aJE1lD)T@r9psDEhM``6lrHkvKiIsKt95XK`ecQJ9cvt26r&_)` zfC~Z61t3=U3G5&gkj%Z%PVgG!yv39iGqgT8c?$!zd%Y_s6bmB|+36g0&Xy$GvaZXX z9}NkNMyCc`m^+S#BLLf8UhI2CcjqA@{T{1UpO= z^o)U^)JE5_Hg#)zTdw(MqH8_7Jo6C7qfs7u3Y_q4OGjVd2g%uTJY@0v?hUQ1H>=KG z?@VKUqhP{%%_~OH6>C<`EF>iK{{)2qdjArO#pL+-Sf Date: Tue, 1 Apr 2025 17:15:40 +0200 Subject: [PATCH 23/56] refactor data object related code --- src/spatialdata_plot/_viewconfig/data.py | 288 +++++++++++++++++++ src/spatialdata_plot/_viewconfig/legend.py | 0 src/spatialdata_plot/_viewconfig/marks.py | 0 src/spatialdata_plot/_viewconfig/misc.py | 13 + src/spatialdata_plot/_viewconfig/scales.py | 11 +- src/spatialdata_plot/pl/_viewconfig.py | 305 ++++----------------- src/spatialdata_plot/pl/render.py | 14 +- src/spatialdata_plot/pl/render_params.py | 10 +- src/spatialdata_plot/pl/utils.py | 41 +-- 9 files changed, 392 insertions(+), 290 deletions(-) create mode 100644 src/spatialdata_plot/_viewconfig/legend.py create mode 100644 src/spatialdata_plot/_viewconfig/marks.py create mode 100644 src/spatialdata_plot/_viewconfig/misc.py diff --git a/src/spatialdata_plot/_viewconfig/data.py b/src/spatialdata_plot/_viewconfig/data.py index e69de29b..79ff25d3 100644 --- a/src/spatialdata_plot/_viewconfig/data.py +++ b/src/spatialdata_plot/_viewconfig/data.py @@ -0,0 +1,288 @@ +from typing import Any +from uuid import uuid4 + +import spatialdata +from spatialdata import SpatialData +from spatialdata._io.format import CurrentPointsFormat, CurrentRasterFormat, CurrentShapesFormat +from spatialdata.models import get_table_keys + +from spatialdata_plot.pl.render_params import ( + CmapParams, + ImageRenderParams, + LabelsRenderParams, + PointsRenderParams, + ShapesRenderParams, +) + +Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams + + +def _add_datashade_transform( + params: PointsRenderParams | ShapesRenderParams, data_object: dict[str, Any] +) -> dict[str, Any]: + """Add a datashade transform to a vega like data object. + + The datashade transform is specifically added in case a SpatialData points or shapes element was + visualized using datashader. + + Parameters + ---------- + params: PointsRenderParams | ShapesRenderParams + The parameters used to visualize the particular SpatialData points or shapes element. + data_object: + The vega like data object pertaining to a particular SpatialData points or shapes element. + + Returns + ------- + data_object: dict[str, Any] + The data object with the added datashade transform. + """ + if params.ds_reduction is None: + return data_object + + reduction_map = {"std": "stdev", "var": "variance"} + ds_reduction = reduction_map.get(params.ds_reduction, params.ds_reduction) + + last_transform = data_object["transform"][-1] + + if last_transform["type"] == "formula": + field = as_field = data_object["transform"][-1]["as"] + elif params.col_for_color: + field = as_field = params.col_for_color or "*" + if field == "*": + as_field = "count" + + data_object["transform"].append({"type": "aggregate", "field": [field], "ops": [ds_reduction], "as": [as_field]}) + data_object = add_norm_transform_to_data_object(params.cmap_params, data_object) + # if data_object["transform"][-1]["type"] == "formula": + # field = data_object["transform"][-1]["as"] + if isinstance(params, PointsRenderParams): + data_object["transform"].append( + {"type": "spread", "field": [as_field], "px": params.ds_pixel_spread, "as": [as_field]} + ) + + return data_object + + +def add_norm_transform_to_data_object( + cmap_params: CmapParams | list[CmapParams], data_object: dict[str, Any] +) -> dict[str, Any]: + """Add a normalization transform to a vega like derived data object. + + Parameters + ---------- + cmap_params: CmapParams | list[CmapParams] + The render parameters used to plot the particular spatialdata element. + data_object: dict[str, Any] + The vega like derived data object. + + Returns + ------- + The vega like derived data object with an added normalization transform if normalization was defined + in the render parameters. + """ + norm = cmap_params.norm if not isinstance(cmap_params, list) else cmap_params[0].norm + last_transform = data_object["transform"][-1] + field = last_transform["as"][0] if last_transform["type"] == "aggregate" else "value" + + if not isinstance(norm.vmin, float) and isinstance(norm.vmax, float): + return data_object + + norm_expr = f"(datum.{field} - {norm.vmin}) / ({norm.vmax} - {norm.vmin})" + if norm.clip: + formula = f"clamp({norm_expr}, 0, 1)" + + data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) + return data_object + + +def create_base_level_sdata_object(url: str) -> dict[str, Any]: + """Create the vega json object for the SpatialData zarr store. + + Parameters + ---------- + url : Path + The location of the SpatialData zarr store. + + This config is to be added to the vega data field block. + """ + return { + "name": str(uuid4()), + "url": url, + "format": {"type": "SpatialData", "version": spatialdata.__version__}, + } + + +def create_table_data_object(table_name: str, base_uuid: str, table_layer: str | None) -> dict[str, Any]: + """Create the vega like data object for a spatialdata table. + + Parameters + ---------- + table_name : str + Name of the table in the SpatialData object. + base_uuid : str + The ID or name of the vega like data object pertaining to the SpatialData zarr store containing + the table to be added. + table_layer: str | None + The layer of the anndata table to be used. + + Returns + ------- + The vega like data object for the SpatialData table. + """ + table_object = { + "name": str(uuid4()), + "format": {"type": "spatialdata_table", "version": 0.1}, + "source": base_uuid, + "transform": [{"type": "filter_element", "expr": table_name}], + } + if table_layer is not None: + table_object["transform"].append({"type": "filter_layer"}) # type: ignore[attr-defined] + return table_object + + +def _add_table_lookup( + sdata: SpatialData, params: Params, data_object: dict[str, Any], table_id: str | None +) -> dict[str, Any]: + """Add a lookup transform to a vega like derived data object. + + Parameters + ---------- + sdata : SpatialData + The spatialdata object containing the table. + params: params + The render parameters used to plot the particular spatialdata element. + data_object: dict[str, Any] + The vega like derived data object. + table_id: str + The ID of the vega data object pertaining to the spatialdata table. + + Returns + ------- + The vega like derived data object with the added lookup transform. + """ + if table_id and not isinstance(params, ImageRenderParams): + _, _, instance_key = get_table_keys(sdata[params.table_name]) + if isinstance(params, LabelsRenderParams): + color = params.color + else: + color = params.color if params.color else params.col_for_color + data_object["transform"].append( + { + "type": "lookup", + "from": table_id, + "key": instance_key, + "fields": ["instance_ids"], + "values": [color], + "as": [color], + "default": None, + } + ) + return data_object + + +def _create_base_derived_data_object(element_name: str, call: str, cs: str, base_uuid: str) -> dict[str, Any]: + """Create the base vega like object of derived SpatialData elements. + + The object returned by this function contains the fields shared by all the vega like data objects, no matter + what type of SpatialData element it pertains to. + + Parameters + ---------- + element_name: str + The name of the SpatialData element + call: str + The render call from spatialdata plot, either render_images, render_labels, render_points + or render_shapes, prefixed by n_ where n is the index of the render call starting from 0. + cs: str + The name of the coordinate system in which the SpatialData element was plotted. + base_uuid: str + Unique identifier used to refer to the base level SpatialData zarr store in the vega + like view configuration. + + Returns + ------- + A base vega like data object for derived SpatialData elements. + """ + format_types = { + "render_images": (str(CurrentRasterFormat), CurrentRasterFormat().spatialdata_format_version), + "render_labels": (str(CurrentRasterFormat), CurrentRasterFormat().spatialdata_format_version), + "render_points": (str(CurrentPointsFormat), CurrentPointsFormat().spatialdata_format_version), + "render_shapes": (str(CurrentShapesFormat), CurrentShapesFormat().spatialdata_format_version), + } + + for key, fmt in format_types.items(): + if key in call: + format_object = {"type": fmt[0], "version": fmt[1]} + break + else: + raise ValueError(f"Unknown call: {call}") + + return { + "name": element_name + "_" + str(uuid4()), + "format": format_object, + "source": base_uuid, + "transform": [ + {"type": "filter_element", "expr": element_name}, + {"type": "filter_cs", "expr": cs}, + ], + } + + +def create_derived_data_object( + sdata: SpatialData, call: str, params: Params, base_uuid: str, cs: str, table_id: str | None = None +) -> dict[str, Any]: + """Create the base data object for a SpatialData element. + + Parameters + ---------- + sdata: SpatialData + The SpatialData object of which elements have been plotted. + call: str + The render call from spatialdata plot, either render_images, render_labels, render_points + or render_shapes, prefixed by n_ where n is the index of the render call starting from 0. + params: Params + The render parameters used in spatialdata-plot for the particular type of SpatialData + element. + base_uuid: str + Unique identifier used to refer to the base level SpatialData zarr store in the vega + like view configuration. + cs: str + The name of the coordinate system in which the SpatialData element was plotted. + table_id: str | None + The value of the `name` key in the vega like data object pertaining to the table used + for plotting a SpatialData element. + + Returns + ------- + A vega like data object for derived SpatialData elements. + """ + data_object = _create_base_derived_data_object(params.element, call, cs, base_uuid) + + if "render_images" in call and isinstance(params, ImageRenderParams): + selected_scale = "full" if params.scale is None else params.scale + data_object["transform"].extend( + [ + {"type": "filter_scale", "expr": selected_scale}, + {"type": "filter_channel", "expr": params.channel}, + ] + ) + data_object = add_norm_transform_to_data_object(params.cmap_params, data_object) + + elif "render_labels" in call and isinstance(params, LabelsRenderParams): + selected_scale = "full" if params.scale is None else params.scale + data_object["transform"].append({"type": "filter_scale", "expr": selected_scale}) + data_object = _add_table_lookup(sdata, params, data_object, table_id) + data_object = add_norm_transform_to_data_object(params.cmap_params, data_object) + + elif ("render_points" in call or "render_shapes" in call) and isinstance( + params, PointsRenderParams | ShapesRenderParams + ): + data_object = _add_table_lookup(sdata, params, data_object, table_id) + + if params.ds_reduction is not None: + data_object = _add_datashade_transform(params, data_object) + else: + data_object = add_norm_transform_to_data_object(params.cmap_params, data_object) + + return data_object diff --git a/src/spatialdata_plot/_viewconfig/legend.py b/src/spatialdata_plot/_viewconfig/legend.py new file mode 100644 index 00000000..e69de29b diff --git a/src/spatialdata_plot/_viewconfig/marks.py b/src/spatialdata_plot/_viewconfig/marks.py new file mode 100644 index 00000000..e69de29b diff --git a/src/spatialdata_plot/_viewconfig/misc.py b/src/spatialdata_plot/_viewconfig/misc.py new file mode 100644 index 00000000..a71383d0 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/misc.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class VegaAlignment(Enum): + LEFT = "start" + CENTER = "middle" + RIGHT = "end" + + @classmethod + def from_matplotlib(cls, alignment: str) -> str: + """Convert Matplotlib horizontal alignment to Vega alignment.""" + mapping = {"left": cls.LEFT, "center": cls.CENTER, "right": cls.RIGHT} + return mapping.get(alignment, cls.CENTER).value diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py index f6a23f7f..0ed7dcb5 100644 --- a/src/spatialdata_plot/_viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -62,7 +62,10 @@ def get_axis_scale_object(ax: Axes, axis_name: str) -> dict[str, Any]: def _generate_color_scale_object( - name: str, type_scale: str, domain: list[str] | dict[str, str], color_range: list[str] | dict[str, str | int] + name: str, + type_scale: str, + domain: list[str] | dict[str, Any], + color_range: list[str] | dict[str, str | int], ) -> dict[str, Any]: """Create vega like color scale object. @@ -153,7 +156,7 @@ def _process_colormap(cmap: CmapParams) -> dict[str, Any]: def create_colorscale_array_points_shapes_labels( - coloring: dict[str, str] | Literal["continuous"] | None, + coloring: dict[str, str] | Literal["continuous"] | str, params: PointsRenderParams | ShapesRenderParams | LabelsRenderParams, data_object: dict[str, Any], ) -> list[dict[str, Any]]: @@ -188,9 +191,9 @@ def create_colorscale_array_points_shapes_labels( ) elif coloring == "continuous": if isinstance(params, LabelsRenderParams): - field = data_object["transform"][-1].get("as") or [params.color] + field = data_object["transform"][-1].get("as") or params.color else: - field = data_object["transform"][-1].get("as") or [params.col_for_color] + field = data_object["transform"][-1].get("as") or params.col_for_color color_scale_object.update( _generate_color_scale_object( color_scale_object["name"], diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 5f7e9594..5e9e8732 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -1,18 +1,20 @@ from __future__ import annotations import re -from enum import Enum from pathlib import Path from typing import TYPE_CHECKING, Any -from uuid import uuid4 import matplotlib.colors as mcolors -import spatialdata from matplotlib.axes import Axes from matplotlib.figure import Figure -from spatialdata.models import get_table_keys +from spatialdata_plot._viewconfig.data import ( + create_base_level_sdata_object, + create_derived_data_object, + create_table_data_object, +) from spatialdata_plot._viewconfig.layout import create_padding_object +from spatialdata_plot._viewconfig.misc import VegaAlignment from spatialdata_plot._viewconfig.scales import ( create_axis_scale_array, create_colorscale_array_image, @@ -33,35 +35,6 @@ from spatialdata import SpatialData -class VegaAlignment(Enum): - LEFT = "start" - CENTER = "middle" - RIGHT = "end" - - @classmethod - def from_matplotlib(cls, alignment: str) -> str: - """Convert Matplotlib horizontal alignment to Vega alignment.""" - mapping = {"left": cls.LEFT, "center": cls.CENTER, "right": cls.RIGHT} - return mapping.get(alignment, cls.CENTER).value - - -def _create_base_level_sdata_block(url: str) -> dict[str, Any]: - """Create the vega json object for the SpatialData zarr store. - - Parameters - ---------- - url : Path - The location of the SpatialData zarr store. - - This config is to be added to the vega data field block. - """ - return { - "name": str(uuid4()), - "url": url, - "format": {"type": "SpatialData", "version": spatialdata.__version__}, - } - - def _create_legend_title_config(title_obj: Text, dpi: float) -> dict[str, Any]: """Create the vega like legend title object. @@ -219,115 +192,14 @@ def _create_colorbar_legend( return legend_array -def _add_norm_transform(params: Params, data_object: dict[str, Any]) -> dict[str, Any]: - """Add a normalization transform to a vega like derived data object. - - Parameters - ---------- - params : Params - The render parameters used to plot the particular spatialdata element. - data_object: dict[str, Any] - The vega like derived data object. - - Returns - ------- - The vega like derived data object with an added normalization transform if normalization was defined - in the render parameters. - """ - norm = params.cmap_params.norm if not isinstance(params.cmap_params, list) else params.cmap_params[0].norm - field = data_object["transform"][-1]["as"][0] if data_object["transform"][-1]["type"] == "aggregate" else "value" - if isinstance(vmin := norm.vmin, float) and isinstance(vmax := norm.vmax, float): - - if norm.clip: - formula = f"clamp((datum.{field} - {vmin}) / ({vmax} - {vmin}), 0, 1)" - else: - formula = f"(datum.{field} - {vmin}) / ({vmax} - {vmin})" - data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) - return data_object - - -def _add_table_lookup( - sdata: SpatialData, params: Params, data_object: dict[str, Any], table_id: str | None -) -> dict[str, Any]: - """Add a lookup transform to a vega like derived data object. - - Parameters - ---------- - sdata : SpatialData - The spatialdata object containing the table. - params: params - The render parameters used to plot the particular spatialdata element. - data_object: dict[str, Any] - The vega like derived data object. - table_id: str - The ID of the vega data object pertaining to the spatialdata table. - - Returns - ------- - The vega like derived data object with the added lookup transform. - """ - if table_id and not isinstance(params, ImageRenderParams): - _, _, instance_key = get_table_keys(sdata[params.table_name]) - if isinstance(params, LabelsRenderParams): - color = params.color - else: - color = params.color if params.color else params.col_for_color - data_object["transform"].append( - { - "type": "lookup", - "from": table_id, - "key": instance_key, - "fields": ["instance_ids"], - "values": [color], - "as": [color], - "default": None, - } - ) - return data_object - - -def _add_datashade_transform(params, data_object): - if params.ds_reduction == "std": - params.ds_reduction = "stdev" - if params.ds_reduction == "var": - params.ds_reduction = "variance" - - if data_object["transform"][-1]["type"] == "formula": - field = data_object["transform"][-1]["as"] - as_field = field - elif params.col_for_color: - field = params.col_for_color - as_field = field - else: - field = "*" - as_field = "count" - data_object["transform"].append( - {"type": "aggregate", "field": [field], "ops": [params.ds_reduction], "as": [as_field]} - ) - data_object = _add_norm_transform(params, data_object) - if data_object["transform"][-1]["type"] == "formula": - field = data_object["transform"][-1]["as"] - if isinstance(params, PointsRenderParams): - data_object["transform"].append( - {"type": "spread", "field": [as_field], "px": params.ds_pixel_spread, "as": [as_field]} - ) - else: - pass - return data_object - - -def _create_derived_data_block( - sdata: SpatialData, +def _create_scales_legends_marks( fig: Figure, ax: Axes, - call: str, + data_object: dict[str, Any], params: Params, - base_uuid: str, - cs: str, call_count: int, - table_id: str | None = None, legend_count: int = 0, -) -> tuple[dict[str, Any], dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]: +) -> tuple[dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]: """Create vega like data object for SpatialData elements. Each object for a SpatialData element contains an additional transform that @@ -336,98 +208,40 @@ def _create_derived_data_block( Parameters ---------- - call: str - The render call from spatialdata plot, either render_images, render_labels, render_points - or render_shapes, prefixed by n_ where n is the index of the render call starting from 0. params: Params The render parameters used in spatialdata-plot for the particular type of SpatialData element. - base_uuid: str - Unique identifier used to refer to the base level SpatialData zarr store in the vega - like view configuration. - cs: str - The name of the coordinate system in which the SpatialData element was plotted. """ - data_object: dict[str, Any] = {} marks_object: dict[str, Any] = {} color_scale_array: list[dict[str, Any]] = [] legend_array: list[dict[str, Any]] = [] - data_object["name"] = params.element + "_" + str(uuid4()) - - # TODO: think about versioning of individual spatialdata elements - if "render_images" in call and isinstance(params, ImageRenderParams): - data_object["format"] = {"type": "spatialdata_image", "version": 0.1} - elif "render_labels" in call: - data_object["format"] = {"type": "spatialdata_label", "version": 0.1} - elif "render_points" in call: - data_object["format"] = {"type": "spatialdata_point", "version": 0.1} - elif "render_shapes" in call: - data_object["format"] = {"type": "spatialdata_shape", "version": 0.1} - else: - raise ValueError(f"Unknown call: {call}") - - data_object["source"] = base_uuid - data_object["transform"] = [{"type": "filter_element", "expr": params.element}, {"type": "filter_cs", "expr": cs}] - - if "render_images" in call and isinstance(params, ImageRenderParams): # second part to shut up mypy - multiscale = "full" if not params.scale else params.scale - data_object["transform"].append({"type": "filter_scale", "expr": multiscale}) - data_object["transform"].append({"type": "filter_channel", "expr": params.channel}) - # Use isinstance because of possible 0 value - data_object = _add_norm_transform(params, data_object) - + if isinstance(params, ImageRenderParams): # second part to shut up mypy color_scale_array = create_colorscale_array_image(params.cmap_params, data_object["name"], params.channel) legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) marks_object = _create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) - if "render_labels" in call and isinstance(params, LabelsRenderParams): - data_object["transform"].append({"type": "filter_scale", "expr": params.scale}) - data_object = _add_table_lookup(sdata, params, data_object, table_id) - data_object = _add_norm_transform(params, data_object) - - # if it is a hex color then it should be directly used in the marks object. - if not mcolors.is_color_like(params.colortype): + if isinstance(params, LabelsRenderParams): + if params.colortype is not None: color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) - if params.colortype == "continuous": - # color_scale_array = _create_colorscale_image(params.cmap_params, data_object["name"], color_field) + if not mcolors.is_color_like(params.colortype): legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) if isinstance(params.colortype, dict): - # color_scale_array = _create_categorical_colorscale(params.colortype) legend_array = _create_categorical_legend(fig, color_scale_array, ax) - marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) - if "render_points" in call and isinstance(params, PointsRenderParams): - data_object = _add_table_lookup(sdata, params, data_object, table_id) - if not params.ds_reduction: - data_object = _add_norm_transform(params, data_object) - if params.ds_reduction: - data_object = _add_datashade_transform(params, data_object) - color_scale_array = None - if params.colortype: - color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) - if params.colortype == "continuous": - legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) - if isinstance(params.colortype, dict): - legend_array = _create_categorical_legend(fig, color_scale_array, ax) - marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) - if "render_shapes" in call and isinstance(params, ShapesRenderParams): - data_object = _add_table_lookup(sdata, params, data_object, table_id) - if not params.ds_reduction: - data_object = _add_norm_transform(params, data_object) - if params.ds_reduction: - data_object = _add_datashade_transform(params, data_object) - - color_scale_array = None - if params.colortype: + if isinstance(params, PointsRenderParams | ShapesRenderParams): + if params.colortype is not None: color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) if params.colortype == "continuous": legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) if isinstance(params.colortype, dict): legend_array = _create_categorical_legend(fig, color_scale_array, ax) - marks_object = _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array) + if isinstance(params, PointsRenderParams): + marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) + else: + marks_object = _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array) - return data_object, marks_object, color_scale_array, legend_array + return marks_object, color_scale_array, legend_array def _create_raster_image_marks_object( @@ -458,7 +272,13 @@ def _create_raster_image_marks_object( } -def _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array): +def _create_shapes_marks_object( + ax: Axes, + params: ShapesRenderParams, + data_object: dict[str, Any], + call_count: int, + color_scale_array: list[dict[str, Any]], +) -> dict[str, Any]: encode_update = None if not color_scale_array and not params.color: fill_color = {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} @@ -526,7 +346,7 @@ def _create_shapes_marks_object(ax, params, data_object, call_count, color_scale outline_par = params.outline_params stroke_color = {"value": mcolors.to_hex(outline_par.outline_color, keep_alpha=False)} - shapes_object["encode"]["enter"].update( + shapes_object["encode"]["enter"].update( # type: ignore[index] { "stroke": stroke_color, "strokeWidth": {"value": outline_par.linewidth}, @@ -543,33 +363,32 @@ def _create_points_symbol_marks_object( data_object: dict[str, Any], call_count: int, color_scale_array: list[dict[str, Any]] | None, -): - encode_update = None +) -> dict[str, Any]: + encode_update = {} if not color_scale_array and not params.color: fill_color = {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} elif not color_scale_array and params.color: fill_color = {"value": mcolors.to_hex(params.color, keep_alpha=False)} elif color_scale_array and (params.color or params.col_for_color): if isinstance(params.colortype, dict): - encode_update = { - "fill": [ - { - "test": f"!isValid(datum.{params.col_for_color})", - "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), - } - ] - } + encode_update["fill"] = [ + { + "test": f"!isValid(datum.{params.col_for_color})", + "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), + } + ] fill_color = {"scale": color_scale_array[0]["name"], "field": params.col_for_color} else: value = val[0] if isinstance(val := color_scale_array[0]["domain"]["field"], list) else val fill_color = {"scale": color_scale_array[0]["name"], "value": value} - encode_update = {"fill": []} - encode_update["fill"].append( + # encode_update = {"fill": []} + encode_update["fill"] = [ { "test": f"!isValid(datum.{params.col_for_color})", "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), } - ) + ] + if (params.cmap_params.norm.vmin is not None or params.cmap_params.norm.vmax is not None) and ( params.cmap_params.cmap.get_under() is not None or params.cmap_params.cmap.get_over() is not None ): @@ -609,7 +428,7 @@ def _create_points_symbol_marks_object( } if encode_update: # TODO: check if we can give info that na-color is used prior to adding this. If so then add if conditional. - points_object["encode"]["update"] = encode_update + points_object["encode"]["update"] = encode_update # type: ignore[index] return points_object @@ -670,37 +489,9 @@ def strip_call(s: str) -> str: return re.sub(r"^\d+_", "", s) -def _create_table_data_object(table_name: str, base_uuid: str, table_layer: str | None) -> dict[str, Any]: - """Create the vega like data object for a spatialdata table. - - Parameters - ---------- - table_name : str - Name of the table in the SpatialData object. - base_uuid : str - The ID of the vega like data object pertaining to the SpatialData zarr store containing - the table to be added. - table_layer: str | None - The layer of the anndata table to be used. - - Returns - ------- - The vega like data object for the SpatialData table. - """ - table_object = { - "name": str(uuid4()), - "format": {"type": "spatialdata_table", "version": 0.1}, - "source": base_uuid, - "transform": [{"type": "filter_element", "expr": table_name}], - } - if table_layer: - table_object["transform"].append({"type": "filter_layer", "expr": table_layer}) - return table_object - - def _create_data_configs( sdata: SpatialData, fig: Figure, ax: Axes, cs: str, sdata_path: str -) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: +) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: """Create the vega json array value to the data key. The data array in the SpatialData vegalike viewconfig consists out of @@ -720,14 +511,14 @@ def _create_data_configs( """ data_array = [] marks_array = [] - color_scale_array_full = [] + color_scale_array_full: list[dict[str, Any]] = [] legend_array_full = [] url = str(Path("sdata.zarr")) if sdata_path: url = sdata_path - base_block = _create_base_level_sdata_block(url) + base_block = create_base_level_sdata_object(url) data_array.append(base_block) counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} @@ -735,13 +526,13 @@ def _create_data_configs( call = strip_call(call) table_id = None if table := getattr(params, "table_name", None): - data_array.append(_create_table_data_object(table, base_block["name"], params.table_layer)) + data_array.append(create_table_data_object(table, base_block["name"], params.table_layer)) table_id = data_array[-1]["name"] - data_object, marks_object, color_scale_array, legend_array = _create_derived_data_block( - sdata, fig, ax, call, params, base_block["name"], cs, counters[call], table_id, len(color_scale_array_full) + data_array.append(create_derived_data_object(sdata, call, params, base_block["name"], cs, table_id)) + marks_object, color_scale_array, legend_array = _create_scales_legends_marks( + fig, ax, data_array[-1], params, counters[call], len(color_scale_array_full) ) - data_array.append(data_object) marks_array.append(marks_object) if color_scale_array: color_scale_array_full += color_scale_array diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 9883dccd..6e087b19 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -53,7 +53,7 @@ _prepare_transformation, _rasterize_if_necessary, _set_color_source_vec, - to_hex, + to_hex_alpha, ) _Normalize = Normalize | abc.Sequence[Normalize] @@ -148,7 +148,7 @@ def _render_shapes( else: palette = ListedColormap(dict.fromkeys(color_vector[~pd.Categorical(color_source_vector).isnull()])) - if len(set(color_vector)) != 1 or list(set(color_vector))[0] != to_hex(render_params.cmap_params.na_color): + if len(set(color_vector)) != 1 or list(set(color_vector))[0] != to_hex_alpha(render_params.cmap_params.na_color): # necessary in case different shapes elements are annotated with one table if color_source_vector is not None and col_for_color is not None: color_source_vector = color_source_vector.remove_unused_categories() @@ -371,12 +371,16 @@ def _render_shapes( vmax=render_params.cmap_params.norm.vmax or max(color_vector), ) - if len(set(color_vector)) != 1 or list(set(color_vector))[0] != to_hex(render_params.cmap_params.na_color): + if len(set(color_vector)) != 1 or list(set(color_vector))[0] != to_hex_alpha(render_params.cmap_params.na_color): # necessary in case different shapes elements are annotated with one table if color_source_vector is not None and render_params.col_for_color is not None: color_source_vector = color_source_vector.remove_unused_categories() - if not sdata.plotting_tree[f"{render_count}_render_shapes"].colortype and color_mapping: + if ( + sdata.plotting_tree[f"{render_count}_render_shapes"].colortype is not None + and color_mapping + and color_source_vector is not None + ): key_diff = set(color_mapping.keys()).difference(color_source_vector) color_mapping = {k: v for k, v in color_mapping.items() if k not in key_diff} sdata.plotting_tree[f"{render_count}_render_shapes"].colortype = color_mapping @@ -726,7 +730,7 @@ def _render_points( ax.set_xbound(extent["x"]) ax.set_ybound(extent["y"]) - if len(set(color_vector)) != 1 or list(set(color_vector))[0] != to_hex(render_params.cmap_params.na_color): + if len(set(color_vector)) != 1 or list(set(color_vector))[0] != to_hex_alpha(render_params.cmap_params.na_color): if color_source_vector is None: palette = ListedColormap(dict.fromkeys(color_vector)) sdata.plotting_tree[f"{render_count}_render_points"].colortype = "continuous" diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index b23a6ea1..3fe4c0fd 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -79,7 +79,7 @@ class ShapesRenderParams: element: str color: str | None = None col_for_color: str | None = None - colortype: str | None = None + colortype: str | dict[str, str] | Literal["continuous"] | None = None groups: str | list[str] | None = None contour_px: int | None = None palette: ListedColormap | list[str] | None = None @@ -91,7 +91,7 @@ class ShapesRenderParams: zorder: int = 0 table_name: str | None = None table_layer: str | None = None - ds_reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None = None + ds_reduction: str | None = None ds_pixel_spread: float | None = None @@ -103,7 +103,7 @@ class PointsRenderParams: element: str color: str | None = None col_for_color: str | None = None - colortype: str | None = None + colortype: str | dict[str, str] | Literal["continuous"] | None = None groups: str | list[str] | None = None palette: ListedColormap | list[str] | None = None alpha: float = 1.0 @@ -113,7 +113,7 @@ class PointsRenderParams: zorder: int = 0 table_name: str | None = None table_layer: str | None = None - ds_reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None = None + ds_reduction: str | None = None ds_pixel_spread: float | None = None @@ -148,4 +148,4 @@ class LabelsRenderParams: table_name: str | None = None table_layer: str | None = None zorder: int = 0 - colortype: str | None = None + colortype: dict[str, str] | Literal["continuous" | "random"] | None = None diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index 4606a2f1..527e8d2f 100644 --- a/src/spatialdata_plot/pl/utils.py +++ b/src/spatialdata_plot/pl/utils.py @@ -36,6 +36,7 @@ LinearSegmentedColormap, ListedColormap, Normalize, + to_hex, to_rgba, ) from matplotlib.figure import Figure @@ -79,7 +80,7 @@ _FontWeight, ) -to_hex = partial(colors.to_hex, keep_alpha=True) +to_hex_alpha = partial(colors.to_hex, keep_alpha=True) # replace with # from spatialdata._types import ColorLike @@ -275,13 +276,13 @@ def _sanitise_na_color(na_color: ColorLike | None) -> tuple[str, bool]: """ if na_color == "default": # user kept the default - return to_hex("lightgray"), False + return to_hex_alpha("lightgray"), False if na_color is None: # user wants to hide NAs return "#FFFFFF00", True # zero alpha so it's hidden if colors.is_color_like(na_color): # user specified a color (including "lightgray") - return to_hex(na_color), True + return to_hex_alpha(na_color), True # Handle unexpected values (optional) raise ValueError(f"Invalid na_color value: {na_color}") @@ -637,13 +638,13 @@ def _get_colors_for_categorical_obs( color_idx = np.linspace(0, 1, len_cat) if len_cat > 1 else [0.7] if isinstance(palette, str): - palette = [to_hex(palette)] + palette = [to_hex_alpha(palette)] elif isinstance(palette, list): - palette = [to_hex(x) for x in palette] + palette = [to_hex_alpha(x) for x in palette] elif isinstance(palette, ListedColormap): - palette = [to_hex(x) for x in palette(color_idx, alpha=alpha)] + palette = [to_hex_alpha(x) for x in palette(color_idx, alpha=alpha)] elif isinstance(palette, LinearSegmentedColormap): - palette = [to_hex(palette(x, alpha=alpha)) for x in color_idx] # type: ignore[attr-defined] + palette = [to_hex_alpha(palette(x, alpha=alpha)) for x in color_idx] # type: ignore[attr-defined] else: raise TypeError(f"Palette is {type(palette)} but should be string or list.") @@ -663,7 +664,7 @@ def _set_color_source_vec( table_name: str | None = None, table_layer: str | None = None, render_type: Literal["points"] | None = None, -) -> tuple[ArrayLike | pd.Series | None, ArrayLike, bool, dict[str, str] | None]: +) -> tuple[ArrayLike | pd.Series | None, ArrayLike, bool, Mapping[str, str] | None]: color_mapping = None if value_to_plot is None and element is not None: color = np.full(len(element), na_color) @@ -726,7 +727,7 @@ def _set_color_source_vec( return color_source_vector, color_vector, True, color_mapping logger.warning(f"Color key '{value_to_plot}' for element '{element_name}' not been found, using default colors.") - color = np.full(sdata[table_name].n_obs, to_hex(na_color)) + color = np.full(sdata[table_name].n_obs, to_hex_alpha(na_color)) return color, color, False, color_mapping @@ -778,7 +779,7 @@ def _map_color_seg( # we have hex colors assert all(_is_color_like(c) for c in color_vector), "Not all values are color-like." cols = colors.to_rgba_array(color_vector) - variable_type = color_vector[0][:-2] + variable_type = to_hex(color_vector[0], keep_alpha=False) else: cols = cmap_params.cmap(cmap_params.norm(color_vector)) @@ -817,8 +818,8 @@ def _generate_base_categorial_color_mapping( # should be unreachable, but just for safety raise ValueError("Expected `na_color` to be a hex color, but got a non-hex color.") - colors = [to_hex(to_rgba(color)[:3]) for color in colors] - na_color = to_hex(to_rgba(na_color)[:3]) + colors = [to_hex_alpha(to_rgba(color)[:3]) for color in colors] + na_color = to_hex_alpha(to_rgba(na_color)[:3]) if na_color and len(categories) > len(colors): return dict(zip(categories, colors + [na_color], strict=True)) @@ -862,7 +863,7 @@ def _get_default_categorial_color_mapping( logger.info("input has more than 103 categories. Uniform 'grey' color will be used for all categories.") return { - cat: to_hex(to_rgba(col)[:3]) + cat: to_hex_alpha(to_rgba(col)[:3]) for cat, col in zip(color_source_vector.categories, palette[:len_cat], strict=True) } @@ -889,9 +890,9 @@ def _get_categorical_color_mapping( color_idx = color_idx = np.linspace(0, 1, len(color_source_vector.categories)) if isinstance(palette, ListedColormap): - palette = [to_hex(x) for x in palette(color_idx, alpha=alpha)] + palette = [to_hex_alpha(x) for x in palette(color_idx, alpha=alpha)] elif isinstance(palette, LinearSegmentedColormap): - palette = [to_hex(palette(x, alpha=alpha)) for x in color_idx] # type: ignore[attr-defined] + palette = [to_hex_alpha(palette(x, alpha=alpha)) for x in color_idx] # type: ignore[attr-defined] return dict(zip(color_source_vector.categories, palette, strict=True)) if isinstance(palette, str): @@ -2108,7 +2109,7 @@ def _create_image_from_datashader_result( def _datashader_aggregate_with_function( - reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None, + reduction: str | None, cvs: Canvas, spatial_element: GeoDataFrame | dask.dataframe.core.DataFrame, col_for_color: str | None, @@ -2172,7 +2173,7 @@ def _datashader_aggregate_with_function( def _datshader_get_how_kw_for_spread( - reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None, + reduction: str | None, ) -> str: # Get the best input for the how argument of ds.tf.spread(), needed for numerical values reduction = reduction or "sum" @@ -2267,11 +2268,13 @@ def _datashader_map_aggregate_to_color( agg_under = agg.where(agg < span[0]) img_under = ds.tf.shade( - agg_under, cmap=[to_hex(cmap.get_under())[:7]], min_alpha=min_alpha, color_key=color_key + agg_under, cmap=[to_hex_alpha(cmap.get_under())[:7]], min_alpha=min_alpha, color_key=color_key ) agg_over = agg.where(agg > span[1]) - img_over = ds.tf.shade(agg_over, cmap=[to_hex(cmap.get_over())[:7]], min_alpha=min_alpha, color_key=color_key) + img_over = ds.tf.shade( + agg_over, cmap=[to_hex_alpha(cmap.get_over())[:7]], min_alpha=min_alpha, color_key=color_key + ) # stack the 3 arrays manually: go from under, through in to over and always overlay the values where alpha=0 stack = img_under.to_numpy().base From 4b263f13e73ac11f53047699dbc4ad449cc64b0a Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 4 Apr 2025 18:08:35 +0200 Subject: [PATCH 24/56] further refactor --- src/spatialdata_plot/_viewconfig/axis.py | 68 +++++ src/spatialdata_plot/_viewconfig/data.py | 14 +- src/spatialdata_plot/_viewconfig/layout.py | 35 +++ src/spatialdata_plot/_viewconfig/legend.py | 176 +++++++++++++ src/spatialdata_plot/_viewconfig/misc.py | 19 ++ src/spatialdata_plot/pl/_viewconfig.py | 286 ++------------------- 6 files changed, 320 insertions(+), 278 deletions(-) create mode 100644 src/spatialdata_plot/_viewconfig/axis.py diff --git a/src/spatialdata_plot/_viewconfig/axis.py b/src/spatialdata_plot/_viewconfig/axis.py new file mode 100644 index 00000000..1ca6d3f6 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/axis.py @@ -0,0 +1,68 @@ +from typing import Any + +import matplotlib.colors as mcolors +from matplotlib.axes import Axes + +from spatialdata_plot.pl.utils import to_hex_alpha + + +def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: float) -> list[dict[str, Any]]: + axis_array = [] + for scale in axis_scales_block: + axis_config = {"scale": scale["name"]} + if scale["name"] == "X_scale": + axis = ax.xaxis + elif scale["name"] == "Y_scale": + axis = ax.yaxis + + axis_props = axis.properties() + + axis_config["orient"] = axis.get_label_position() + + axis_line_props = ax.spines[axis_config["orient"]].properties() + axis_config["domain"] = axis_line_props["visible"] # domain is whether axis line should be visible. + axis_config["domainOpacity"] = axis_line_props["alpha"] if axis_line_props["alpha"] else 1 + axis_config["domainColor"] = mcolors.to_hex(axis_line_props["edgecolor"]) + axis_config["domainWidth"] = (axis_line_props["linewidth"] * dpi) / 72 + axis_config["grid"] = axis_props["tick_params"]["gridOn"] + + # making the assumption here that all gridlines look the same + if axis_config["grid"]: + axis_config["gridOpacity"] = axis_props["gridlines"][0].properties()["alpha"] + axis_config["gridCap"] = axis_props["gridlines"][0].properties()["dash_capstyle"] + grid_color = float(axis_props["gridlines"][0].properties()["markeredgecolor"]) + axis_config["gridColor"] = to_hex_alpha([grid_color] * 3) + axis_config["gridWidth"] = (axis_props["gridlines"][0].properties()["markeredgewidth"] * dpi) / 72 + axis_config["labelFont"] = axis_props["majorticklabels"][0].get_fontname() + axis_config["labelFontSize"] = (axis_props["majorticklabels"][0].get_size() * dpi) / 72 + axis_config["labelFontStyle"] = axis_props["majorticklabels"][0].get_fontstyle() + axis_config["labelFontWeight"] = axis_props["majorticklabels"][0].get_fontweight() + axis_config["tickCount"] = len(axis_props["ticklocs"]) + if axis_config["tickCount"] != 0: + tick_props = axis_props["ticklines"][0].properties() + axis_config["ticks"] = tick_props["visible"] + axis_config["tickOpacity"] = tick_props["alpha"] if tick_props["alpha"] else 1 + if axis_config["ticks"] and axis_config["tickOpacity"] != 0: + axis_config["tickColor"] = mcolors.to_hex(tick_props["color"]) + axis_config["tickCap"] = tick_props["dash_capstyle"] + axis_config["tickWidth"] = (tick_props["linewidth"] * dpi) / 72 + axis_config["tickSize"] = ( + tick_props["markersize"] * dpi + ) / 72 # also marker edge width, but vega doesn't have an equivalent for that. + + label = axis_props["label_text"] + if label != "": + axis_config["title"] = label + label_props = axis_props["label"].properties() + + axis_config["titleAlign"] = label_props["horizontalalignment"] + axis_config["titleBaseline"] = label_props["verticalalignment"] + axis_config["titleColor"] = mcolors.to_hex(label_props["color"]) + axis_config["titleFont"] = label_props["fontname"] + axis_config["titleFontSize"] = (label_props["fontsize"] * dpi) / 72 + axis_config["titleFontWeight"] = label_props["fontweight"] + axis_config["titleOpacity"] = label_props["alpha"] if label_props["alpha"] else 1 + axis_config["zindex"] = axis_props["zorder"] + + axis_array.append(axis_config) + return axis_array diff --git a/src/spatialdata_plot/_viewconfig/data.py b/src/spatialdata_plot/_viewconfig/data.py index 79ff25d3..941774f1 100644 --- a/src/spatialdata_plot/_viewconfig/data.py +++ b/src/spatialdata_plot/_viewconfig/data.py @@ -85,14 +85,14 @@ def add_norm_transform_to_data_object( last_transform = data_object["transform"][-1] field = last_transform["as"][0] if last_transform["type"] == "aggregate" else "value" - if not isinstance(norm.vmin, float) and isinstance(norm.vmax, float): + if norm.vmin is None and norm.vmax is None: return data_object norm_expr = f"(datum.{field} - {norm.vmin}) / ({norm.vmax} - {norm.vmin})" if norm.clip: - formula = f"clamp({norm_expr}, 0, 1)" + norm_expr = f"clamp({norm_expr}, 0, 1)" - data_object["transform"].append({"type": "formula", "expr": formula, "as": str(uuid4())}) + data_object["transform"].append({"type": "formula", "expr": norm_expr, "as": str(uuid4())}) return data_object @@ -205,10 +205,10 @@ def _create_base_derived_data_object(element_name: str, call: str, cs: str, base A base vega like data object for derived SpatialData elements. """ format_types = { - "render_images": (str(CurrentRasterFormat), CurrentRasterFormat().spatialdata_format_version), - "render_labels": (str(CurrentRasterFormat), CurrentRasterFormat().spatialdata_format_version), - "render_points": (str(CurrentPointsFormat), CurrentPointsFormat().spatialdata_format_version), - "render_shapes": (str(CurrentShapesFormat), CurrentShapesFormat().spatialdata_format_version), + "render_images": (CurrentRasterFormat.__name__, CurrentRasterFormat().spatialdata_format_version), + "render_labels": (CurrentRasterFormat.__name__, CurrentRasterFormat().spatialdata_format_version), + "render_points": (CurrentPointsFormat.__name__, CurrentPointsFormat().spatialdata_format_version), + "render_shapes": (CurrentShapesFormat.__name__, CurrentShapesFormat().spatialdata_format_version), } for key, fmt in format_types.items(): diff --git a/src/spatialdata_plot/_viewconfig/layout.py b/src/spatialdata_plot/_viewconfig/layout.py index 5ff73246..8a022eb0 100644 --- a/src/spatialdata_plot/_viewconfig/layout.py +++ b/src/spatialdata_plot/_viewconfig/layout.py @@ -1,5 +1,10 @@ +from typing import Any + +from matplotlib.axes import Axes from matplotlib.figure import Figure +from spatialdata_plot._viewconfig.misc import VegaAlignment + def create_padding_object(fig: Figure) -> dict[str, float]: """Get the padding parameters for a vega viewconfiguration. @@ -17,3 +22,33 @@ def create_padding_object(fig: Figure) -> dict[str, float]: "right": ((1 - padding_obj.right) * fig.bbox.width), "bottom": (padding_obj.bottom * fig.bbox.height), } + + +def create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: + """Create a vega title object for a spatialdata view configuration. + + Note that not all field values as obtained from matplotlib are supported by the official + vega specification. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. + fig : Figure + The matplotlib figure. The top level container for all the plot elements. + """ + title_text = ax.get_title() + title_obj = ax.title + title_font = title_obj.get_fontproperties() + + return { + "text": title_text, + "orient": "top", # there is not really a nice conversion here of matplotlib to vega + "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), + "baseline": title_obj.get_va(), + "color": title_obj.get_color(), + "font": title_obj.get_fontname(), + "fontSize": (title_font.get_size() * fig.dpi) / 72, + "fontStyle": title_obj.get_fontstyle(), + "fontWeight": title_font.get_weight(), + } diff --git a/src/spatialdata_plot/_viewconfig/legend.py b/src/spatialdata_plot/_viewconfig/legend.py index e69de29b..5a1d14db 100644 --- a/src/spatialdata_plot/_viewconfig/legend.py +++ b/src/spatialdata_plot/_viewconfig/legend.py @@ -0,0 +1,176 @@ +from typing import Any + +import matplotlib.colors as mcolors +from matplotlib.axes import Axes +from matplotlib.figure import Figure +from matplotlib.text import Text + +from spatialdata_plot._viewconfig.misc import enforce_common_decimal_format +from spatialdata_plot.pl.utils import to_hex_alpha + + +def _create_legend_title_config(title_obj: Text, dpi: float) -> dict[str, Any]: + """Create the vega like legend title object. + + This creates the object containing information pertaining to the legend title. This will be added to the legend + object. + + Parameters + ---------- + title_obj : Text + The legend title object in matplotlib. + dpi: float + dots per inch used to convert fontsizes to from standard unit to size in pixels. + + Returns + ------- + The legend title object. + """ + title_props = title_obj.properties() + return { + "title": title_props["text"], + "titleOrient": "top", + "titleAlign": title_props["horizontalalignment"], + "titleBaseline": title_props["verticalalignment"], + "titleColor": title_props["color"], + "titleFont": title_props["fontname"], + "titleFontSize": (title_props["fontsize"] * dpi) / 72, + "titleFontStyle": title_props["fontstyle"], + "titleFontWeight": title_props["fontweight"], + } + + +def _extract_legend_label_properties(label_texts: list[Text], dpi: float) -> dict[str, Any]: + """Extract common legend properties for reuse.""" + text_props = label_texts[0].properties() + + return { + "labelAlign": text_props["horizontalalignment"], + "labelColor": to_hex_alpha(text_props["color"]), + "labelFont": text_props["fontname"], + "labelFontSize": (text_props["fontsize"] * dpi) / 72, + "labelFontStyle": text_props["fontstyle"], + "labelFontWeight": text_props["fontweight"], + } + + +def create_categorical_legend(fig: Figure, color_scale_array: list[dict[str, Any]], ax: Axes) -> list[dict[str, Any]]: + """Create vega like categorical legend array. + + Parameters + ---------- + fig : Figure + The matplotlib figure. + color_scale_array : list[dict[str, Any]] + The vega like color scale array for which the vega like legend array will be created. + ax : Axes + A matplotlib Axes object. + + Returns + ------- + The vega like categorical legend array. + """ + legend_array: list[dict[str, Any]] = [] + legend = ax.legend() + label_props = _extract_legend_label_properties(legend.get_texts(), fig.dpi) + frame = legend.get_frame() + + for color_object in color_scale_array: + legend_object = { + "type": "discrete", + "direction": "horizontal" if legend._ncols == 0 else "vertical", + "fill": color_object["name"], + "orient": "none", # required by vega usually to explicitly use legend position X and Y + "columns": legend._ncols, + "columnPadding": (legend.columnspacing * fig.dpi) / 72, + "rowPadding": (legend.labelspacing * fig.dpi) / 72, + "padding": (legend.borderpad * fig.dpi) / 72, + "fillColor": to_hex_alpha(frame.get_facecolor()), + "strokeColor": to_hex_alpha(frame.get_edgecolor()), + "strokeWidth": (frame.get_linewidth() * fig.dpi) / 72, + "labelOffset": (legend.handletextpad * fig.dpi) / 72, + **label_props, + "legendX": legend.get_tightbbox().bounds[0], + "legendY": fig.bbox.height - legend.get_tightbbox().bounds[1] - legend.get_tightbbox().bounds[3], + } + + if legend.get_title().get_text() != "": + legend_title_object = _create_legend_title_config(legend.get_title(), fig.dpi) + legend_object |= legend_title_object + + legend_array.append(legend_object) + return legend_array + + +def create_colorbar_legend( + fig: Figure, color_scale_array: list[dict[str, Any]], legend_count: int +) -> list[dict[str, Any]]: + """Create the vega like legend array containing the colorbar information. + + Parameters + ---------- + fig : Figure + The matplotlib figure. + color_scale_array : list[dict[str, Any]] + The vega like color scale array for which the vega like legend array will be created. + legend_count : int + The number of already created legend objects. + + Returns + ------- + The vega like colorbar legend array. + """ + legend_array: list[dict[str, Any]] = [] + cbars = [] + for ax in fig.axes: + cbar = getattr(ax.properties()["axes_locator"], "_cbar", None) if ax.properties()["axes_locator"] else None + if cbar: + cbars.append(cbar) + + if cbars: + for col_config in color_scale_array: + cbar = cbars[legend_count] + + axis_props = cbar.ax.properties() + if cbar.orientation == "vertical": + gradient_length = cbar.ax.get_position().bounds[-1] * fig.get_figheight() * fig.dpi + labels = axis_props["yticklabels"] + else: + gradient_length = cbar.ax.get_position().bounds[-2] * fig.get_figwidth() * fig.dpi + labels = axis_props["xticklabels"] + if col_config["type"] == "linear": + legend_type = "gradient" + + common_props = _extract_legend_label_properties(labels, fig.dpi) + spine_outline = cbar.outline.properties() # outline of the colorbar lining + + stroke_color = mcolors.to_hex(spine_outline["facecolor"]) if spine_outline["facecolor"][-1] > 0 else None + legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) + # TODO: do we require padding? it is not obvious to get from matplotlib + legend_object = { + "type": legend_type, + "direction": cbar.orientation, + "orient": "none", # Required in vega in order to use the x and y position + "fill": color_scale_array[0]["name"], + "fillColor": mcolors.to_hex(cbar.ax.get_facecolor()), + "gradientLength": gradient_length, # alpha if alpha := getattr(cbar.cmap, "_lut", None)[0][-1] else + "gradientOpacity": cbar.mappable.get_alpha(), + "gradientThickness": (cbar.ax.get_position().bounds[2] * fig.dpi) / 72, + "gradientStrokeColor": stroke_color, + "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, + "values": enforce_common_decimal_format(list(cbar.ax.get_yticks())), + # "labelAlign": label["horizontalalignment"], + # "labelColor": mcolors.to_hex(label["color"]), + # "labelFont": label["fontname"], + # "labelFontSize": (label["fontsize"] * fig.dpi) / 72, + # "labelFontStyle": label["fontstyle"], + # "labelFontWeight": label["fontweight"], + "legendX": cbar.ax.get_tightbbox().bounds[0], + "legendY": fig.bbox.height - cbar.ax.get_tightbbox().bounds[1] - cbar.ax.get_tightbbox().bounds[3], + **common_props, + "zindex": axis_props["zorder"], + } + if legend_title_object["title"] != "": + legend_object.update(legend_title_object) + legend_array.append(legend_object) + return legend_array diff --git a/src/spatialdata_plot/_viewconfig/misc.py b/src/spatialdata_plot/_viewconfig/misc.py index a71383d0..60934072 100644 --- a/src/spatialdata_plot/_viewconfig/misc.py +++ b/src/spatialdata_plot/_viewconfig/misc.py @@ -1,3 +1,5 @@ +import re +from collections import Counter from enum import Enum @@ -11,3 +13,20 @@ def from_matplotlib(cls, alignment: str) -> str: """Convert Matplotlib horizontal alignment to Vega alignment.""" mapping = {"left": cls.LEFT, "center": cls.CENTER, "right": cls.RIGHT} return mapping.get(alignment, cls.CENTER).value + + +def _count_trailing(num: float) -> int | None: + str_num = str(num) + if "." in str_num: + return len(str_num.split(".")[1]) + return 0 + + +def enforce_common_decimal_format(values: list[float]) -> list[float]: + most_common_decimal = Counter([_count_trailing(num) for num in values]).most_common(1)[0][0] + return [round(num, most_common_decimal) for num in values] + + +def strip_call(s: str) -> str: + """Strip leading digit and underscore from call name.""" + return re.sub(r"^\d+_", "", s) diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index 5e9e8732..d5f09abc 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -1,6 +1,5 @@ from __future__ import annotations -import re from pathlib import Path from typing import TYPE_CHECKING, Any @@ -8,13 +7,15 @@ from matplotlib.axes import Axes from matplotlib.figure import Figure +from spatialdata_plot._viewconfig.axis import create_axis_block from spatialdata_plot._viewconfig.data import ( create_base_level_sdata_object, create_derived_data_object, create_table_data_object, ) -from spatialdata_plot._viewconfig.layout import create_padding_object -from spatialdata_plot._viewconfig.misc import VegaAlignment +from spatialdata_plot._viewconfig.layout import create_padding_object, create_title_config +from spatialdata_plot._viewconfig.legend import create_categorical_legend, create_colorbar_legend +from spatialdata_plot._viewconfig.misc import strip_call from spatialdata_plot._viewconfig.scales import ( create_axis_scale_array, create_colorscale_array_image, @@ -31,167 +32,9 @@ Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams if TYPE_CHECKING: - from matplotlib.text import Text from spatialdata import SpatialData -def _create_legend_title_config(title_obj: Text, dpi: float) -> dict[str, Any]: - """Create the vega like legend title object. - - This creates the object containing information pertaining to the legend title. This will be added to the legend - object. - - Parameters - ---------- - title_obj : Text - The legend title object in matplotlib. - dpi: float - dots per inch used to convert fontsizes to from standard unit to size in pixels. - - Returns - ------- - The legend title object. - """ - title_props = title_obj.properties() - return { - "title": title_props["text"], - "titleOrient": "top", - "titleAlign": title_props["horizontalalignment"], - "titleBaseline": title_props["verticalalignment"], - "titleColor": title_props["color"], - "titleFont": title_props["fontname"], - "titleFontSize": (title_props["fontsize"] * dpi) / 72, - "titleFontStyle": title_props["fontstyle"], - "titleFontWeight": title_props["fontweight"], - } - - -def _create_categorical_legend(fig: Figure, color_scale_array: list[dict[str, Any]], ax: Axes) -> list[dict[str, Any]]: - """Create vega like categorical legend array. - - Parameters - ---------- - fig : Figure - The matplotlib figure. - color_scale_array : list[dict[str, Any]] - The vega like color scale array for which the vega like legend array will be created. - ax : Axes - A matplotlib Axes object. - - Returns - ------- - The vega like categorical legend array. - """ - legend_array: list[dict[str, Any]] = [] - legend = ax.legend() - legend_bbox_props = legend.get_frame().properties() - legend_bbox = legend.get_tightbbox() - - for color_object in color_scale_array: - fill_color = legend.get_frame().get_facecolor() - legend_object = { - "type": "discrete", - "direction": "horizontal" if legend._ncols == 0 else "vertical", - "fill": color_object["name"], - "orient": "none", - "columns": legend._ncols, - "columnPadding": (legend.columnspacing * fig.dpi) / 72, - "rowPadding": (legend.labelspacing * fig.dpi) / 72, - "fillColor": mcolors.to_hex(fill_color), - "padding": (legend.borderpad * fig.dpi) / 72, - "strokeColor": mcolors.to_hex(legend_bbox_props["edgecolor"]), - "strokeWidth": (legend_bbox_props["linewidth"] * fig.dpi) - / 72, # Different from Vega as vega expects a vega scale here! - "labelAlign": legend.get_texts()[0].get_ha(), - "labelColor": mcolors.to_hex(legend.get_texts()[0].get_color()), - "labelFont": legend.get_texts()[0].get_fontname(), - "labelFontSize": (legend.get_texts()[0].get_fontsize() * fig.dpi) / 72, - "labelFontStyle": legend.get_texts()[0].get_fontstyle(), - "labelFontWeight": legend.get_texts()[0].get_fontweight(), - "labelOffset": (legend.handletextpad * fig.dpi) / 72, - "legendX": legend_bbox.bounds[0], - "legendY": fig.bbox.height - legend_bbox.bounds[1] - legend_bbox.bounds[3], - } - - if legend.get_title().get_text() != "": - legend_title_object = _create_legend_title_config(legend.get_title(), fig.dpi) - legend_object.update(legend_title_object) - - legend_array.append(legend_object) - return legend_array - - -def _create_colorbar_legend( - fig: Figure, color_scale_array: list[dict[str, Any]], legend_count: int -) -> list[dict[str, Any]]: - """Create the vega like legend array containing the colorbar information. - - Parameters - ---------- - fig : Figure - The matplotlib figure. - color_scale_array : list[dict[str, Any]] - The vega like color scale array for which the vega like legend array will be created. - legend_count : int - The number of already created legend objects. - - Returns - ------- - The vega like colorbar legend array. - """ - legend_array: list[dict[str, Any]] = [] - cbars = [] - for ax in fig.axes: - cbar = getattr(ax.properties()["axes_locator"], "_cbar", None) if ax.properties()["axes_locator"] else None - if cbar: - cbars.append(cbar) - - if len(cbars) != 0: - for col_config in color_scale_array: - cbar = cbars[legend_count] - - axis_props = cbar.ax.properties() - if cbar.orientation == "vertical": - gradient_length = cbar.ax.get_position().bounds[-1] * fig.get_figheight() * fig.dpi - label = axis_props["yticklabels"][0].properties() - else: - gradient_length = cbar.ax.get_position().bounds[-2] * fig.get_figwidth() * fig.dpi - label = axis_props["xticklabels"][0].properties() - if col_config["type"] == "linear": - legend_type = "gradient" - spine_outline = cbar.outline.properties() # outline of the colorbar lining - - stroke_color = mcolors.to_hex(spine_outline["facecolor"]) if spine_outline["facecolor"][-1] > 0 else None - legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) - # TODO: do we require padding? it is not obvious to get from matplotlib - legend_object = { - "type": legend_type, - "direction": cbar.orientation, - "orient": "none", # Required in vega in order to use the x and y position - "fill": color_scale_array[0]["name"], - "fillColor": mcolors.to_hex(cbar.ax.get_facecolor()), - "gradientLength": gradient_length, # alpha if alpha := getattr(cbar.cmap, "_lut", None)[0][-1] else - "gradientOpacity": cbar.mappable.get_alpha(), - "gradientThickness": (cbar.ax.get_position().bounds[2] * fig.dpi) / 72, - "gradientStrokeColor": stroke_color, - "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, - "values": list(cbar.ax.get_yticks()), - "labelAlign": label["horizontalalignment"], - "labelColor": mcolors.to_hex(label["color"]), - "labelFont": label["fontname"], - "labelFontSize": (label["fontsize"] * fig.dpi) / 72, - "labelFontStyle": label["fontstyle"], - "labelFontWeight": label["fontweight"], - "legendX": cbar.ax.get_tightbbox().bounds[0], - "legendY": fig.bbox.height - cbar.ax.get_tightbbox().bounds[1] - cbar.ax.get_tightbbox().bounds[3], - "zindex": axis_props["zorder"], - } - if legend_title_object["title"] != "": - legend_object.update(legend_title_object) - legend_array.append(legend_object) - return legend_array - - def _create_scales_legends_marks( fig: Figure, ax: Axes, @@ -218,23 +61,23 @@ def _create_scales_legends_marks( if isinstance(params, ImageRenderParams): # second part to shut up mypy color_scale_array = create_colorscale_array_image(params.cmap_params, data_object["name"], params.channel) - legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) + legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) marks_object = _create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) if isinstance(params, LabelsRenderParams): if params.colortype is not None: color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) - if not mcolors.is_color_like(params.colortype): - legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) + if params.colortype == "continuous": + legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) if isinstance(params.colortype, dict): - legend_array = _create_categorical_legend(fig, color_scale_array, ax) + legend_array = create_categorical_legend(fig, color_scale_array, ax) marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) if isinstance(params, PointsRenderParams | ShapesRenderParams): if params.colortype is not None: color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) if params.colortype == "continuous": - legend_array = _create_colorbar_legend(fig, color_scale_array, legend_count) + legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) if isinstance(params.colortype, dict): - legend_array = _create_categorical_legend(fig, color_scale_array, ax) + legend_array = create_categorical_legend(fig, color_scale_array, ax) if isinstance(params, PointsRenderParams): marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) @@ -484,11 +327,6 @@ def _create_raster_label_marks_object( return labels_object -def strip_call(s: str) -> str: - """Strip leading digit and underscore from call.""" - return re.sub(r"^\d+_", "", s) - - def _create_data_configs( sdata: SpatialData, fig: Figure, ax: Axes, cs: str, sdata_path: str ) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: @@ -509,7 +347,6 @@ def _create_data_configs( sdata_path: str The location of the SpatialData zarr store. """ - data_array = [] marks_array = [] color_scale_array_full: list[dict[str, Any]] = [] legend_array_full = [] @@ -519,7 +356,7 @@ def _create_data_configs( url = sdata_path base_block = create_base_level_sdata_object(url) - data_array.append(base_block) + data_array = [base_block] counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} for call, params in sdata.plotting_tree.items(): @@ -542,120 +379,27 @@ def _create_data_configs( return data_array, marks_array, color_scale_array_full, legend_array_full -def _create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: - """Create a vega title object for a spatialdata view configuration. - - Note that not all field values as obtained from matplotlib are supported by the official - vega specification. - - Parameters - ---------- - ax : Axes - A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. - fig : Figure - The matplotlib figure. The top level container for all the plot elements. - """ - title_text = ax.get_title() - title_obj = ax.title - title_font = title_obj.get_fontproperties() - - return { - "text": title_text, - "orient": "top", # there is not really a nice conversion here of matplotlib to vega - "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), - "baseline": title_obj.get_va(), - "color": title_obj.get_color(), - "font": title_obj.get_fontname(), - "fontSize": (title_font.get_size() * fig.dpi) / 72, - "fontStyle": title_obj.get_fontstyle(), - "fontWeight": title_font.get_weight(), - } - - -def _create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: float) -> list[dict[str, Any]]: - axis_array = [] - for scale in axis_scales_block: - axis_config = {} - axis_config["scale"] = scale["name"] - if scale["name"] == "X_scale": - axis = ax.xaxis - elif scale["name"] == "Y_scale": - axis = ax.yaxis - - axis_props = axis.properties() - - axis_config["orient"] = axis.get_label_position() - - axis_line_props = ax.spines[axis_config["orient"]].properties() - axis_config["domain"] = axis_line_props["visible"] # domain is whether axis line should be visible. - axis_config["domainOpacity"] = axis_line_props["alpha"] if axis_line_props["alpha"] else 1 - axis_config["domainColor"] = mcolors.to_hex(axis_line_props["edgecolor"]) - axis_config["domainWidth"] = (axis_line_props["linewidth"] * dpi) / 72 - axis_config["grid"] = axis_props["tick_params"]["gridOn"] - - # making the assumption here that all gridlines look the same - if axis_config["grid"]: - axis_config["gridOpacity"] = axis_props["gridlines"][0].properties()["alpha"] - axis_config["gridCap"] = axis_props["gridlines"][0].properties()["dash_capstyle"] - grid_color = float(axis_props["gridlines"][0].properties()["markeredgecolor"]) - axis_config["gridColor"] = mcolors.to_hex([grid_color] * 3) - axis_config["gridWidth"] = (axis_props["gridlines"][0].properties()["markeredgewidth"] * dpi) / 72 - axis_config["labelFont"] = axis_props["majorticklabels"][0].get_fontname() - axis_config["labelFontSize"] = (axis_props["majorticklabels"][0].get_size() * dpi) / 72 - axis_config["labelFontStyle"] = axis_props["majorticklabels"][0].get_fontstyle() - axis_config["labelFontWeight"] = axis_props["majorticklabels"][0].get_fontweight() - axis_config["tickCount"] = len(axis_props["ticklocs"]) - if axis_config["tickCount"] != 0: - tick_props = axis_props["ticklines"][0].properties() - axis_config["ticks"] = tick_props["visible"] - axis_config["tickOpacity"] = tick_props["alpha"] if tick_props["alpha"] else 1 - if axis_config["ticks"] and axis_config["tickOpacity"] != 0: - axis_config["tickColor"] = mcolors.to_hex(tick_props["color"]) - axis_config["tickCap"] = tick_props["dash_capstyle"] - axis_config["tickWidth"] = (tick_props["linewidth"] * dpi) / 72 - axis_config["tickSize"] = ( - tick_props["markersize"] * dpi - ) / 72 # also marker edge width, but vega doesn't have an equivalent for that. - - label = axis_props["label_text"] - if label == "": - axis_config["title"] = label - label_props = axis_props["label"].properties() - - axis_config["titleAlign"] = label_props["horizontalalignment"] - axis_config["titleBaseline"] = label_props["verticalalignment"] - axis_config["titleColor"] = mcolors.to_hex(label_props["color"]) - axis_config["titleFont"] = label_props["fontname"] - axis_config["titleFontSize"] = (label_props["fontsize"] * dpi) / 72 - axis_config["titleFontWeight"] = label_props["fontweight"] - axis_config["titleOpacity"] = label_props["alpha"] if label_props["alpha"] else 1 - axis_config["zindex"] = axis_props["zorder"] - - axis_array.append(axis_config) - return axis_array - - def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: Any, cs: str) -> dict[str, Any]: fig = fig_params.fig ax = fig_params.ax data_array, marks_array, color_scale_array, legend_array = _create_data_configs(sdata, fig, ax, cs, sdata._path) scales_array = create_axis_scale_array(ax) - axis_array = _create_axis_block(ax, scales_array, fig.dpi) + axis_array = create_axis_block(ax, scales_array, fig.dpi) scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array # TODO: check why attrs does not respect ordereddict when writing sdata viewconfig = { "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": fig.bbox.height, # matplotlib uses inches, but vega uses absolute pixels + "height": fig.bbox.height, "width": fig.bbox.width, "padding": create_padding_object(fig), - "title": _create_title_config(ax, fig), + "title": create_title_config(ax, fig), "data": data_array, "scales": scales, + "axes": axis_array, } - viewconfig["axes"] = axis_array if len(legend_array) > 0: viewconfig["legend"] = legend_array viewconfig["marks"] = marks_array From 5ef6c252ff3214244f01d71c7888a29b5ea89955 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sat, 5 Apr 2025 15:14:57 +0200 Subject: [PATCH 25/56] marks refactor --- src/spatialdata_plot/_viewconfig/marks.py | 241 ++++++++++++++++++++ src/spatialdata_plot/pl/_viewconfig.py | 255 +--------------------- src/spatialdata_plot/pl/render_params.py | 6 +- 3 files changed, 254 insertions(+), 248 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/marks.py b/src/spatialdata_plot/_viewconfig/marks.py index e69de29b..22691cc8 100644 --- a/src/spatialdata_plot/_viewconfig/marks.py +++ b/src/spatialdata_plot/_viewconfig/marks.py @@ -0,0 +1,241 @@ +from typing import Any + +import matplotlib.colors as mcolors +from matplotlib.axes import Axes + +from spatialdata_plot.pl.render_params import ( + ImageRenderParams, + LabelsRenderParams, + PointsRenderParams, + ShapesRenderParams, +) + + +def _get_marks_fill_color_from_params( + params: PointsRenderParams | ShapesRenderParams, color_scale_array: list[dict[str, Any]] | None +) -> dict[str, Any] | None: + if not color_scale_array and not params.color: + return {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} + if color_scale_array is not None and params.color: + return {"value": mcolors.to_hex(params.color, keep_alpha=False)} + + if color_scale_array and (params.color or params.col_for_color): + if isinstance(params.colortype, dict): + return {"scale": color_scale_array[0]["name"], "field": params.col_for_color} + value = color_scale_array[0]["domain"]["field"] + if isinstance(value, list): + value = value[0] + return {"scale": color_scale_array[0]["name"], "value": value} + return None + + +def _create_encode_update(params: PointsRenderParams | ShapesRenderParams, field_name: str) -> list[dict[str, Any]]: + hex_na = mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False) + update = [ + { + "test": f"!isValid(datum.{params.col_for_color})", + "value": hex_na, + } + ] + + norm = params.cmap_params.norm + cmap = params.cmap_params.cmap + if (norm.vmin is not None or norm.vmax is not None) and ( + cmap.get_under() is not None or cmap.get_over() is not None + ): + if cmap.get_under() is not None: + update.append( + { + "test": f"datum.{field_name}) < {norm.vmin}", + "value": mcolors.to_hex(cmap.get_under(), keep_alpha=False), + } + ) + if cmap.get_over() is not None: + update.append( + { + "test": f"datum.{field_name}) > {norm.vmax}", + "value": mcolors.to_hex(cmap.get_over(), keep_alpha=False), + } + ) + return update + + +def create_raster_image_marks_object( + ax: Axes, + params: ImageRenderParams, + data_object: dict[str, Any], + call_count: int, + color_scale_array: list[dict[str, Any]], +) -> dict[str, Any]: + """Create a vega like marks object for visualizing a SpatialData image element. + + Note that there is no equivalent raster image marks object specification in vega. This is because + vega has no support for visualization of images. + + Parameters + ---------- + ax : Axes + Matplotlib Axes object representing the (sub-) plot in which the SpatialData image element is visualized. + params : ImageRenderParams + The render parameters used for visualizing the SpatialData image element. + data_object : dict[str, Any] + A vega like data object which correspond to the SpatialData image element which is visualized. + call_count : int + The number indicating the index of the render call that visualized the SpatialData image element. + color_scale_array : list[dict[str, Any]] + A vega like array containing the color scale objects containing the information which colors are used + for visualizing the SpatialData image element. + + Returns + ------- + dict[str, Any] + The vega like marks object pertaining to the SpatialData image element that is visualized. + + """ + fill_color = ( + [{"scale": color_scale_array[0]["name"], "value": "value"}] + if len(color_scale_array) == 1 + else [{"scale": cs["name"], "field": f"channel_{i}"} for i, cs in enumerate(color_scale_array)] + ) + return { + "type": "raster_image", + "from": {"data": data_object["name"]}, + "zindex": ax.properties()["images"][call_count].zorder, + "encode": {"enter": {"opacity": {"value": params.alpha}, "fill": fill_color}}, + } + + +def create_shapes_marks_object( + params: ShapesRenderParams, + data_object: dict[str, Any], + color_scale_array: list[dict[str, Any]], +) -> dict[str, Any]: + encode_update = {} + fill_color = _get_marks_fill_color_from_params(params, color_scale_array) + + if color_scale_array and isinstance(params.colortype, dict | str): + field = params.col_for_color or color_scale_array[0]["domain"]["field"] + if isinstance(field, list): + field = field[0] + encode_update["fill"] = _create_encode_update(params, field) + + mark = { + "type": "path", + "from": {"data": data_object["name"]}, + "zindex": params.zorder, + "encode": { + "enter": { + "x": {"scale": "X_scale", "field": "x"}, + "y": {"scale": "Y_scale", "field": "y"}, + "scaleX": params.scale, + "scaleY": params.scale, + "fill": fill_color, + "fillOpacity": {"value": params.fill_alpha}, + } + }, + } + + if encode_update: + mark["encode"]["update"] = encode_update # type: ignore[index] + + if params.outline_params.outline and params.outline_alpha != 0: + outline_par = params.outline_params + stroke_color = {"value": mcolors.to_hex(outline_par.outline_color, keep_alpha=False)} + + mark["encode"]["enter"].update( # type: ignore[index] + { + "stroke": stroke_color, + "strokeWidth": {"value": outline_par.linewidth}, + "strokeOpacity": {"value": params.outline_alpha}, + } + ) + + return mark + + +def create_points_symbol_marks_object( + params: PointsRenderParams, + data_object: dict[str, Any], + color_scale_array: list[dict[str, Any]] | None, +) -> dict[str, Any]: + fill_color = _get_marks_fill_color_from_params(params, color_scale_array) + encode_update = {} + + if color_scale_array and isinstance(params.colortype, dict | str): + field = params.col_for_color or color_scale_array[0]["domain"]["field"] + if isinstance(field, list): + field = field[0] + encode_update["fill"] = _create_encode_update(params, field) + + mark = { + "type": "symbol", + "from": {"data": data_object["name"]}, + "zindex": params.zorder, + "encode": { + "enter": { + "x": {"scale": "X_scale", "field": "x"}, + "y": {"scale": "Y_scale", "field": "y"}, + "stroke": fill_color, + "fill": fill_color, + "fillOpacity": {"value": params.alpha}, + "size": {"value": params.size}, + "shape": {"value": "circle"}, + } + }, + } + + if encode_update: + mark["encode"]["update"] = encode_update # type: ignore[index] + + return mark + + +def create_raster_label_marks_object( + ax: Axes, + params: LabelsRenderParams, + data_object: dict[str, Any], + call_count: int, + color_scale_array: list[dict[str, Any]], +) -> dict[str, Any]: + fill_color = [{"value": params.colortype}] + encode_update = None + + if params.colortype == "continuous": + field = color_scale_array[0]["domain"]["field"][0] + fill_color = [{"scale": color_scale_array[0]["name"], "value": field}] + encode_update = { + "fill": [ + {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": field}, + {"value": params.cmap_params.na_color}, + ] + } + elif isinstance(params.colortype, dict) and color_scale_array is not None: + fill_color = [{"scale": color_scale_array[0]["name"], "value": params.color}] + encode_update = { + "fill": [ + {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": params.color}, + {"value": params.cmap_params.na_color}, + ] + } + elif params.colortype == "random": + fill_color = [{"scale": color_scale_array[0]["name"], "value": "value"}] + + mark = { + "type": "raster_label", + "from": {"data": data_object["name"]}, + "zindex": ax.properties()["images"][call_count].zorder, + "encode": { + "enter": { + "stroke": fill_color, + "fill": fill_color, + "fillOpacity": {"value": params.fill_alpha}, + "strokeOpacity": {"value": params.outline_alpha}, + "strokeWidth": {"value": params.contour_px}, + } + }, + } + + if encode_update: + mark["encode"]["update"] = encode_update + + return mark diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py index d5f09abc..d9915a72 100644 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ b/src/spatialdata_plot/pl/_viewconfig.py @@ -3,7 +3,6 @@ from pathlib import Path from typing import TYPE_CHECKING, Any -import matplotlib.colors as mcolors from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -15,6 +14,12 @@ ) from spatialdata_plot._viewconfig.layout import create_padding_object, create_title_config from spatialdata_plot._viewconfig.legend import create_categorical_legend, create_colorbar_legend +from spatialdata_plot._viewconfig.marks import ( + create_points_symbol_marks_object, + create_raster_image_marks_object, + create_raster_label_marks_object, + create_shapes_marks_object, +) from spatialdata_plot._viewconfig.misc import strip_call from spatialdata_plot._viewconfig.scales import ( create_axis_scale_array, @@ -62,7 +67,7 @@ def _create_scales_legends_marks( if isinstance(params, ImageRenderParams): # second part to shut up mypy color_scale_array = create_colorscale_array_image(params.cmap_params, data_object["name"], params.channel) legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) - marks_object = _create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) + marks_object = create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) if isinstance(params, LabelsRenderParams): if params.colortype is not None: color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) @@ -70,7 +75,7 @@ def _create_scales_legends_marks( legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) if isinstance(params.colortype, dict): legend_array = create_categorical_legend(fig, color_scale_array, ax) - marks_object = _create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) + marks_object = create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) if isinstance(params, PointsRenderParams | ShapesRenderParams): if params.colortype is not None: color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) @@ -80,253 +85,13 @@ def _create_scales_legends_marks( legend_array = create_categorical_legend(fig, color_scale_array, ax) if isinstance(params, PointsRenderParams): - marks_object = _create_points_symbol_marks_object(ax, params, data_object, call_count, color_scale_array) + marks_object = create_points_symbol_marks_object(params, data_object, color_scale_array) else: - marks_object = _create_shapes_marks_object(ax, params, data_object, call_count, color_scale_array) + marks_object = create_shapes_marks_object(params, data_object, color_scale_array) return marks_object, color_scale_array, legend_array -def _create_raster_image_marks_object( - ax: Axes, - params: ImageRenderParams, - data_object: dict[str, Any], - call_count: int, - color_scale_array: list[dict[str, Any]], -) -> dict[str, Any]: - if len(color_scale_array) == 1: - fill_color = [{"scale": color_scale_array[0]["name"], "value": "value"}] - else: - fill_color = [ - {"scale": color_scale["name"], "field": f"channel_{index}"} - for index, color_scale in enumerate(color_scale_array) - ] - - return { - "type": "raster_image", - "from": {"data": data_object["name"]}, - "zindex": ax.properties()["images"][call_count].zorder, - "encode": { - "enter": { - "opacity": {"value": params.alpha}, - "fill": fill_color, - } - }, - } - - -def _create_shapes_marks_object( - ax: Axes, - params: ShapesRenderParams, - data_object: dict[str, Any], - call_count: int, - color_scale_array: list[dict[str, Any]], -) -> dict[str, Any]: - encode_update = None - if not color_scale_array and not params.color: - fill_color = {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} - elif not color_scale_array and params.color: - fill_color = {"value": mcolors.to_hex(params.color, keep_alpha=False)} - elif color_scale_array and (params.color or params.col_for_color): - if isinstance(params.colortype, dict): - encode_update = { - "fill": [ - { - "test": f"!isValid(datum.{params.col_for_color})", - "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), - } - ] - } - fill_color = {"scale": color_scale_array[0]["name"], "field": params.col_for_color} - else: - value = val[0] if isinstance(val := color_scale_array[0]["domain"]["field"], list) else val - fill_color = {"scale": color_scale_array[0]["name"], "value": value} - encode_update = {"fill": []} - encode_update["fill"].append( - { - "test": f"!isValid(datum.{params.col_for_color})", - "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), - } - ) - if (params.cmap_params.norm.vmin is not None or params.cmap_params.norm.vmax is not None) and ( - params.cmap_params.cmap.get_under() is not None or params.cmap_params.cmap.get_over() is not None - ): - # or condition doesn't reach second condition if first condition is met - under_col = params.cmap_params.cmap.get_under() - over_col = params.cmap_params.cmap.get_over() - if under_col is not None: - encode_update["fill"].append( - { - "test": f"datum.{value}) < {params.cmap_params.norm.vmin}", - "value": mcolors.to_hex(under_col, keep_alpha=False), - } - ) - if over_col is not None: - encode_update["fill"].append( - { - "test": f"datum.{value}) > {params.cmap_params.norm.vmax}", - "value": mcolors.to_hex(over_col, keep_alpha=False), - } - ) - - shapes_object = { - "type": "path", - "from": {"data": data_object["name"]}, - "zindex": params.zorder, - "encode": { - "enter": { - "x": {"scale": "X_scale", "field": "x"}, - "y": {"scale": "Y_scale", "field": "y"}, - "scaleX": params.scale, - "scaleY": params.scale, - "fill": fill_color, - "fillOpacity": {"value": params.fill_alpha}, - } - }, - } - - if params.outline_params.outline and params.outline_alpha != 0: - outline_par = params.outline_params - stroke_color = {"value": mcolors.to_hex(outline_par.outline_color, keep_alpha=False)} - - shapes_object["encode"]["enter"].update( # type: ignore[index] - { - "stroke": stroke_color, - "strokeWidth": {"value": outline_par.linewidth}, - "strokeOpacity": {"value": params.outline_alpha}, - } - ) - - return shapes_object - - -def _create_points_symbol_marks_object( - ax: Axes, - params: PointsRenderParams, - data_object: dict[str, Any], - call_count: int, - color_scale_array: list[dict[str, Any]] | None, -) -> dict[str, Any]: - encode_update = {} - if not color_scale_array and not params.color: - fill_color = {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} - elif not color_scale_array and params.color: - fill_color = {"value": mcolors.to_hex(params.color, keep_alpha=False)} - elif color_scale_array and (params.color or params.col_for_color): - if isinstance(params.colortype, dict): - encode_update["fill"] = [ - { - "test": f"!isValid(datum.{params.col_for_color})", - "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), - } - ] - fill_color = {"scale": color_scale_array[0]["name"], "field": params.col_for_color} - else: - value = val[0] if isinstance(val := color_scale_array[0]["domain"]["field"], list) else val - fill_color = {"scale": color_scale_array[0]["name"], "value": value} - # encode_update = {"fill": []} - encode_update["fill"] = [ - { - "test": f"!isValid(datum.{params.col_for_color})", - "value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False), - } - ] - - if (params.cmap_params.norm.vmin is not None or params.cmap_params.norm.vmax is not None) and ( - params.cmap_params.cmap.get_under() is not None or params.cmap_params.cmap.get_over() is not None - ): - # or condition doesn't reach second condition if first condition is met - under_col = params.cmap_params.cmap.get_under() - over_col = params.cmap_params.cmap.get_over() - if under_col is not None: - encode_update["fill"].append( - { - "test": f"datum.{value}) < {params.cmap_params.norm.vmin}", - "value": mcolors.to_hex(under_col, keep_alpha=False), - } - ) - if over_col is not None: - encode_update["fill"].append( - { - "test": f"datum.{value}) > {params.cmap_params.norm.vmax}", - "value": mcolors.to_hex(over_col, keep_alpha=False), - } - ) - - points_object = { - "type": "symbol", - "from": {"data": data_object["name"]}, - "zindex": params.zorder, - "encode": { - "enter": { - "x": {"scale": "X_scale", "field": "x"}, - "y": {"scale": "Y_scale", "field": "y"}, - "stroke": fill_color, - "fill": fill_color, - "fillOpacity": {"value": params.alpha}, - "size": {"value": params.size}, - "shape": {"value": "circle"}, - } - }, - } - if encode_update: - # TODO: check if we can give info that na-color is used prior to adding this. If so then add if conditional. - points_object["encode"]["update"] = encode_update # type: ignore[index] - - return points_object - - -def _create_raster_label_marks_object( - ax: Axes, - params: LabelsRenderParams, - data_object: dict[str, Any], - call_count: int, - color_scale_array: list[dict[str, Any]], -) -> dict[str, Any]: - - if params.colortype == "continuous": - color_col = color_scale_array[0]["domain"]["field"][0] - fill_color = [{"scale": color_scale_array[0]["name"], "value": color_col}] - encode_update = { - "fill": [ - {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": color_col}, - {"value": params.cmap_params.na_color}, - ] - } - if isinstance(params.colortype, dict): - color_col = params.color - fill_color = [{"scale": color_scale_array[0]["name"], "value": color_col}] - encode_update = { - "fill": [ - {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": color_col}, - {"value": params.cmap_params.na_color}, - ] - } - if params.colortype == "random": - fill_color = [{"scale": color_scale_array[0]["name"], "value": "value"}] - if mcolors.is_color_like(params.colortype): - fill_color = [{"value": params.colortype}] - - labels_object = { - "type": "raster_label", - "from": {"data": data_object["name"]}, - "zindex": ax.properties()["images"][call_count].zorder, - "encode": { - "enter": { - "stroke": fill_color, - "fill": fill_color, - "fillOpacity": {"value": params.fill_alpha}, - "strokeOpacity": {"value": params.outline_alpha}, - "strokeWidth": {"value": params.contour_px}, - } - }, - } - - if params.colortype == "continuous": - labels_object["encode"]["update"] = encode_update - return labels_object - - def _create_data_configs( sdata: SpatialData, fig: Figure, ax: Axes, cs: str, sdata_path: str ) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index 3fe4c0fd..981f77e4 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -79,7 +79,7 @@ class ShapesRenderParams: element: str color: str | None = None col_for_color: str | None = None - colortype: str | dict[str, str] | Literal["continuous"] | None = None + colortype: str | dict[str, str] | None = None groups: str | list[str] | None = None contour_px: int | None = None palette: ListedColormap | list[str] | None = None @@ -103,7 +103,7 @@ class PointsRenderParams: element: str color: str | None = None col_for_color: str | None = None - colortype: str | dict[str, str] | Literal["continuous"] | None = None + colortype: str | dict[str, str] | None = None groups: str | list[str] | None = None palette: ListedColormap | list[str] | None = None alpha: float = 1.0 @@ -148,4 +148,4 @@ class LabelsRenderParams: table_name: str | None = None table_layer: str | None = None zorder: int = 0 - colortype: dict[str, str] | Literal["continuous" | "random"] | None = None + colortype: dict[str, str] | str | None = None From 186d2a3d8eb6bf286124d14db3b755956908bf2b Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 6 Apr 2025 13:45:55 +0200 Subject: [PATCH 26/56] add docstrings --- src/spatialdata_plot/_viewconfig/marks.py | 100 +++++++++++++++++++++- 1 file changed, 96 insertions(+), 4 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/marks.py b/src/spatialdata_plot/_viewconfig/marks.py index 22691cc8..deb014cd 100644 --- a/src/spatialdata_plot/_viewconfig/marks.py +++ b/src/spatialdata_plot/_viewconfig/marks.py @@ -11,9 +11,24 @@ ) -def _get_marks_fill_color_from_params( +def _create_marks_fill_color_from_params( params: PointsRenderParams | ShapesRenderParams, color_scale_array: list[dict[str, Any]] | None ) -> dict[str, Any] | None: + """ + Create the fill color object for a vega like mark for a points or shapes element. + + Parameters + ---------- + params : PointsRenderParams | ShapesRenderParams + The render parameters used for visualizing the SpatialData points or shapes element. + color_scale_array : list[dict[str, Any]] + The vega like color scale array containing the color scale used in the vega like mark object. + + Returns + ------- + list[dict[str, Any]] | None + The fill color object for the points or shapes element. + """ if not color_scale_array and not params.color: return {"value": mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False)} if color_scale_array is not None and params.color: @@ -30,6 +45,22 @@ def _get_marks_fill_color_from_params( def _create_encode_update(params: PointsRenderParams | ShapesRenderParams, field_name: str) -> list[dict[str, Any]]: + """Create the encode update object for a vega like mark for a points or shapes element. + + This object is only created when either a column used to color the mark has a value of NaN or when the + provided colormap does not perform clipping and values of the column fall beyond the range of vmin and vmax. + + Parameters + ---------- + params : PointsRenderParams | ShapesRenderParams + The render parameters used for visualizing the SpatialData points or shapes element. + field_name : str + The name of the column used to color the data. + + Returns + ------- + The encode update object for the points or shapes element. + """ hex_na = mcolors.to_hex(params.cmap_params.na_color, keep_alpha=False) update = [ { @@ -90,7 +121,6 @@ def create_raster_image_marks_object( ------- dict[str, Any] The vega like marks object pertaining to the SpatialData image element that is visualized. - """ fill_color = ( [{"scale": color_scale_array[0]["name"], "value": "value"}] @@ -110,8 +140,27 @@ def create_shapes_marks_object( data_object: dict[str, Any], color_scale_array: list[dict[str, Any]], ) -> dict[str, Any]: + """Create a vega like marks object for visualizing a SpatialData shapes element. + + Note that the mark object differs from a vega like mark object in the way that the data is defined. + + Parameters + ---------- + params : ShapesRenderParams + The render parameters used for visualizing the SpatialData shapes element. + data_object : dict[str, Any] + A vega like data object which correspond to the SpatialData shapes element which is visualized. + color_scale_array : list[dict[str, Any]] + A vega like array containing the color scale objects containing the information which colors are used + for visualizing the SpatialData shapes element. + + Returns + ------- + dict[str, Any] + The vega like marks object pertaining to the SpatialData shapes element that is visualized. + """ encode_update = {} - fill_color = _get_marks_fill_color_from_params(params, color_scale_array) + fill_color = _create_marks_fill_color_from_params(params, color_scale_array) if color_scale_array and isinstance(params.colortype, dict | str): field = params.col_for_color or color_scale_array[0]["domain"]["field"] @@ -158,7 +207,26 @@ def create_points_symbol_marks_object( data_object: dict[str, Any], color_scale_array: list[dict[str, Any]] | None, ) -> dict[str, Any]: - fill_color = _get_marks_fill_color_from_params(params, color_scale_array) + """Create a vega like marks object for visualizing a SpatialData points element. + + Note that the mark object differs from a vega like mark object in the way that the data is defined. + + Parameters + ---------- + params : PointsRenderParams + The render parameters used for visualizing the SpatialData points element. + data_object : dict[str, Any] + A vega like data object which correspond to the SpatialData points element which is visualized. + color_scale_array : list[dict[str, Any]] + A vega like array containing the color scale objects containing the information which colors are used + for visualizing the SpatialData points element. + + Returns + ------- + dict[str, Any] + The vega like marks object pertaining to the SpatialData points element that is visualized. + """ + fill_color = _create_marks_fill_color_from_params(params, color_scale_array) encode_update = {} if color_scale_array and isinstance(params.colortype, dict | str): @@ -197,6 +265,30 @@ def create_raster_label_marks_object( call_count: int, color_scale_array: list[dict[str, Any]], ) -> dict[str, Any]: + """Create a vega like marks object for visualizing a SpatialData image element. + + Note that there is no equivalent raster image marks object specification in vega. This is because + vega has no support for visualization of labels. + + Parameters + ---------- + ax : Axes + Matplotlib Axes object representing the (sub-) plot in which the SpatialData labels element is visualized. + params : ImageRenderParams + The render parameters used for visualizing the SpatialData labels element. + data_object : dict[str, Any] + A vega like data object which correspond to the SpatialData labels element which is visualized. + call_count : int + The number indicating the index of the render call that visualized the SpatialData labels element. + color_scale_array : list[dict[str, Any]] + A vega like array containing the color scale objects containing the information which colors are used + for visualizing the SpatialData labels element. + + Returns + ------- + dict[str, Any] + The vega like marks object pertaining to the SpatialData labels element that is visualized. + """ fill_color = [{"value": params.colortype}] encode_update = None From 7525a4c608139dd6a284c4fb37dd7950daf993a9 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 6 Apr 2025 13:56:47 +0200 Subject: [PATCH 27/56] remove commented code --- src/spatialdata_plot/_viewconfig/legend.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/legend.py b/src/spatialdata_plot/_viewconfig/legend.py index 5a1d14db..8bc27759 100644 --- a/src/spatialdata_plot/_viewconfig/legend.py +++ b/src/spatialdata_plot/_viewconfig/legend.py @@ -159,18 +159,12 @@ def create_colorbar_legend( "gradientStrokeColor": stroke_color, "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, "values": enforce_common_decimal_format(list(cbar.ax.get_yticks())), - # "labelAlign": label["horizontalalignment"], - # "labelColor": mcolors.to_hex(label["color"]), - # "labelFont": label["fontname"], - # "labelFontSize": (label["fontsize"] * fig.dpi) / 72, - # "labelFontStyle": label["fontstyle"], - # "labelFontWeight": label["fontweight"], + **common_props, "legendX": cbar.ax.get_tightbbox().bounds[0], "legendY": fig.bbox.height - cbar.ax.get_tightbbox().bounds[1] - cbar.ax.get_tightbbox().bounds[3], - **common_props, "zindex": axis_props["zorder"], } if legend_title_object["title"] != "": - legend_object.update(legend_title_object) + legend_object |= legend_title_object legend_array.append(legend_object) return legend_array From 2d496c5cd1def13cddfef0440b8048093b6ee4e0 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 6 Apr 2025 17:56:38 +0200 Subject: [PATCH 28/56] refactor viewconfig --- src/spatialdata_plot/_viewconfig/config.py | 267 +++++++++++++++++++++ src/spatialdata_plot/_viewconfig/layout.py | 54 ----- src/spatialdata_plot/pl/_viewconfig.py | 172 ------------- src/spatialdata_plot/pl/basic.py | 4 +- 4 files changed, 269 insertions(+), 228 deletions(-) create mode 100644 src/spatialdata_plot/_viewconfig/config.py delete mode 100644 src/spatialdata_plot/_viewconfig/layout.py delete mode 100644 src/spatialdata_plot/pl/_viewconfig.py diff --git a/src/spatialdata_plot/_viewconfig/config.py b/src/spatialdata_plot/_viewconfig/config.py new file mode 100644 index 00000000..ef4da779 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/config.py @@ -0,0 +1,267 @@ +from pathlib import Path +from typing import Any + +from matplotlib.axes import Axes +from matplotlib.figure import Figure +from spatialdata import SpatialData + +from spatialdata_plot._viewconfig.axis import create_axis_block +from spatialdata_plot._viewconfig.data import ( + create_base_level_sdata_object, + create_derived_data_object, + create_table_data_object, +) +from spatialdata_plot._viewconfig.legend import create_categorical_legend, create_colorbar_legend +from spatialdata_plot._viewconfig.marks import ( + create_points_symbol_marks_object, + create_raster_image_marks_object, + create_raster_label_marks_object, + create_shapes_marks_object, +) +from spatialdata_plot._viewconfig.misc import VegaAlignment, strip_call +from spatialdata_plot._viewconfig.scales import ( + create_axis_scale_array, + create_colorscale_array_image, + create_colorscale_array_points_shapes_labels, +) +from spatialdata_plot.pl.render_params import ( + FigParams, + ImageRenderParams, + LabelsRenderParams, + PointsRenderParams, + ShapesRenderParams, +) + +Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams + + +def _colortype_to_scale_legend( + fig: Figure, + ax: Axes, + params: LabelsRenderParams | PointsRenderParams | ShapesRenderParams, + data_object: dict[str, Any], + legend_count: int, +) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]: + color_scale_array = [] + legend_array = [] + + if params.colortype is not None: + color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) + if params.colortype == "continuous": + legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) + elif isinstance(params.colortype, dict): + legend_array = create_categorical_legend(fig, color_scale_array, ax) + + return color_scale_array, legend_array + + +def create_padding_object(fig: Figure) -> dict[str, float]: + """Get the padding parameters for a vega viewconfiguration. + + Parameters + ---------- + fig : Figure + The matplotlib figure. The top level container for all the plot elements. + """ + # contains also wspace and hspace but does not seem to be used by vega here. + padding_obj = fig.subplotpars + return { + "left": (padding_obj.left * fig.bbox.width), + "top": ((1 - padding_obj.top) * fig.bbox.height), + "right": ((1 - padding_obj.right) * fig.bbox.width), + "bottom": (padding_obj.bottom * fig.bbox.height), + } + + +def create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: + """Create a vega title object for a spatialdata view configuration. + + Note that not all field values as obtained from matplotlib are supported by the official + vega specification. + + Parameters + ---------- + ax : Axes + A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. + fig : Figure + The matplotlib figure. The top level container for all the plot elements. + """ + title_text = ax.get_title() + title_obj = ax.title + title_font = title_obj.get_fontproperties() + + return { + "text": title_text, + "orient": "top", # there is not really a nice conversion here of matplotlib to vega + "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), + "baseline": title_obj.get_va(), + "color": title_obj.get_color(), + "font": title_obj.get_fontname(), + "fontSize": (title_font.get_size() * fig.dpi) / 72, + "fontStyle": title_obj.get_fontstyle(), + "fontWeight": title_font.get_weight(), + } + + +def _create_scales_legends_marks( + fig: Figure, + ax: Axes, + data_object: dict[str, Any], + params: Params, + call_count: int, + legend_count: int = 0, +) -> tuple[dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]: + """Create vega like scales, legend and mark arrays for the viewconfiguration. + + Parameters + ---------- + fig : Figure + The matplotlib figure. + ax : Axes + Matplotlib Axes object representing the (sub-) plot in which the SpatialData labels element is visualized. + data_object: dict[str, Any] + A vega like data object pertaining to a Spatialdata element that is visualized. + params: Params + The render parameters used in spatialdata-plot for the particular type of SpatialData + element. + call_count : int + The number indicating the index of the render call that visualized the SpatialData element. + legend_count : int + The number of already created legend objects. + + Returns + ------- + marks_object : dict[str, Any] + The vega like marks object for a given spatialdata element. + color_scale_array : list[dict[str, Any]] + An array of vega like color scale object containing the information for applying colors to a mark + legend_array : list[dict[str, Any]] + An array of vega like legend objects for a given spatialdata element colored based on a given + color object. + """ + marks_object: dict[str, Any] = {} + color_scale_array: list[dict[str, Any]] = [] + legend_array: list[dict[str, Any]] = [] + + match params: + case ImageRenderParams(): + color_scale_array = create_colorscale_array_image(params.cmap_params, data_object["name"], params.channel) + legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) + marks_object = create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) + case LabelsRenderParams() | PointsRenderParams() | ShapesRenderParams(): + color_scale_array, legend_array = _colortype_to_scale_legend(fig, ax, params, data_object, legend_count) + + match params: + case LabelsRenderParams(): + marks_object = create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) + case PointsRenderParams(): + marks_object = create_points_symbol_marks_object(params, data_object, color_scale_array) + case ShapesRenderParams(): + marks_object = create_shapes_marks_object(params, data_object, color_scale_array) + + return marks_object, color_scale_array, legend_array + + +def _create_data_configs( + sdata: SpatialData, fig: Figure, ax: Axes, cs: str, sdata_path: str +) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: + """Create the vega json array value to the data key. + + The data array in the SpatialData vegalike viewconfig consists out of + an object for the base level of the SpatialData zarr store and subsequently + derived individual SpatialData elements. + + Parameters + ---------- + sdata : SpatialData + The SpatialData object from which elements are visualized. + fig : Figure + The matplotlib figure. + ax : Axes + Matplotlib Axes object representing the (sub-) plot in which the SpatialData labels element is visualized. + cs: str + The name of the coordinate system in which the SpatialData elements were plotted. + sdata_path: str + The location of the SpatialData zarr store. + + Returns + ------- + data_array : list[dict[str, Any]] + An array of vega like data objects pertaining to visualized SpatialData elements. + marks_array: list[dict[str, Any]] + An array of vega like marks objects, each pertaining to one render call. + color_scale_array_full : list[dict[str, Any]] + An array of vega like color scale objects, each containing information regarding the coloring + used to visualize a particular SpatialData element. + legend_array_full: list[dict[str, Any]] + An array of vega like legend objects, each pertaining to one legend. + """ + marks_array = [] + color_scale_array_full: list[dict[str, Any]] = [] + legend_array_full = [] + url = str(Path("sdata.zarr")) + + if sdata_path: + url = sdata_path + + base_block = create_base_level_sdata_object(url) + data_array = [base_block] + + counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} + for call, params in sdata.plotting_tree.items(): + call = strip_call(call) + table_id = None + if table := getattr(params, "table_name", None): + data_array.append(create_table_data_object(table, base_block["name"], params.table_layer)) + table_id = data_array[-1]["name"] + data_array.append(create_derived_data_object(sdata, call, params, base_block["name"], cs, table_id)) + marks_object, color_scale_array, legend_array = _create_scales_legends_marks( + fig, ax, data_array[-1], params, counters[call], len(color_scale_array_full) + ) + + marks_array.append(marks_object) + if color_scale_array: + color_scale_array_full += color_scale_array + legend_array_full += legend_array + counters[call] += 1 + + return data_array, marks_array, color_scale_array_full, legend_array_full + + +def create_viewconfig(sdata: SpatialData, fig_params: FigParams, cs: str) -> dict[str, Any]: + """Create a vega like view configuration based on the spatialdata-plot visualization. + + Parameters + ---------- + sdata : SpatialData + The SpatialData object from which elements are visualized. + fig_params : FigParams + The figure parameters containing for example the matplotlib figure and axes. + cs: str + The name of the coordinate system in which the SpatialData elements were plotted. + """ + fig = fig_params.fig + ax = fig_params.ax + data_array, marks_array, color_scale_array, legend_array = _create_data_configs(sdata, fig, ax, cs, sdata._path) + + scales_array = create_axis_scale_array(ax) + axis_array = create_axis_block(ax, scales_array, fig.dpi) + + scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array + + viewconfig = { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": fig.bbox.height, + "width": fig.bbox.width, + "padding": create_padding_object(fig), + "title": create_title_config(ax, fig), + "data": data_array, + "scales": scales, + "axes": axis_array, + } + + if len(legend_array) > 0: + viewconfig["legend"] = legend_array + viewconfig["marks"] = marks_array + + return viewconfig diff --git a/src/spatialdata_plot/_viewconfig/layout.py b/src/spatialdata_plot/_viewconfig/layout.py deleted file mode 100644 index 8a022eb0..00000000 --- a/src/spatialdata_plot/_viewconfig/layout.py +++ /dev/null @@ -1,54 +0,0 @@ -from typing import Any - -from matplotlib.axes import Axes -from matplotlib.figure import Figure - -from spatialdata_plot._viewconfig.misc import VegaAlignment - - -def create_padding_object(fig: Figure) -> dict[str, float]: - """Get the padding parameters for a vega viewconfiguration. - - Parameters - ---------- - fig : Figure - The matplotlib figure. The top level container for all the plot elements. - """ - # contains also wspace and hspace but does not seem to be used by vega here. - padding_obj = fig.subplotpars - return { - "left": (padding_obj.left * fig.bbox.width), - "top": ((1 - padding_obj.top) * fig.bbox.height), - "right": ((1 - padding_obj.right) * fig.bbox.width), - "bottom": (padding_obj.bottom * fig.bbox.height), - } - - -def create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: - """Create a vega title object for a spatialdata view configuration. - - Note that not all field values as obtained from matplotlib are supported by the official - vega specification. - - Parameters - ---------- - ax : Axes - A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. - fig : Figure - The matplotlib figure. The top level container for all the plot elements. - """ - title_text = ax.get_title() - title_obj = ax.title - title_font = title_obj.get_fontproperties() - - return { - "text": title_text, - "orient": "top", # there is not really a nice conversion here of matplotlib to vega - "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), - "baseline": title_obj.get_va(), - "color": title_obj.get_color(), - "font": title_obj.get_fontname(), - "fontSize": (title_font.get_size() * fig.dpi) / 72, - "fontStyle": title_obj.get_fontstyle(), - "fontWeight": title_font.get_weight(), - } diff --git a/src/spatialdata_plot/pl/_viewconfig.py b/src/spatialdata_plot/pl/_viewconfig.py deleted file mode 100644 index d9915a72..00000000 --- a/src/spatialdata_plot/pl/_viewconfig.py +++ /dev/null @@ -1,172 +0,0 @@ -from __future__ import annotations - -from pathlib import Path -from typing import TYPE_CHECKING, Any - -from matplotlib.axes import Axes -from matplotlib.figure import Figure - -from spatialdata_plot._viewconfig.axis import create_axis_block -from spatialdata_plot._viewconfig.data import ( - create_base_level_sdata_object, - create_derived_data_object, - create_table_data_object, -) -from spatialdata_plot._viewconfig.layout import create_padding_object, create_title_config -from spatialdata_plot._viewconfig.legend import create_categorical_legend, create_colorbar_legend -from spatialdata_plot._viewconfig.marks import ( - create_points_symbol_marks_object, - create_raster_image_marks_object, - create_raster_label_marks_object, - create_shapes_marks_object, -) -from spatialdata_plot._viewconfig.misc import strip_call -from spatialdata_plot._viewconfig.scales import ( - create_axis_scale_array, - create_colorscale_array_image, - create_colorscale_array_points_shapes_labels, -) -from spatialdata_plot.pl.render_params import ( - FigParams, - ImageRenderParams, - LabelsRenderParams, - PointsRenderParams, - ShapesRenderParams, -) - -Params = ImageRenderParams | LabelsRenderParams | PointsRenderParams | ShapesRenderParams - -if TYPE_CHECKING: - from spatialdata import SpatialData - - -def _create_scales_legends_marks( - fig: Figure, - ax: Axes, - data_object: dict[str, Any], - params: Params, - call_count: int, - legend_count: int = 0, -) -> tuple[dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]: - """Create vega like data object for SpatialData elements. - - Each object for a SpatialData element contains an additional transform that - is not entirely corresponding to the vega spec but aims to allow for retrieving - the specific element and transforming it to a particular coordinate space. - - Parameters - ---------- - params: Params - The render parameters used in spatialdata-plot for the particular type of SpatialData - element. - """ - marks_object: dict[str, Any] = {} - color_scale_array: list[dict[str, Any]] = [] - legend_array: list[dict[str, Any]] = [] - - if isinstance(params, ImageRenderParams): # second part to shut up mypy - color_scale_array = create_colorscale_array_image(params.cmap_params, data_object["name"], params.channel) - legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) - marks_object = create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) - if isinstance(params, LabelsRenderParams): - if params.colortype is not None: - color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) - if params.colortype == "continuous": - legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) - if isinstance(params.colortype, dict): - legend_array = create_categorical_legend(fig, color_scale_array, ax) - marks_object = create_raster_label_marks_object(ax, params, data_object, call_count, color_scale_array) - if isinstance(params, PointsRenderParams | ShapesRenderParams): - if params.colortype is not None: - color_scale_array = create_colorscale_array_points_shapes_labels(params.colortype, params, data_object) - if params.colortype == "continuous": - legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) - if isinstance(params.colortype, dict): - legend_array = create_categorical_legend(fig, color_scale_array, ax) - - if isinstance(params, PointsRenderParams): - marks_object = create_points_symbol_marks_object(params, data_object, color_scale_array) - else: - marks_object = create_shapes_marks_object(params, data_object, color_scale_array) - - return marks_object, color_scale_array, legend_array - - -def _create_data_configs( - sdata: SpatialData, fig: Figure, ax: Axes, cs: str, sdata_path: str -) -> tuple[list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]], list[dict[str, Any]]]: - """Create the vega json array value to the data key. - - The data array in the SpatialData vegalike viewconfig consists out of - an object for the base level of the SpatialData zarr store and subsequently - derived individual SpatialData elements. - - Parameters - ---------- - plotting_tree: OrderedDict[str, Params] - Dictionary with as keys the render calls prefixed with the index of the render call. Render calls are either - render_images, render_labels, render_points, or render_shapes. The values in the dict are the parameters - corresponding to the render call. - cs: str - The name of the coordinate system in which the SpatialData elements were plotted. - sdata_path: str - The location of the SpatialData zarr store. - """ - marks_array = [] - color_scale_array_full: list[dict[str, Any]] = [] - legend_array_full = [] - url = str(Path("sdata.zarr")) - - if sdata_path: - url = sdata_path - - base_block = create_base_level_sdata_object(url) - data_array = [base_block] - - counters = {"render_images": 0, "render_labels": 0, "render_points": 0, "render_shapes": 0} - for call, params in sdata.plotting_tree.items(): - call = strip_call(call) - table_id = None - if table := getattr(params, "table_name", None): - data_array.append(create_table_data_object(table, base_block["name"], params.table_layer)) - table_id = data_array[-1]["name"] - data_array.append(create_derived_data_object(sdata, call, params, base_block["name"], cs, table_id)) - marks_object, color_scale_array, legend_array = _create_scales_legends_marks( - fig, ax, data_array[-1], params, counters[call], len(color_scale_array_full) - ) - - marks_array.append(marks_object) - if color_scale_array: - color_scale_array_full += color_scale_array - legend_array_full += legend_array - counters[call] += 1 - - return data_array, marks_array, color_scale_array_full, legend_array_full - - -def create_viewconfig(sdata: SpatialData, fig_params: FigParams, legend_params: Any, cs: str) -> dict[str, Any]: - fig = fig_params.fig - ax = fig_params.ax - data_array, marks_array, color_scale_array, legend_array = _create_data_configs(sdata, fig, ax, cs, sdata._path) - - scales_array = create_axis_scale_array(ax) - axis_array = create_axis_block(ax, scales_array, fig.dpi) - - scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array - # TODO: check why attrs does not respect ordereddict when writing sdata - viewconfig = { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": fig.bbox.height, - "width": fig.bbox.width, - "padding": create_padding_object(fig), - "title": create_title_config(ax, fig), - "data": data_array, - "scales": scales, - "axes": axis_array, - } - - if len(legend_array) > 0: - viewconfig["legend"] = legend_array - viewconfig["marks"] = marks_array - - return viewconfig diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 728a16f6..b4d464d3 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -26,7 +26,7 @@ import spatialdata_plot.config from spatialdata_plot._accessor import register_spatial_data_accessor -from spatialdata_plot.pl._viewconfig import create_viewconfig +from spatialdata_plot._viewconfig.config import create_viewconfig from spatialdata_plot.pl.render import ( _render_images, _render_labels, @@ -1091,7 +1091,7 @@ def _concat_viewconfig( viewconfig: list[dict[str, Any]] | None = None if store_viewconfig_in_attrs or store_viewconfig_to_disk: - viewconfig = [create_viewconfig(sdata, fig_params, legend_params, store_viewconfig_cs)] + viewconfig = [create_viewconfig(sdata, fig_params, store_viewconfig_cs)] if store_viewconfig_in_attrs: root = sdata while hasattr(root, "_sdata"): From e0853fcda116c73b114980efa3f0362c170484a0 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 6 Apr 2025 23:31:47 +0200 Subject: [PATCH 29/56] use axis tick values directly --- src/spatialdata_plot/_viewconfig/axis.py | 12 ++++++++++-- src/spatialdata_plot/_viewconfig/misc.py | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/axis.py b/src/spatialdata_plot/_viewconfig/axis.py index 1ca6d3f6..2eecbc17 100644 --- a/src/spatialdata_plot/_viewconfig/axis.py +++ b/src/spatialdata_plot/_viewconfig/axis.py @@ -3,6 +3,7 @@ import matplotlib.colors as mcolors from matplotlib.axes import Axes +from spatialdata_plot._viewconfig.misc import parse_numbers_with_exact_format from spatialdata_plot.pl.utils import to_hex_alpha @@ -37,8 +38,7 @@ def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: fl axis_config["labelFontSize"] = (axis_props["majorticklabels"][0].get_size() * dpi) / 72 axis_config["labelFontStyle"] = axis_props["majorticklabels"][0].get_fontstyle() axis_config["labelFontWeight"] = axis_props["majorticklabels"][0].get_fontweight() - axis_config["tickCount"] = len(axis_props["ticklocs"]) - if axis_config["tickCount"] != 0: + if len(axis_props["ticklocs"]) != 0: tick_props = axis_props["ticklines"][0].properties() axis_config["ticks"] = tick_props["visible"] axis_config["tickOpacity"] = tick_props["alpha"] if tick_props["alpha"] else 1 @@ -50,6 +50,14 @@ def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: fl tick_props["markersize"] * dpi ) / 72 # also marker edge width, but vega doesn't have an equivalent for that. + vmin, vmax = axis_props["view_interval"] + tick_str_values = [ + ticklabel.get_text() + for ticklabel in axis_props["ticklabels"] + if vmin <= float(ticklabel.get_text()) <= vmax + ] + axis_config["values"] = parse_numbers_with_exact_format(tick_str_values) + label = axis_props["label_text"] if label != "": axis_config["title"] = label diff --git a/src/spatialdata_plot/_viewconfig/misc.py b/src/spatialdata_plot/_viewconfig/misc.py index 60934072..bca11e10 100644 --- a/src/spatialdata_plot/_viewconfig/misc.py +++ b/src/spatialdata_plot/_viewconfig/misc.py @@ -30,3 +30,25 @@ def enforce_common_decimal_format(values: list[float]) -> list[float]: def strip_call(s: str) -> str: """Strip leading digit and underscore from call name.""" return re.sub(r"^\d+_", "", s) + + +def parse_numbers_with_exact_format(str_values: list[str]) -> list[float]: + """Convert string to their exact int or float representation. + + Parameters + ---------- + str_values : list[str] + The list of strings to convert to float or int. + + Returns + ------- + float_ls: list[float] + The float / int representation of the string values. + """ + float_ls = [] + for s in str_values: + if "." in s: + float_ls.append(float(s)) + else: + float_ls.append(int(s)) + return float_ls From 050772c2b8259b3aba7aa6a6f6c17c9c1a42fb73 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 6 Apr 2025 23:39:09 +0200 Subject: [PATCH 30/56] account for reverse axis --- src/spatialdata_plot/_viewconfig/axis.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spatialdata_plot/_viewconfig/axis.py b/src/spatialdata_plot/_viewconfig/axis.py index 2eecbc17..71650642 100644 --- a/src/spatialdata_plot/_viewconfig/axis.py +++ b/src/spatialdata_plot/_viewconfig/axis.py @@ -1,6 +1,7 @@ from typing import Any import matplotlib.colors as mcolors +import numpy as np from matplotlib.axes import Axes from spatialdata_plot._viewconfig.misc import parse_numbers_with_exact_format @@ -50,7 +51,7 @@ def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: fl tick_props["markersize"] * dpi ) / 72 # also marker edge width, but vega doesn't have an equivalent for that. - vmin, vmax = axis_props["view_interval"] + vmin, vmax = np.sort(axis_props["view_interval"]) tick_str_values = [ ticklabel.get_text() for ticklabel in axis_props["ticklabels"] From 0aaf5a8e6f41a1356c12795e7ea65d383d571d46 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 14 Apr 2025 09:57:35 +0200 Subject: [PATCH 31/56] correct colorbar outline --- src/spatialdata_plot/_viewconfig/legend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spatialdata_plot/_viewconfig/legend.py b/src/spatialdata_plot/_viewconfig/legend.py index 8bc27759..55dc35f3 100644 --- a/src/spatialdata_plot/_viewconfig/legend.py +++ b/src/spatialdata_plot/_viewconfig/legend.py @@ -144,7 +144,7 @@ def create_colorbar_legend( common_props = _extract_legend_label_properties(labels, fig.dpi) spine_outline = cbar.outline.properties() # outline of the colorbar lining - stroke_color = mcolors.to_hex(spine_outline["facecolor"]) if spine_outline["facecolor"][-1] > 0 else None + stroke_color = mcolors.to_hex(spine_outline["edgecolor"]) if spine_outline["edgecolor"][-1] > 0 else None legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) # TODO: do we require padding? it is not obvious to get from matplotlib legend_object = { From 2eb7bdc1911b972c8adcb2f51ffef4a99b80f24f Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 14 Apr 2025 14:54:28 +0200 Subject: [PATCH 32/56] correct colorbar thickness --- src/spatialdata_plot/_viewconfig/legend.py | 36 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/legend.py b/src/spatialdata_plot/_viewconfig/legend.py index 55dc35f3..3e9e0614 100644 --- a/src/spatialdata_plot/_viewconfig/legend.py +++ b/src/spatialdata_plot/_viewconfig/legend.py @@ -4,6 +4,7 @@ from matplotlib.axes import Axes from matplotlib.figure import Figure from matplotlib.text import Text +from matplotlib.transforms import Bbox from spatialdata_plot._viewconfig.misc import enforce_common_decimal_format from spatialdata_plot.pl.utils import to_hex_alpha @@ -102,6 +103,30 @@ def create_categorical_legend(fig: Figure, color_scale_array: list[dict[str, Any return legend_array +def _get_gradient_thickness(orientation: str, fig: Figure, cbar_bbox: Bbox) -> float: + """ + Get the thickness of the colorbar in pixel units. + + Parameters + ---------- + orientation: str + The orientation of the colorbar, either `vertical` or `horizontal`. + fig: Figure + The matplotlib figure. + cbar_bbox: Bbox + The bounding box of the colorbar. + + Returns + ------- + float + The thickness of the colorbar in pixel units. + """ + if orientation == "vertical": + return float(cbar_bbox.width * fig.bbox.width) + + return float(cbar_bbox.height * fig.bbox.height) + + def create_colorbar_legend( fig: Figure, color_scale_array: list[dict[str, Any]], legend_count: int ) -> list[dict[str, Any]]: @@ -132,11 +157,12 @@ def create_colorbar_legend( cbar = cbars[legend_count] axis_props = cbar.ax.properties() + cbar_bbox = cbar.ax.get_position() if cbar.orientation == "vertical": - gradient_length = cbar.ax.get_position().bounds[-1] * fig.get_figheight() * fig.dpi + gradient_length = cbar_bbox.height * fig.bbox.height labels = axis_props["yticklabels"] else: - gradient_length = cbar.ax.get_position().bounds[-2] * fig.get_figwidth() * fig.dpi + gradient_length = cbar_bbox.width * fig.bbox.width labels = axis_props["xticklabels"] if col_config["type"] == "linear": legend_type = "gradient" @@ -146,7 +172,9 @@ def create_colorbar_legend( stroke_color = mcolors.to_hex(spine_outline["edgecolor"]) if spine_outline["edgecolor"][-1] > 0 else None legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) - # TODO: do we require padding? it is not obvious to get from matplotlib + + gradient_thickness = _get_gradient_thickness(cbar.orientation, fig, cbar_bbox) + # We do not deal with padding as matplotlib does not seem to allow a colorbar in a rectangular bounding box. legend_object = { "type": legend_type, "direction": cbar.orientation, @@ -155,7 +183,7 @@ def create_colorbar_legend( "fillColor": mcolors.to_hex(cbar.ax.get_facecolor()), "gradientLength": gradient_length, # alpha if alpha := getattr(cbar.cmap, "_lut", None)[0][-1] else "gradientOpacity": cbar.mappable.get_alpha(), - "gradientThickness": (cbar.ax.get_position().bounds[2] * fig.dpi) / 72, + "gradientThickness": gradient_thickness, "gradientStrokeColor": stroke_color, "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, "values": enforce_common_decimal_format(list(cbar.ax.get_yticks())), From 8ca05e83cab2e5ed088dbfdd731de892a99ca6b5 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 14 Apr 2025 23:04:58 +0200 Subject: [PATCH 33/56] fix plot image 2 channels --- src/spatialdata_plot/_viewconfig/scales.py | 12 +++++++++--- src/spatialdata_plot/pl/render.py | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py index 0ed7dcb5..0cddaf12 100644 --- a/src/spatialdata_plot/_viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -151,6 +151,12 @@ def _process_colormap(cmap: CmapParams) -> dict[str, Any]: if cmap.name in {"from_list", "custom_colormap"}: # TODO: Handle custom colormap logic return {} + if cmap.name.startswith("#"): + color = mcolors.to_hex(cmap.name) + for name, hex_val in mcolors.CSS4_COLORS.items(): + if color.lower() == hex_val.lower(): + cmap.name = name + return {"scheme": cmap.name, "count": cmap.N} return {} @@ -230,12 +236,12 @@ def create_colorscale_array_image( ------- A color scale array containing vega-like color scale objects pertaining to a SpatialData image element. """ + color_scale_array = [] cmaps = [param.cmap for param in cmap_params] if isinstance(cmap_params, list) else [cmap_params.cmap] cmaps = cmaps[0] if isinstance(cmaps[0], list) else cmaps - color_scale_array = [] for index, cmap in enumerate(cmaps): - type_scale = "linear" + color_range = _process_colormap(cmap) if isinstance(field, int | list): @@ -243,7 +249,7 @@ def create_colorscale_array_image( field = field or "value" color_scale_array.append( - _generate_color_scale_object(f"color_{uuid4()}", type_scale, {"data": data_id, "field": field}, color_range) + _generate_color_scale_object(f"color_{uuid4()}", "linear", {"data": data_id, "field": field}, color_range) ) return color_scale_array diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 6e087b19..684e00ef 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -895,6 +895,8 @@ def _render_images( seed_colors = _get_colors_for_categorical_obs(list(range(n_channels))) channel_cmaps = [_get_linear_colormap([c], "k")[0] for c in seed_colors] + sdata.plotting_tree[f"{render_count}_render_images"].cmap_params.cmap = channel_cmaps + colored = np.stack([channel_cmaps[ind](layers[ch]) for ind, ch in enumerate(channels)], 0).sum(0) colored = colored[:, :, :3] From 4f531e969df79d849c1e1e4225e92328d23263bb Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 25 Apr 2025 14:47:02 +0200 Subject: [PATCH 34/56] fix 2 image channels colorscale --- src/spatialdata_plot/_viewconfig/scales.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py index 0cddaf12..b7e164c4 100644 --- a/src/spatialdata_plot/_viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -243,13 +243,15 @@ def create_colorscale_array_image( for index, cmap in enumerate(cmaps): color_range = _process_colormap(cmap) - + field_val = field if isinstance(field, int | list): - field = f"channel_{index}" - field = field or "value" + field_val = f"channel_{index}" + field_val = field_val or "value" color_scale_array.append( - _generate_color_scale_object(f"color_{uuid4()}", "linear", {"data": data_id, "field": field}, color_range) + _generate_color_scale_object( + f"color_{uuid4()}", "linear", {"data": data_id, "field": field_val}, color_range + ) ) return color_scale_array From 1e24f4f6702cedaa8ff0eb3ecdd711c24d98459e Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 25 Apr 2025 15:04:16 +0200 Subject: [PATCH 35/56] add todo --- src/spatialdata_plot/_viewconfig/legend.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spatialdata_plot/_viewconfig/legend.py b/src/spatialdata_plot/_viewconfig/legend.py index 3e9e0614..fcdc95da 100644 --- a/src/spatialdata_plot/_viewconfig/legend.py +++ b/src/spatialdata_plot/_viewconfig/legend.py @@ -186,6 +186,7 @@ def create_colorbar_legend( "gradientThickness": gradient_thickness, "gradientStrokeColor": stroke_color, "gradientStrokeWidth": (spine_outline["linewidth"] * fig.dpi) / 72 if stroke_color else None, + # TODO: check why values can be different for example in Images_can_pass_normalize_clip_True "values": enforce_common_decimal_format(list(cbar.ax.get_yticks())), **common_props, "legendX": cbar.ax.get_tightbbox().bounds[0], From 5840df016587d5063989de5f0ccb1b85f9f51de3 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 25 Apr 2025 15:50:05 +0200 Subject: [PATCH 36/56] use proper data for image --- src/spatialdata_plot/_viewconfig/config.py | 7 ++++++- src/spatialdata_plot/_viewconfig/marks.py | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/config.py b/src/spatialdata_plot/_viewconfig/config.py index ef4da779..95480491 100644 --- a/src/spatialdata_plot/_viewconfig/config.py +++ b/src/spatialdata_plot/_viewconfig/config.py @@ -145,7 +145,12 @@ def _create_scales_legends_marks( match params: case ImageRenderParams(): - color_scale_array = create_colorscale_array_image(params.cmap_params, data_object["name"], params.channel) + data_id = ( + data_object["name"] + if data_object["transform"][-1]["type"] != "formula" + else data_object["transform"][-1]["as"] + ) + color_scale_array = create_colorscale_array_image(params.cmap_params, data_id, params.channel) legend_array = create_colorbar_legend(fig, color_scale_array, legend_count) marks_object = create_raster_image_marks_object(ax, params, data_object, call_count, color_scale_array) case LabelsRenderParams() | PointsRenderParams() | ShapesRenderParams(): diff --git a/src/spatialdata_plot/_viewconfig/marks.py b/src/spatialdata_plot/_viewconfig/marks.py index deb014cd..e204722a 100644 --- a/src/spatialdata_plot/_viewconfig/marks.py +++ b/src/spatialdata_plot/_viewconfig/marks.py @@ -127,9 +127,13 @@ def create_raster_image_marks_object( if len(color_scale_array) == 1 else [{"scale": cs["name"], "field": f"channel_{i}"} for i, cs in enumerate(color_scale_array)] ) + + data_id = ( + data_object["name"] if data_object["transform"][-1]["type"] != "formula" else data_object["transform"][-1]["as"] + ) return { "type": "raster_image", - "from": {"data": data_object["name"]}, + "from": {"data": data_id}, "zindex": ax.properties()["images"][call_count].zorder, "encode": {"enter": {"opacity": {"value": params.alpha}, "fill": fill_color}}, } From 2ae8e97e82baaae9a7599422640bb0b0a79fe81d Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 25 Apr 2025 16:57:15 +0200 Subject: [PATCH 37/56] add initial image configs --- .../Images_can_do_rasterization.json | 163 ++++++++ .../Images_can_pass_cmap.json | 167 ++++++++ .../Images_can_pass_cmap_list.json | 199 ++++++++++ .../Images_can_pass_cmap_to_each_channel.json | 195 ++++++++++ ...mages_can_pass_cmap_to_single_channel.json | 187 +++++++++ ...Images_can_pass_color_to_each_channel.json | 195 ++++++++++ ...ages_can_pass_color_to_single_channel.json | 187 +++++++++ .../Images_can_pass_normalize_clip_False.json | 192 ++++++++++ .../Images_can_pass_normalize_clip_True.json | 192 ++++++++++ ...an_pass_normalize_clip_true_list_cmap.json | 200 ++++++++++ .../Images_can_pass_str_cmap.json | 167 ++++++++ .../Images_can_pass_str_cmap_list.json | 199 ++++++++++ ...an_render_a_single_channel_from_image.json | 192 ++++++++++ ..._single_channel_from_multiscale_image.json | 192 ++++++++++ ...ender_a_single_channel_str_from_image.json | 192 ++++++++++ ...gle_channel_str_from_multiscale_image.json | 192 ++++++++++ ...ender_given_scale_of_multiscale_image.json | 163 ++++++++ .../Images_can_render_image.json | 167 ++++++++ .../Images_can_render_multiscale_image.json | 163 ++++++++ ...der_multiscale_image_with_custom_cmap.json | 187 +++++++++ ...es_can_render_two_channels_from_image.json | 179 +++++++++ ...er_two_channels_from_multiscale_image.json | 179 +++++++++ ...an_render_two_channels_str_from_image.json | 179 +++++++++ ...wo_channels_str_from_multiscale_image.json | 179 +++++++++ .../Images_can_stack_render_images.json | 267 +++++++++++++ .../Images_can_stick_to_zorder.json | 356 ++++++++++++++++++ ...an_stop_rasterization_with_scale_full.json | 163 ++++++++ 27 files changed, 5193 insertions(+) create mode 100644 tests/_figures_viewconfig/Images_can_do_rasterization.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap_list.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_str_cmap.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json create mode 100644 tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_multiscale_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json create mode 100644 tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json create mode 100644 tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json create mode 100644 tests/_figures_viewconfig/Images_can_stack_render_images.json create mode 100644 tests/_figures_viewconfig/Images_can_stick_to_zorder.json create mode 100644 tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json diff --git a/tests/_figures_viewconfig/Images_can_do_rasterization.json b/tests/_figures_viewconfig/Images_can_do_rasterization.json new file mode 100644 index 00000000..7663a4ac --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_do_rasterization.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9bd6b355-ac90-41ba-854c-b84908e545d9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_giant_image_d7ce8720-81d8-41ab-803c-bb032c4fe44a", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "9bd6b355-ac90-41ba-854c-b84908e545d9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_d7ef6d37-eef3-4c71-8b7e-017c2e0659c6", + "type": "linear", + "domain": { + "data": "blobs_giant_image_d7ce8720-81d8-41ab-803c-bb032c4fe44a", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_giant_image_d7ce8720-81d8-41ab-803c-bb032c4fe44a" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_d7ef6d37-eef3-4c71-8b7e-017c2e0659c6", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "eda03dab-5930-53a7-aeb3-11b5160e141c" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap.json b/tests/_figures_viewconfig/Images_can_pass_cmap.json new file mode 100644 index 00000000..eeaaae87 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_cmap.json @@ -0,0 +1,167 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "618ae2df-ce0b-4de2-8599-642e1eb9e5f3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250415" + } + }, + { + "name": "blobs_image_4b5db09b-181d-4f95-9bfc-d38ed2f5b3ba", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "618ae2df-ce0b-4de2-8599-642e1eb9e5f3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_bbdbc56d-9ac8-4a8c-8176-aef96af1c18b", + "type": "linear", + "domain": { + "data": "blobs_image_4b5db09b-181d-4f95-9bfc-d38ed2f5b3ba", + "field": "value" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_4b5db09b-181d-4f95-9bfc-d38ed2f5b3ba" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_bbdbc56d-9ac8-4a8c-8176-aef96af1c18b", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "1a13b428-0012-571b-b56c-43a1552ddbdc" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_list.json b/tests/_figures_viewconfig/Images_can_pass_cmap_list.json new file mode 100644 index 00000000..15c71f1f --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_list.json @@ -0,0 +1,199 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "6dddd0c6-d18a-4f68-ba2d-cd0544e5d1f9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250415" + } + }, + { + "name": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "6dddd0c6-d18a-4f68-ba2d-cd0544e5d1f9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_68df9a72-7768-47d6-b15b-935d41905b2d", + "type": "linear", + "domain": { + "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", + "field": "channel_0" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + }, + { + "name": "color_32fce90e-82bf-4408-a94f-1647827a9aa0", + "type": "linear", + "domain": { + "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", + "field": "channel_1" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "name": "color_5b397def-2357-4041-8bb2-b3d5249d5a41", + "type": "linear", + "domain": { + "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", + "field": "channel_2" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_68df9a72-7768-47d6-b15b-935d41905b2d", + "field": "channel_0" + }, + { + "scale": "color_32fce90e-82bf-4408-a94f-1647827a9aa0", + "field": "channel_1" + }, + { + "scale": "color_5b397def-2357-4041-8bb2-b3d5249d5a41", + "field": "channel_2" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "1937985d-7ef9-5ffc-b33e-e352723d8da2" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json b/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json new file mode 100644 index 00000000..0a1a0894 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json @@ -0,0 +1,195 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "36456d6a-eeae-4db9-92a2-ccd1e2c64227", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "36456d6a-eeae-4db9-92a2-ccd1e2c64227", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0, 1, 2] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_4652ac13-c94d-4696-b713-97571cef968e", + "type": "linear", + "domain": { + "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "field": "channel_0" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "name": "color_e524a644-7b95-4411-9fb4-976c9185ca32", + "type": "linear", + "domain": { + "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "field": "channel_1" + }, + "range": { + "scheme": "Greens", + "count": 256 + } + }, + { + "name": "color_960bbc50-cbcf-4a46-809b-f6b1697f5d26", + "type": "linear", + "domain": { + "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "field": "channel_2" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_4652ac13-c94d-4696-b713-97571cef968e", + "field": "channel_0" + }, + { + "scale": "color_e524a644-7b95-4411-9fb4-976c9185ca32", + "field": "channel_1" + }, + { + "scale": "color_960bbc50-cbcf-4a46-809b-f6b1697f5d26", + "field": "channel_2" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "ce6499ea-274b-5531-b90a-90e16c86d1b1" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json b/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json new file mode 100644 index 00000000..8fba29d1 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json @@ -0,0 +1,187 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "b25a70aa-4bbd-4817-89ac-5dbce911b4cd", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_3e0372ef-727f-4daf-96fc-c14ea58d879e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "b25a70aa-4bbd-4817-89ac-5dbce911b4cd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [1] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_e0ad0c1f-3c92-469a-af26-0a01abef173e", + "type": "linear", + "domain": { + "data": "blobs_image_3e0372ef-727f-4daf-96fc-c14ea58d879e", + "field": "channel_0" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_e0ad0c1f-3c92-469a-af26-0a01abef173e", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000ff", + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_3e0372ef-727f-4daf-96fc-c14ea58d879e" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_e0ad0c1f-3c92-469a-af26-0a01abef173e", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "3244c99b-3b85-5ef4-8b03-cea271f51c28" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json b/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json new file mode 100644 index 00000000..f9c269ba --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json @@ -0,0 +1,195 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e729b6b6-1ac2-4ffa-847e-94c1d49da4a4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "e729b6b6-1ac2-4ffa-847e-94c1d49da4a4", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0, 1, 2] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_6d5bc409-2e50-4db9-8d6f-872d49d9ef2a", + "type": "linear", + "domain": { + "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_5e3a6658-184c-42d0-a2d8-ec0cfe6c4c75", + "type": "linear", + "domain": { + "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "field": "channel_1" + }, + "range": { + "scheme": "green", + "count": 256 + } + }, + { + "name": "color_2095cdcc-fad2-45b4-a8ec-1afb1c9166d8", + "type": "linear", + "domain": { + "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "field": "channel_2" + }, + "range": { + "scheme": "blue", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_6d5bc409-2e50-4db9-8d6f-872d49d9ef2a", + "field": "channel_0" + }, + { + "scale": "color_5e3a6658-184c-42d0-a2d8-ec0cfe6c4c75", + "field": "channel_1" + }, + { + "scale": "color_2095cdcc-fad2-45b4-a8ec-1afb1c9166d8", + "field": "channel_2" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "cb62bec9-e263-571d-8908-b7ae9f621adc" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json b/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json new file mode 100644 index 00000000..5cc52056 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json @@ -0,0 +1,187 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "01c9217b-4dd8-437d-a4d2-a6a73502a559", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_b3cb7e84-4cf0-4d63-b25b-96b80f2deb78", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "01c9217b-4dd8-437d-a4d2-a6a73502a559", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [1] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_639af7c7-3c89-4968-867a-52b2ff15d0e7", + "type": "linear", + "domain": { + "data": "blobs_image_b3cb7e84-4cf0-4d63-b25b-96b80f2deb78", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_639af7c7-3c89-4968-867a-52b2ff15d0e7", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000ff", + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_b3cb7e84-4cf0-4d63-b25b-96b80f2deb78" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_639af7c7-3c89-4968-867a-52b2ff15d0e7", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "12b749c0-9136-5baf-8dcf-346cc2c47284" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json new file mode 100644 index 00000000..52a8368b --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json @@ -0,0 +1,192 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a6179671-9c61-44ae-a273-cf0de76239fb", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_dfc6fde5-c00b-4b61-a6b4-de8166e5c900", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "a6179671-9c61-44ae-a273-cf0de76239fb", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] + }, + { + "type": "formula", + "expr": "(datum.value - 0.1) / (0.5 - 0.1)", + "as": "3e823bd8-6c08-4042-bfc1-30716fb35a84" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_28f10ac2-bdc1-4d5d-b080-8b2fd4378cdc", + "type": "linear", + "domain": { + "data": "3e823bd8-6c08-4042-bfc1-30716fb35a84", + "field": "channel_0" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_28f10ac2-bdc1-4d5d-b080-8b2fd4378cdc", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.1, 0.2, 0.3, 0.4, 0.5], + "labelAlign": "left", + "labelColor": "#000000ff", + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "3e823bd8-6c08-4042-bfc1-30716fb35a84" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_28f10ac2-bdc1-4d5d-b080-8b2fd4378cdc", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "687083e0-219f-5d91-b904-d143b2f519f8" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json new file mode 100644 index 00000000..688b84f6 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json @@ -0,0 +1,192 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "aaafb762-5443-47ad-b36e-d9deae249c77", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_0cb27575-d57c-42ae-adae-fe36426cdc19", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "aaafb762-5443-47ad-b36e-d9deae249c77", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] + }, + { + "type": "formula", + "expr": "clamp((datum.value - 0.1) / (0.5 - 0.1), 0, 1)", + "as": "208b6b40-828f-4126-b133-e270eee67f1b" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_8405a287-0014-4b92-badb-4e2b035b7f43", + "type": "linear", + "domain": { + "data": "208b6b40-828f-4126-b133-e270eee67f1b", + "field": "channel_0" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_8405a287-0014-4b92-badb-4e2b035b7f43", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.1, 0.2, 0.3, 0.4, 0.5], + "labelAlign": "left", + "labelColor": "#000000ff", + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "208b6b40-828f-4126-b133-e270eee67f1b" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_8405a287-0014-4b92-badb-4e2b035b7f43", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "c22d324c-768e-51ef-9841-8e7fcde3f1be" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json new file mode 100644 index 00000000..1c661ab9 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json @@ -0,0 +1,200 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "47fc311c-de64-4a94-aac5-c961d60d0f9e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_73967ea3-cf7f-4c37-8f6c-55a13165ae41", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "47fc311c-de64-4a94-aac5-c961d60d0f9e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + }, + { + "type": "formula", + "expr": "clamp((datum.value - 0.0) / (0.4 - 0.0), 0, 1)", + "as": "729a827d-f810-4494-9ddd-b98c33eda533" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_1d1cd407-84c8-41d2-b89f-2f136a57de33", + "type": "linear", + "domain": { + "data": "729a827d-f810-4494-9ddd-b98c33eda533", + "field": "value" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + }, + { + "name": "color_e213a063-db1f-44f8-b634-df358d017c75", + "type": "linear", + "domain": { + "data": "729a827d-f810-4494-9ddd-b98c33eda533", + "field": "value" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "name": "color_380a4cab-221a-48e0-82ba-2bd15ec32ffb", + "type": "linear", + "domain": { + "data": "729a827d-f810-4494-9ddd-b98c33eda533", + "field": "value" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "729a827d-f810-4494-9ddd-b98c33eda533" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_1d1cd407-84c8-41d2-b89f-2f136a57de33", + "field": "channel_0" + }, + { + "scale": "color_e213a063-db1f-44f8-b634-df358d017c75", + "field": "channel_1" + }, + { + "scale": "color_380a4cab-221a-48e0-82ba-2bd15ec32ffb", + "field": "channel_2" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "35ed1888-f2b3-5efd-9d78-3207a64499c9" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_str_cmap.json b/tests/_figures_viewconfig/Images_can_pass_str_cmap.json new file mode 100644 index 00000000..200781f4 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_str_cmap.json @@ -0,0 +1,167 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "07970747-8edc-4315-9a7d-6228a4bde18d", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250324" + } + }, + { + "name": "blobs_image_f2023937-f7cf-4f48-b32b-1cb59f258644", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "07970747-8edc-4315-9a7d-6228a4bde18d", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_3fe2d8fb-3d3e-48a9-9453-0eeefc82d1cf", + "type": "linear", + "domain": { + "data": "blobs_image_f2023937-f7cf-4f48-b32b-1cb59f258644", + "field": "value" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_f2023937-f7cf-4f48-b32b-1cb59f258644" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_3fe2d8fb-3d3e-48a9-9453-0eeefc82d1cf", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "4abfb043-e957-52d7-a20c-2e44d0f09148" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json b/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json new file mode 100644 index 00000000..fb3546db --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json @@ -0,0 +1,199 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d47b5cb4-fea4-44af-84ac-bf5e1d0846e9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250415" + } + }, + { + "name": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "d47b5cb4-fea4-44af-84ac-bf5e1d0846e9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_7faaedbf-ad06-4c14-a8bb-987412bccfdb", + "type": "linear", + "domain": { + "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", + "field": "channel_0" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + }, + { + "name": "color_af611f7e-f600-44ad-b72f-e464558633d6", + "type": "linear", + "domain": { + "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", + "field": "channel_1" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "name": "color_c2ed37e4-a051-4ac5-9591-15d22ab0ca4a", + "type": "linear", + "domain": { + "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", + "field": "channel_2" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_7faaedbf-ad06-4c14-a8bb-987412bccfdb", + "field": "channel_0" + }, + { + "scale": "color_af611f7e-f600-44ad-b72f-e464558633d6", + "field": "channel_1" + }, + { + "scale": "color_c2ed37e4-a051-4ac5-9591-15d22ab0ca4a", + "field": "channel_2" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "d774872a-6947-570c-9566-80f668ab0cb9" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json new file mode 100644 index 00000000..b036a600 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json @@ -0,0 +1,192 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "56f04217-b689-4274-b500-dec7befb106f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250415" + } + }, + { + "name": "blobs_image_ad47c090-252a-4f3c-b58a-1e254a77d795", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "56f04217-b689-4274-b500-dec7befb106f", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_952f733c-56fb-4144-b086-ad7896b637b8", + "type": "linear", + "domain": { + "data": "blobs_image_ad47c090-252a-4f3c-b58a-1e254a77d795", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_952f733c-56fb-4144-b086-ad7896b637b8", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_ad47c090-252a-4f3c-b58a-1e254a77d795" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_952f733c-56fb-4144-b086-ad7896b637b8", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "08ff015c-efa0-5c98-8aa4-20aee18dfc48" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json new file mode 100644 index 00000000..72c25b17 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json @@ -0,0 +1,192 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "4111627c-32ef-4490-8fdf-a6db626fc25c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250415" + } + }, + { + "name": "blobs_multiscale_image_5fb765e6-aef3-413c-b3e7-339fb6220260", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "4111627c-32ef-4490-8fdf-a6db626fc25c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_45a5c423-6a0f-4775-9615-c0d8665eded8", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_5fb765e6-aef3-413c-b3e7-339fb6220260", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_45a5c423-6a0f-4775-9615-c0d8665eded8", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_5fb765e6-aef3-413c-b3e7-339fb6220260" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_45a5c423-6a0f-4775-9615-c0d8665eded8", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "b5af35e4-2361-557d-a263-4c538a77447f" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json new file mode 100644 index 00000000..673393f3 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json @@ -0,0 +1,192 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "580417c8-67c0-4c50-9780-d3ec398a7c26", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250415" + } + }, + { + "name": "blobs_image_6fe528cc-687c-460f-a9ac-cfb7fa3ccf5f", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "580417c8-67c0-4c50-9780-d3ec398a7c26", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": ["c1"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_c6083c03-ba40-4f9c-bb82-b65e988612b7", + "type": "linear", + "domain": { + "data": "blobs_image_6fe528cc-687c-460f-a9ac-cfb7fa3ccf5f", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c6083c03-ba40-4f9c-bb82-b65e988612b7", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_6fe528cc-687c-460f-a9ac-cfb7fa3ccf5f" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_c6083c03-ba40-4f9c-bb82-b65e988612b7", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "42157cf8-172c-5e67-85b5-66b15e34a28e" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json new file mode 100644 index 00000000..56a806cc --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json @@ -0,0 +1,192 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "90247fcc-e145-4dbd-b8f3-4eb9441939a6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250415" + } + }, + { + "name": "blobs_multiscale_image_bbf7976f-d89c-4101-9732-565128c50627", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "90247fcc-e145-4dbd-b8f3-4eb9441939a6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": ["c1"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_21c6fe86-5eb2-4875-bea4-0102c1a8fe6b", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_bbf7976f-d89c-4101-9732-565128c50627", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_21c6fe86-5eb2-4875-bea4-0102c1a8fe6b", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_bbf7976f-d89c-4101-9732-565128c50627" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_21c6fe86-5eb2-4875-bea4-0102c1a8fe6b", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "c2f924ac-65f6-5229-a7d9-e56fdbdf4f8d" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json new file mode 100644 index 00000000..d0db157b --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "69429c26-a200-4eb4-bb8d-d704011fdc61", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_image_f07e31c4-d497-4aac-8e84-df0746bbcaa1", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "69429c26-a200-4eb4-bb8d-d704011fdc61", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale2" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_e6325245-bce4-4b5b-baf9-a1f98d405d69", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_f07e31c4-d497-4aac-8e84-df0746bbcaa1", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_f07e31c4-d497-4aac-8e84-df0746bbcaa1" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_e6325245-bce4-4b5b-baf9-a1f98d405d69", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "9ba209ef-014b-5806-80ab-65ca0f888be7" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_image.json b/tests/_figures_viewconfig/Images_can_render_image.json new file mode 100644 index 00000000..a25cdd12 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_image.json @@ -0,0 +1,167 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c1e9dc90-4b40-4773-a20d-e5e0b5cd7785", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250324" + } + }, + { + "name": "blobs_image_177f9ae8-9150-47d6-ba81-c5c624fdbd2a", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "c1e9dc90-4b40-4773-a20d-e5e0b5cd7785", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_5762c824-6494-4bd6-be18-315bd971fa3b", + "type": "linear", + "domain": { + "data": "blobs_image_177f9ae8-9150-47d6-ba81-c5c624fdbd2a", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1.0, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_177f9ae8-9150-47d6-ba81-c5c624fdbd2a" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_5762c824-6494-4bd6-be18-315bd971fa3b", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "0bfb55b4-ef99-5eaf-bdf8-d0e42d531ff5" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_multiscale_image.json new file mode 100644 index 00000000..95bb98b4 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_multiscale_image.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "56349b13-6e07-43a1-9afe-f4a2b18eefb4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_image_29661d8b-d49a-4534-8887-c6ce89bf948c", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "56349b13-6e07-43a1-9afe-f4a2b18eefb4", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_c602bd42-be58-4bc2-8db0-0f8bc310d2f2", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_29661d8b-d49a-4534-8887-c6ce89bf948c", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_29661d8b-d49a-4534-8887-c6ce89bf948c" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_c602bd42-be58-4bc2-8db0-0f8bc310d2f2", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "d37a2592-d43a-54ec-8d5d-534ce4dd1620" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json b/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json new file mode 100644 index 00000000..3c3cd23d --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json @@ -0,0 +1,187 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0adfcb5d-0ba7-431a-b726-c3eb949963fb", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_image_c55bc3d7-3026-4ca3-9582-75ffc77620d6", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "0adfcb5d-0ba7-431a-b726-c3eb949963fb", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale2" + }, + { + "type": "filter_channel", + "expr": [0] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_ae923d43-2244-48a0-acbf-d29162fd9785", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_c55bc3d7-3026-4ca3-9582-75ffc77620d6", + "field": "channel_0" + }, + "range": { + "scheme": "Greys", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_ae923d43-2244-48a0-acbf-d29162fd9785", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000ff", + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_c55bc3d7-3026-4ca3-9582-75ffc77620d6" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_ae923d43-2244-48a0-acbf-d29162fd9785", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "f88dac95-cdc2-5cc2-9c3f-d8013c70228d" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json new file mode 100644 index 00000000..c65e1284 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json @@ -0,0 +1,179 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a69da098-cb50-4f55-91cd-817f17c5a52b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "a69da098-cb50-4f55-91cd-817f17c5a52b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0, 1] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_cfab0e24-53b3-4fbb-a2a1-f1937d26264c", + "type": "linear", + "domain": { + "data": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_8d53e0ac-d209-44cb-b225-9322d9ca8b96", + "type": "linear", + "domain": { + "data": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9", + "field": "channel_1" + }, + "range": { + "scheme": "lime", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_cfab0e24-53b3-4fbb-a2a1-f1937d26264c", + "field": "channel_0" + }, + { + "scale": "color_8d53e0ac-d209-44cb-b225-9322d9ca8b96", + "field": "channel_1" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "76201cde-07a0-5afb-99f2-f13e85339410" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json new file mode 100644 index 00000000..b38716b1 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json @@ -0,0 +1,179 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c6c62239-dd86-45f5-9cc8-b3bfea498bae", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "c6c62239-dd86-45f5-9cc8-b3bfea498bae", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0, 1] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_7f41b4ad-6077-411d-a592-05f1ac316938", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_b884e4fe-43f2-4010-a07c-9e4326dfd4ec", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904", + "field": "channel_1" + }, + "range": { + "scheme": "lime", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_7f41b4ad-6077-411d-a592-05f1ac316938", + "field": "channel_0" + }, + { + "scale": "color_b884e4fe-43f2-4010-a07c-9e4326dfd4ec", + "field": "channel_1" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "02be8923-38c4-5d0d-858c-f14103618653" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json new file mode 100644 index 00000000..570e2099 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json @@ -0,0 +1,179 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e4626e9f-ee78-4ccd-b29b-f27d588f084c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "e4626e9f-ee78-4ccd-b29b-f27d588f084c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": ["c1", "c2"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_37849dc4-7a97-4b4e-95a3-a6564b930652", + "type": "linear", + "domain": { + "data": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_7ccc915c-c713-403a-b2a5-7e1cabe499d1", + "type": "linear", + "domain": { + "data": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8", + "field": "channel_1" + }, + "range": { + "scheme": "lime", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_37849dc4-7a97-4b4e-95a3-a6564b930652", + "field": "channel_0" + }, + { + "scale": "color_7ccc915c-c713-403a-b2a5-7e1cabe499d1", + "field": "channel_1" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "349318be-8354-50b4-8875-f394ab309ed8" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json new file mode 100644 index 00000000..8aaa9409 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json @@ -0,0 +1,179 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "19462dc6-bbde-41e2-92b9-b102f6a65f73", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "19462dc6-bbde-41e2-92b9-b102f6a65f73", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": ["c1", "c2"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_d06afb51-4249-41e8-acb5-d5f8322e9b25", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_4ae6af24-fa9c-4afe-a74d-3205fa53e67c", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5", + "field": "channel_1" + }, + "range": { + "scheme": "lime", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_d06afb51-4249-41e8-acb5-d5f8322e9b25", + "field": "channel_0" + }, + { + "scale": "color_4ae6af24-fa9c-4afe-a74d-3205fa53e67c", + "field": "channel_1" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "6b3277dc-a049-584a-9a8c-efd99d4ef172" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_stack_render_images.json b/tests/_figures_viewconfig/Images_can_stack_render_images.json new file mode 100644 index 00000000..0a0c7fde --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_stack_render_images.json @@ -0,0 +1,267 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f1acc23e-cc47-493b-b308-4e4ab2e17002", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_cae83642-8855-446a-bd01-6452c2914b76", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "f1acc23e-cc47-493b-b308-4e4ab2e17002", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] + } + ] + }, + { + "name": "blobs_image_815aba87-74c9-4875-925d-e124cee4e4cf", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "f1acc23e-cc47-493b-b308-4e4ab2e17002", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [1] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_3def14ba-8ef1-4ff5-88f9-6cc86a43d08b", + "type": "linear", + "domain": { + "data": "blobs_image_cae83642-8855-446a-bd01-6452c2914b76", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_815dbcad-1207-48cb-94eb-e37535f185e3", + "type": "linear", + "domain": { + "data": "blobs_image_815aba87-74c9-4875-925d-e124cee4e4cf", + "field": "channel_0" + }, + "range": { + "scheme": "blue", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_3def14ba-8ef1-4ff5-88f9-6cc86a43d08b", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000ff", + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + }, + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_815dbcad-1207-48cb-94eb-e37535f185e3", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000ff", + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 227.32800000000003, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_cae83642-8855-446a-bd01-6452c2914b76" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 0.5 + }, + "fill": [ + { + "scale": "color_3def14ba-8ef1-4ff5-88f9-6cc86a43d08b", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_image", + "from": { + "data": "blobs_image_815aba87-74c9-4875-925d-e124cee4e4cf" + }, + "zindex": 1, + "encode": { + "enter": { + "opacity": { + "value": 0.5 + }, + "fill": [ + { + "scale": "color_815dbcad-1207-48cb-94eb-e37535f185e3", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "1ecea0a6-fa57-51f3-9204-61acfc923a34" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_stick_to_zorder.json b/tests/_figures_viewconfig/Images_can_stick_to_zorder.json new file mode 100644 index 00000000..212c315d --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_stick_to_zorder.json @@ -0,0 +1,356 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_2011a6f9-bbcf-4613-8d36-e32a56b7d80e", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_d3b7570c-468f-44f7-b2fb-9db2a24fef91", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_bfc9adb0-62b9-40f4-ae27-602a1621912f", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_image_6b94ea67-7021-4163-a614-13b7d85d7cca", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "blobs_multiscale_image_8d40fd50-d385-4c1a-94af-5d9c78815dd5", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_360709a7-9663-447a-9968-5491a884ba95", + "type": "linear", + "domain": { + "data": "blobs_image_6b94ea67-7021-4163-a614-13b7d85d7cca", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_28b7bed3-0a23-4705-af69-de2fec0da0d5", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_8d40fd50-d385-4c1a-94af-5d9c78815dd5", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_2011a6f9-bbcf-4613-8d36-e32a56b7d80e" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_d3b7570c-468f-44f7-b2fb-9db2a24fef91" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_bfc9adb0-62b9-40f4-ae27-602a1621912f" + }, + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "raster_image", + "from": { + "data": "blobs_image_6b94ea67-7021-4163-a614-13b7d85d7cca" + }, + "zindex": 3, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_360709a7-9663-447a-9968-5491a884ba95", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_8d40fd50-d385-4c1a-94af-5d9c78815dd5" + }, + "zindex": 4, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_28b7bed3-0a23-4705-af69-de2fec0da0d5", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "bce72096-f040-509b-903f-7953efa752d3" + } + } +] diff --git a/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json b/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json new file mode 100644 index 00000000..f328695c --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0f4350cf-6ca8-43d9-9d29-434120f241d6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_giant_image_6d203839-9086-4229-a7ee-095778bf964f", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "0f4350cf-6ca8-43d9-9d29-434120f241d6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_91959b6a-a022-4bc7-8807-e0ae7cd6b2fe", + "type": "linear", + "domain": { + "data": "blobs_giant_image_6d203839-9086-4229-a7ee-095778bf964f", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#ccccccff", + "gridWidth": 1.1111111111111112, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_giant_image_6d203839-9086-4229-a7ee-095778bf964f" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_91959b6a-a022-4bc7-8807-e0ae7cd6b2fe", + "value": "value" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "15c97a74-f0df-55df-932b-188eb819eca7" + } + } +] From 2bc29eb351d4083f5b7c3a4e3f4131666cab4c75 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 27 Apr 2025 14:03:48 +0200 Subject: [PATCH 38/56] corrext axis --- src/spatialdata_plot/_viewconfig/axis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/axis.py b/src/spatialdata_plot/_viewconfig/axis.py index 71650642..0d6ccf5f 100644 --- a/src/spatialdata_plot/_viewconfig/axis.py +++ b/src/spatialdata_plot/_viewconfig/axis.py @@ -5,7 +5,6 @@ from matplotlib.axes import Axes from spatialdata_plot._viewconfig.misc import parse_numbers_with_exact_format -from spatialdata_plot.pl.utils import to_hex_alpha def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: float) -> list[dict[str, Any]]: @@ -33,8 +32,10 @@ def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: fl axis_config["gridOpacity"] = axis_props["gridlines"][0].properties()["alpha"] axis_config["gridCap"] = axis_props["gridlines"][0].properties()["dash_capstyle"] grid_color = float(axis_props["gridlines"][0].properties()["markeredgecolor"]) - axis_config["gridColor"] = to_hex_alpha([grid_color] * 3) + axis_config["gridColor"] = mcolors.to_hex([grid_color] * 3) axis_config["gridWidth"] = (axis_props["gridlines"][0].properties()["markeredgewidth"] * dpi) / 72 + axis_config["labelColor"] = mcolors.to_hex(axis_props["majorticklabels"][0].get_color()) + axis_config["labelOpacity"] = 1 if not (alpha := axis_props["majorticklabels"][0].get_alpha()) else alpha axis_config["labelFont"] = axis_props["majorticklabels"][0].get_fontname() axis_config["labelFontSize"] = (axis_props["majorticklabels"][0].get_size() * dpi) / 72 axis_config["labelFontStyle"] = axis_props["majorticklabels"][0].get_fontstyle() From fbaeb2d6aeff2d5b3b5bcb34a16a5b6180022708 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 27 Apr 2025 14:06:54 +0200 Subject: [PATCH 39/56] ignore actual viewconfigs --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 580789d6..4844d84f 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ format.sh # test tests/figures/ +tests/figures_viewconfig # jupyter checkpoints .ipynb_checkpoints From 58a289867070bdd538027baf37fd55d769f48412 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 27 Apr 2025 17:25:15 +0200 Subject: [PATCH 40/56] add comparison test viewconfigs --- tests/conftest.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index e5290163..a0f0b475 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,11 @@ import json +import re import warnings from abc import ABC, ABCMeta from collections.abc import Callable from functools import wraps from pathlib import Path +from typing import Any import matplotlib import matplotlib.pyplot as plt @@ -37,6 +39,7 @@ EXPECTED = HERE / "_images" ACTUAL = HERE / "figures" VIEWCONFIG_ACTUAL = HERE / "figures_viewconfig" +VIEWCONFIG_EXPECTED = HERE / "_figures_viewconfig" TOL = 15 DPI = 80 @@ -391,6 +394,57 @@ def _get_table( return table +UUID_REGEX = re.compile(r"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}") + + +def is_uuid_string(s: str) -> bool: + return bool(UUID_REGEX.search(s)) + + +def compare_json_ignore_uuids(a: Any, b: Any, path="root", errors=None) -> bool: + if errors is None: + errors = [] + if isinstance(a, dict) and isinstance(b, dict): + if set(a.keys()) != set(b.keys()): + errors.append(f"Key mismatch at {path} actual vs expected: {set(a.keys())} != {set(b.keys())}") + for k in a: + next_path = f"{path}.{k}" + if isinstance(a[k], str) and is_uuid_string(a[k]): + continue + if k == "version": + continue + compare_json_ignore_uuids(a[k], b[k], path=next_path, errors=errors) + + return True + + if isinstance(a, list) and isinstance(b, list): + if len(a) != len(b): + errors.append(f"List length mismatch at {path} actual vs expected: {len(a)} != {len(b)}") + for i, (ai, bi) in enumerate(zip(a, b, strict=True)): + next_path = f"{path}[{i}]" + compare_json_ignore_uuids(ai, bi, path=next_path, errors=errors) + + else: + if isinstance(a, str) and is_uuid_string(a): + return True # ignore UUID strings + if a != b: + errors.append(f"Value mismatch at {path} actual vs expected: {a!r} != {b!r}") + + if path == "root" and errors: + error_message = "\n".join(errors) + raise AssertionError(f"JSONs do not match:\n{error_message}") + + return not errors + + +def test_viewconfig_output(actual_json_path, expected_json_path): + with actual_json_path.open() as f: + actual_json = json.load(f) + with expected_json_path.open() as f: + expected_json = json.load(f) + assert compare_json_ignore_uuids(actual_json, expected_json) + + class PlotTesterMeta(ABCMeta): def __new__(cls, clsname, superclasses, attributedict): for key, value in attributedict.items(): @@ -420,6 +474,7 @@ def compare(cls, basename: str, tolerance: float | None = None): # see https://github.com/scverse/squidpy/pull/302 tolerance = 2 * TOL if "Napari" in basename else TOL + test_viewconfig_output(VIEWCONFIG_ACTUAL / f"{basename}.json", VIEWCONFIG_EXPECTED / f"{basename}.json") res = compare_images(str(EXPECTED / f"{basename}.png"), str(out_path), tolerance) assert res is None, res From d1bbcdeaef9b038bf215fce0d84aa6208db6d7fe Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Mon, 28 Apr 2025 13:38:48 +0200 Subject: [PATCH 41/56] correct scales when passing on list of cmap str --- src/spatialdata_plot/_viewconfig/scales.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py index b7e164c4..5742c48c 100644 --- a/src/spatialdata_plot/_viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -244,8 +244,9 @@ def create_colorscale_array_image( color_range = _process_colormap(cmap) field_val = field - if isinstance(field, int | list): + if isinstance(field, int | list) or (field is None and len(cmaps) != 1): field_val = f"channel_{index}" + field_val = field_val or "value" color_scale_array.append( From 5a7908c881aeb77d403d3208d103edf184312bad Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Tue, 29 Apr 2025 00:55:13 +0200 Subject: [PATCH 42/56] fix comparison image viewconfigs --- src/spatialdata_plot/_viewconfig/legend.py | 3 ++- src/spatialdata_plot/_viewconfig/scales.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/spatialdata_plot/_viewconfig/legend.py b/src/spatialdata_plot/_viewconfig/legend.py index fcdc95da..2bcc3a5b 100644 --- a/src/spatialdata_plot/_viewconfig/legend.py +++ b/src/spatialdata_plot/_viewconfig/legend.py @@ -47,7 +47,8 @@ def _extract_legend_label_properties(label_texts: list[Text], dpi: float) -> dic return { "labelAlign": text_props["horizontalalignment"], - "labelColor": to_hex_alpha(text_props["color"]), + "labelColor": mcolors.to_hex(text_props["color"]), + "labelOpacity": 1 if text_props["alpha"] is None else text_props["alpha"], "labelFont": text_props["fontname"], "labelFontSize": (text_props["fontsize"] * dpi) / 72, "labelFontStyle": text_props["fontstyle"], diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py index 5742c48c..90322049 100644 --- a/src/spatialdata_plot/_viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -246,6 +246,8 @@ def create_colorscale_array_image( field_val = field if isinstance(field, int | list) or (field is None and len(cmaps) != 1): field_val = f"channel_{index}" + if isinstance(field, list) and len(field) == 1: + field_val = "value" field_val = field_val or "value" From cd9596379d2cd0badf5d65732a3ba92cb544f7b2 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Tue, 29 Apr 2025 21:18:18 +0200 Subject: [PATCH 43/56] last fix image viewconfigs --- src/spatialdata_plot/_viewconfig/axis.py | 2 + .../Images_can_do_rasterization.json | 24 +++++---- .../Images_can_pass_cmap_to_each_channel.json | 36 +++++++------ ...mages_can_pass_cmap_to_single_channel.json | 31 ++++++----- ...Images_can_pass_color_to_each_channel.json | 36 +++++++------ ...ages_can_pass_color_to_single_channel.json | 31 ++++++----- .../Images_can_pass_normalize_clip_False.json | 33 +++++++----- .../Images_can_pass_normalize_clip_True.json | 33 +++++++----- ...an_pass_normalize_clip_true_list_cmap.json | 44 ++++++++------- ...ender_given_scale_of_multiscale_image.json | 24 +++++---- .../Images_can_render_multiscale_image.json | 24 +++++---- ...der_multiscale_image_with_custom_cmap.json | 31 ++++++----- ...es_can_render_two_channels_from_image.json | 30 ++++++----- ...er_two_channels_from_multiscale_image.json | 30 ++++++----- ...an_render_two_channels_str_from_image.json | 30 ++++++----- ...wo_channels_str_from_multiscale_image.json | 30 ++++++----- .../Images_can_stack_render_images.json | 50 +++++++++-------- .../Images_can_stick_to_zorder.json | 54 ++++++++++--------- ...an_stop_rasterization_with_scale_full.json | 24 +++++---- 19 files changed, 339 insertions(+), 258 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/axis.py b/src/spatialdata_plot/_viewconfig/axis.py index 0d6ccf5f..5a135f35 100644 --- a/src/spatialdata_plot/_viewconfig/axis.py +++ b/src/spatialdata_plot/_viewconfig/axis.py @@ -33,8 +33,10 @@ def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: fl axis_config["gridCap"] = axis_props["gridlines"][0].properties()["dash_capstyle"] grid_color = float(axis_props["gridlines"][0].properties()["markeredgecolor"]) axis_config["gridColor"] = mcolors.to_hex([grid_color] * 3) + axis_config["gridOpacity"] = axis_props["gridlines"][0].properties()["alpha"] axis_config["gridWidth"] = (axis_props["gridlines"][0].properties()["markeredgewidth"] * dpi) / 72 axis_config["labelColor"] = mcolors.to_hex(axis_props["majorticklabels"][0].get_color()) + axis_config["labelOpacity"] = 1 if not (alpha := axis_props["majorticklabels"][0].get_alpha()) else alpha axis_config["labelFont"] = axis_props["majorticklabels"][0].get_fontname() axis_config["labelFontSize"] = (axis_props["majorticklabels"][0].get_size() * dpi) / 72 diff --git a/tests/_figures_viewconfig/Images_can_do_rasterization.json b/tests/_figures_viewconfig/Images_can_do_rasterization.json index 7663a4ac..bf3df851 100644 --- a/tests/_figures_viewconfig/Images_can_do_rasterization.json +++ b/tests/_figures_viewconfig/Images_can_do_rasterization.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "9bd6b355-ac90-41ba-854c-b84908e545d9", + "name": "c1ad6e92-bdb2-4bb4-bd65-caf36ff21609", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_giant_image_d7ce8720-81d8-41ab-803c-bb032c4fe44a", + "name": "blobs_giant_image_3d54d789-b359-4cdc-b0f9-6b61bcf55472", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "9bd6b355-ac90-41ba-854c-b84908e545d9", + "source": "c1ad6e92-bdb2-4bb4-bd65-caf36ff21609", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_d7ef6d37-eef3-4c71-8b7e-017c2e0659c6", + "name": "color_6d9c9f78-afec-41c8-859b-c862bdf16bf8", "type": "linear", "domain": { - "data": "blobs_giant_image_d7ce8720-81d8-41ab-803c-bb032c4fe44a", + "data": "blobs_giant_image_3d54d789-b359-4cdc-b0f9-6b61bcf55472", "field": "value" }, "range": { @@ -93,8 +93,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -118,8 +120,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -138,7 +142,7 @@ { "type": "raster_image", "from": { - "data": "blobs_giant_image_d7ce8720-81d8-41ab-803c-bb032c4fe44a" + "data": "blobs_giant_image_3d54d789-b359-4cdc-b0f9-6b61bcf55472" }, "zindex": 0, "encode": { @@ -148,7 +152,7 @@ }, "fill": [ { - "scale": "color_d7ef6d37-eef3-4c71-8b7e-017c2e0659c6", + "scale": "color_6d9c9f78-afec-41c8-859b-c862bdf16bf8", "value": "value" } ] @@ -157,7 +161,7 @@ } ], "usermeta": { - "axis_uuid": "eda03dab-5930-53a7-aeb3-11b5160e141c" + "axis_uuid": "e228fd3a-5d97-5b42-932a-14df5ad2275b" } } ] diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json b/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json index 0a1a0894..f3bfb5a1 100644 --- a/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "36456d6a-eeae-4db9-92a2-ccd1e2c64227", + "name": "97d394a9-4c4a-4189-9318-0fecc7b541a8", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "name": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "36456d6a-eeae-4db9-92a2-ccd1e2c64227", + "source": "97d394a9-4c4a-4189-9318-0fecc7b541a8", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_4652ac13-c94d-4696-b713-97571cef968e", + "name": "color_dbd18e2b-50e8-4bca-ac4f-33d26f0f99a1", "type": "linear", "domain": { - "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", "field": "channel_0" }, "range": { @@ -82,10 +82,10 @@ } }, { - "name": "color_e524a644-7b95-4411-9fb4-976c9185ca32", + "name": "color_0b6ba62b-3241-463f-b2b1-cbed9271e421", "type": "linear", "domain": { - "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", "field": "channel_1" }, "range": { @@ -94,10 +94,10 @@ } }, { - "name": "color_960bbc50-cbcf-4a46-809b-f6b1697f5d26", + "name": "color_94b0271e-0e6e-4e16-b6f4-3e9f71661875", "type": "linear", "domain": { - "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa", + "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", "field": "channel_2" }, "range": { @@ -117,8 +117,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -142,8 +144,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -162,7 +166,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_e126f581-b94e-4895-aebb-0a9cc645adfa" + "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a" }, "zindex": 0, "encode": { @@ -172,15 +176,15 @@ }, "fill": [ { - "scale": "color_4652ac13-c94d-4696-b713-97571cef968e", + "scale": "color_dbd18e2b-50e8-4bca-ac4f-33d26f0f99a1", "field": "channel_0" }, { - "scale": "color_e524a644-7b95-4411-9fb4-976c9185ca32", + "scale": "color_0b6ba62b-3241-463f-b2b1-cbed9271e421", "field": "channel_1" }, { - "scale": "color_960bbc50-cbcf-4a46-809b-f6b1697f5d26", + "scale": "color_94b0271e-0e6e-4e16-b6f4-3e9f71661875", "field": "channel_2" } ] @@ -189,7 +193,7 @@ } ], "usermeta": { - "axis_uuid": "ce6499ea-274b-5531-b90a-90e16c86d1b1" + "axis_uuid": "f8fdd4b4-7e46-53cd-9e67-f9acbf3b2ebd" } } ] diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json b/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json index 8fba29d1..63c7c151 100644 --- a/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "b25a70aa-4bbd-4817-89ac-5dbce911b4cd", + "name": "0e5176f6-5eef-495a-b667-f32d27eaccab", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_3e0372ef-727f-4daf-96fc-c14ea58d879e", + "name": "blobs_image_e6c332dc-cac7-4f17-8304-fefcf3fc35b2", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "b25a70aa-4bbd-4817-89ac-5dbce911b4cd", + "source": "0e5176f6-5eef-495a-b667-f32d27eaccab", "transform": [ { "type": "filter_element", @@ -70,11 +70,11 @@ "range": "height" }, { - "name": "color_e0ad0c1f-3c92-469a-af26-0a01abef173e", + "name": "color_921b657b-6ea4-4364-bd48-7b0e508c9b60", "type": "linear", "domain": { - "data": "blobs_image_3e0372ef-727f-4daf-96fc-c14ea58d879e", - "field": "channel_0" + "data": "blobs_image_e6c332dc-cac7-4f17-8304-fefcf3fc35b2", + "field": "value" }, "range": { "scheme": "Reds", @@ -93,8 +93,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -118,8 +120,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -139,7 +143,7 @@ "type": "gradient", "direction": "vertical", "orient": "none", - "fill": "color_e0ad0c1f-3c92-469a-af26-0a01abef173e", + "fill": "color_921b657b-6ea4-4364-bd48-7b0e508c9b60", "fillColor": "#ffffff", "gradientLength": 243.2, "gradientOpacity": 1.0, @@ -148,7 +152,8 @@ "gradientStrokeWidth": 0.8888888888888888, "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], "labelAlign": "left", - "labelColor": "#000000ff", + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -162,7 +167,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_3e0372ef-727f-4daf-96fc-c14ea58d879e" + "data": "blobs_image_e6c332dc-cac7-4f17-8304-fefcf3fc35b2" }, "zindex": 0, "encode": { @@ -172,7 +177,7 @@ }, "fill": [ { - "scale": "color_e0ad0c1f-3c92-469a-af26-0a01abef173e", + "scale": "color_921b657b-6ea4-4364-bd48-7b0e508c9b60", "value": "value" } ] @@ -181,7 +186,7 @@ } ], "usermeta": { - "axis_uuid": "3244c99b-3b85-5ef4-8b03-cea271f51c28" + "axis_uuid": "e0a1c378-6efe-5c05-b1a7-41fdecfb89f5" } } ] diff --git a/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json b/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json index f9c269ba..186746a2 100644 --- a/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "e729b6b6-1ac2-4ffa-847e-94c1d49da4a4", + "name": "3ef5fc74-d8bf-4ac2-afa7-ff06c5419866", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "name": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "e729b6b6-1ac2-4ffa-847e-94c1d49da4a4", + "source": "3ef5fc74-d8bf-4ac2-afa7-ff06c5419866", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_6d5bc409-2e50-4db9-8d6f-872d49d9ef2a", + "name": "color_624da7f3-22b5-474c-a8be-5e96e7ecfe55", "type": "linear", "domain": { - "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", "field": "channel_0" }, "range": { @@ -82,10 +82,10 @@ } }, { - "name": "color_5e3a6658-184c-42d0-a2d8-ec0cfe6c4c75", + "name": "color_51f4f3eb-05aa-424b-958b-70f9b01bad8e", "type": "linear", "domain": { - "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", "field": "channel_1" }, "range": { @@ -94,10 +94,10 @@ } }, { - "name": "color_2095cdcc-fad2-45b4-a8ec-1afb1c9166d8", + "name": "color_39e05901-104c-42a0-bd8d-af16385852df", "type": "linear", "domain": { - "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b", + "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", "field": "channel_2" }, "range": { @@ -117,8 +117,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -142,8 +144,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -162,7 +166,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_67ec377f-0275-4ec8-b540-04fdd781664b" + "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee" }, "zindex": 0, "encode": { @@ -172,15 +176,15 @@ }, "fill": [ { - "scale": "color_6d5bc409-2e50-4db9-8d6f-872d49d9ef2a", + "scale": "color_624da7f3-22b5-474c-a8be-5e96e7ecfe55", "field": "channel_0" }, { - "scale": "color_5e3a6658-184c-42d0-a2d8-ec0cfe6c4c75", + "scale": "color_51f4f3eb-05aa-424b-958b-70f9b01bad8e", "field": "channel_1" }, { - "scale": "color_2095cdcc-fad2-45b4-a8ec-1afb1c9166d8", + "scale": "color_39e05901-104c-42a0-bd8d-af16385852df", "field": "channel_2" } ] @@ -189,7 +193,7 @@ } ], "usermeta": { - "axis_uuid": "cb62bec9-e263-571d-8908-b7ae9f621adc" + "axis_uuid": "6fd40027-90c5-5ebf-82f6-539e62ff78f6" } } ] diff --git a/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json b/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json index 5cc52056..c574ade0 100644 --- a/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "01c9217b-4dd8-437d-a4d2-a6a73502a559", + "name": "edf683b1-b910-4334-a7c5-b91163e5b92a", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_b3cb7e84-4cf0-4d63-b25b-96b80f2deb78", + "name": "blobs_image_3d099333-2c05-47ee-a6aa-a9ba6ea0e5af", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "01c9217b-4dd8-437d-a4d2-a6a73502a559", + "source": "edf683b1-b910-4334-a7c5-b91163e5b92a", "transform": [ { "type": "filter_element", @@ -70,11 +70,11 @@ "range": "height" }, { - "name": "color_639af7c7-3c89-4968-867a-52b2ff15d0e7", + "name": "color_16c33042-b157-4b60-b7b6-09c46f27ab9c", "type": "linear", "domain": { - "data": "blobs_image_b3cb7e84-4cf0-4d63-b25b-96b80f2deb78", - "field": "channel_0" + "data": "blobs_image_3d099333-2c05-47ee-a6aa-a9ba6ea0e5af", + "field": "value" }, "range": { "scheme": "red", @@ -93,8 +93,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -118,8 +120,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -139,7 +143,7 @@ "type": "gradient", "direction": "vertical", "orient": "none", - "fill": "color_639af7c7-3c89-4968-867a-52b2ff15d0e7", + "fill": "color_16c33042-b157-4b60-b7b6-09c46f27ab9c", "fillColor": "#ffffff", "gradientLength": 243.2, "gradientOpacity": 1.0, @@ -148,7 +152,8 @@ "gradientStrokeWidth": 0.8888888888888888, "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], "labelAlign": "left", - "labelColor": "#000000ff", + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -162,7 +167,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_b3cb7e84-4cf0-4d63-b25b-96b80f2deb78" + "data": "blobs_image_3d099333-2c05-47ee-a6aa-a9ba6ea0e5af" }, "zindex": 0, "encode": { @@ -172,7 +177,7 @@ }, "fill": [ { - "scale": "color_639af7c7-3c89-4968-867a-52b2ff15d0e7", + "scale": "color_16c33042-b157-4b60-b7b6-09c46f27ab9c", "value": "value" } ] @@ -181,7 +186,7 @@ } ], "usermeta": { - "axis_uuid": "12b749c0-9136-5baf-8dcf-346cc2c47284" + "axis_uuid": "b6b7d383-d94d-5a35-8720-95970716d062" } } ] diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json index 52a8368b..ea95e08c 100644 --- a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "a6179671-9c61-44ae-a273-cf0de76239fb", + "name": "60539284-ba6e-4636-9d35-c6910572947c", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_dfc6fde5-c00b-4b61-a6b4-de8166e5c900", + "name": "blobs_image_98572d7a-7431-41d7-b9a1-70774003b905", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "a6179671-9c61-44ae-a273-cf0de76239fb", + "source": "60539284-ba6e-4636-9d35-c6910572947c", "transform": [ { "type": "filter_element", @@ -56,7 +56,7 @@ { "type": "formula", "expr": "(datum.value - 0.1) / (0.5 - 0.1)", - "as": "3e823bd8-6c08-4042-bfc1-30716fb35a84" + "as": "21f2454f-f780-4162-baec-ef4ab4287677" } ] } @@ -75,11 +75,11 @@ "range": "height" }, { - "name": "color_28f10ac2-bdc1-4d5d-b080-8b2fd4378cdc", + "name": "color_bdb2b8ed-5cd9-4862-867e-bdb17ee88734", "type": "linear", "domain": { - "data": "3e823bd8-6c08-4042-bfc1-30716fb35a84", - "field": "channel_0" + "data": "21f2454f-f780-4162-baec-ef4ab4287677", + "field": "value" }, "range": { "scheme": "viridis", @@ -98,8 +98,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -123,8 +125,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -144,7 +148,7 @@ "type": "gradient", "direction": "vertical", "orient": "none", - "fill": "color_28f10ac2-bdc1-4d5d-b080-8b2fd4378cdc", + "fill": "color_bdb2b8ed-5cd9-4862-867e-bdb17ee88734", "fillColor": "#ffffff", "gradientLength": 243.2, "gradientOpacity": 1.0, @@ -153,7 +157,8 @@ "gradientStrokeWidth": 0.8888888888888888, "values": [0.1, 0.2, 0.3, 0.4, 0.5], "labelAlign": "left", - "labelColor": "#000000ff", + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -167,7 +172,7 @@ { "type": "raster_image", "from": { - "data": "3e823bd8-6c08-4042-bfc1-30716fb35a84" + "data": "21f2454f-f780-4162-baec-ef4ab4287677" }, "zindex": 0, "encode": { @@ -177,7 +182,7 @@ }, "fill": [ { - "scale": "color_28f10ac2-bdc1-4d5d-b080-8b2fd4378cdc", + "scale": "color_bdb2b8ed-5cd9-4862-867e-bdb17ee88734", "value": "value" } ] @@ -186,7 +191,7 @@ } ], "usermeta": { - "axis_uuid": "687083e0-219f-5d91-b904-d143b2f519f8" + "axis_uuid": "56385cf7-daed-5bc2-86c4-841d9c8ce841" } } ] diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json index 688b84f6..24e8143d 100644 --- a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "aaafb762-5443-47ad-b36e-d9deae249c77", + "name": "be82ba36-7d40-4997-bbcb-dbcae87e94a8", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_0cb27575-d57c-42ae-adae-fe36426cdc19", + "name": "blobs_image_fafdb666-41bf-4659-97f0-d14c74034549", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "aaafb762-5443-47ad-b36e-d9deae249c77", + "source": "be82ba36-7d40-4997-bbcb-dbcae87e94a8", "transform": [ { "type": "filter_element", @@ -56,7 +56,7 @@ { "type": "formula", "expr": "clamp((datum.value - 0.1) / (0.5 - 0.1), 0, 1)", - "as": "208b6b40-828f-4126-b133-e270eee67f1b" + "as": "f60c47f4-8240-4bb7-9de3-dd8278c24a7d" } ] } @@ -75,11 +75,11 @@ "range": "height" }, { - "name": "color_8405a287-0014-4b92-badb-4e2b035b7f43", + "name": "color_1d487bca-ac88-48a0-901d-b60eb5aa9d4e", "type": "linear", "domain": { - "data": "208b6b40-828f-4126-b133-e270eee67f1b", - "field": "channel_0" + "data": "f60c47f4-8240-4bb7-9de3-dd8278c24a7d", + "field": "value" }, "range": { "scheme": "viridis", @@ -98,8 +98,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -123,8 +125,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -144,7 +148,7 @@ "type": "gradient", "direction": "vertical", "orient": "none", - "fill": "color_8405a287-0014-4b92-badb-4e2b035b7f43", + "fill": "color_1d487bca-ac88-48a0-901d-b60eb5aa9d4e", "fillColor": "#ffffff", "gradientLength": 243.2, "gradientOpacity": 1.0, @@ -153,7 +157,8 @@ "gradientStrokeWidth": 0.8888888888888888, "values": [0.1, 0.2, 0.3, 0.4, 0.5], "labelAlign": "left", - "labelColor": "#000000ff", + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -167,7 +172,7 @@ { "type": "raster_image", "from": { - "data": "208b6b40-828f-4126-b133-e270eee67f1b" + "data": "f60c47f4-8240-4bb7-9de3-dd8278c24a7d" }, "zindex": 0, "encode": { @@ -177,7 +182,7 @@ }, "fill": [ { - "scale": "color_8405a287-0014-4b92-badb-4e2b035b7f43", + "scale": "color_1d487bca-ac88-48a0-901d-b60eb5aa9d4e", "value": "value" } ] @@ -186,7 +191,7 @@ } ], "usermeta": { - "axis_uuid": "c22d324c-768e-51ef-9841-8e7fcde3f1be" + "axis_uuid": "81610a8c-0de9-53d5-82b1-280052035603" } } ] diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json index 1c661ab9..a0d3b81d 100644 --- a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "47fc311c-de64-4a94-aac5-c961d60d0f9e", + "name": "24df284f-a11d-4340-a143-2b5cf233a298", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_73967ea3-cf7f-4c37-8f6c-55a13165ae41", + "name": "blobs_image_a20c7fe3-8480-45ab-8fd4-21773ccb688a", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "47fc311c-de64-4a94-aac5-c961d60d0f9e", + "source": "24df284f-a11d-4340-a143-2b5cf233a298", "transform": [ { "type": "filter_element", @@ -56,7 +56,7 @@ { "type": "formula", "expr": "clamp((datum.value - 0.0) / (0.4 - 0.0), 0, 1)", - "as": "729a827d-f810-4494-9ddd-b98c33eda533" + "as": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73" } ] } @@ -75,11 +75,11 @@ "range": "height" }, { - "name": "color_1d1cd407-84c8-41d2-b89f-2f136a57de33", + "name": "color_3a788edc-90f7-4165-8f32-9ef4fea44fb3", "type": "linear", "domain": { - "data": "729a827d-f810-4494-9ddd-b98c33eda533", - "field": "value" + "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73", + "field": "channel_0" }, "range": { "scheme": "seismic", @@ -87,11 +87,11 @@ } }, { - "name": "color_e213a063-db1f-44f8-b634-df358d017c75", + "name": "color_f3dcaaa5-34f5-45c1-83ff-6de3bb979044", "type": "linear", "domain": { - "data": "729a827d-f810-4494-9ddd-b98c33eda533", - "field": "value" + "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73", + "field": "channel_1" }, "range": { "scheme": "Reds", @@ -99,11 +99,11 @@ } }, { - "name": "color_380a4cab-221a-48e0-82ba-2bd15ec32ffb", + "name": "color_4bc87e63-19d4-4b1b-9de4-d3deb8cbceaa", "type": "linear", "domain": { - "data": "729a827d-f810-4494-9ddd-b98c33eda533", - "field": "value" + "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73", + "field": "channel_2" }, "range": { "scheme": "Blues", @@ -122,8 +122,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -147,8 +149,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -167,7 +171,7 @@ { "type": "raster_image", "from": { - "data": "729a827d-f810-4494-9ddd-b98c33eda533" + "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73" }, "zindex": 0, "encode": { @@ -177,15 +181,15 @@ }, "fill": [ { - "scale": "color_1d1cd407-84c8-41d2-b89f-2f136a57de33", + "scale": "color_3a788edc-90f7-4165-8f32-9ef4fea44fb3", "field": "channel_0" }, { - "scale": "color_e213a063-db1f-44f8-b634-df358d017c75", + "scale": "color_f3dcaaa5-34f5-45c1-83ff-6de3bb979044", "field": "channel_1" }, { - "scale": "color_380a4cab-221a-48e0-82ba-2bd15ec32ffb", + "scale": "color_4bc87e63-19d4-4b1b-9de4-d3deb8cbceaa", "field": "channel_2" } ] @@ -194,7 +198,7 @@ } ], "usermeta": { - "axis_uuid": "35ed1888-f2b3-5efd-9d78-3207a64499c9" + "axis_uuid": "3c9ffcd5-4dd7-5958-b857-40807b961040" } } ] diff --git a/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json index d0db157b..a284d677 100644 --- a/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "69429c26-a200-4eb4-bb8d-d704011fdc61", + "name": "ac722766-e035-48d5-a1bf-cfb7de29f323", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_multiscale_image_f07e31c4-d497-4aac-8e84-df0746bbcaa1", + "name": "blobs_multiscale_image_bb82d5c7-2729-404d-8ad2-bd5f3dd864eb", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "69429c26-a200-4eb4-bb8d-d704011fdc61", + "source": "ac722766-e035-48d5-a1bf-cfb7de29f323", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_e6325245-bce4-4b5b-baf9-a1f98d405d69", + "name": "color_352b28a7-4da1-4403-a632-c4d38cce1f49", "type": "linear", "domain": { - "data": "blobs_multiscale_image_f07e31c4-d497-4aac-8e84-df0746bbcaa1", + "data": "blobs_multiscale_image_bb82d5c7-2729-404d-8ad2-bd5f3dd864eb", "field": "value" }, "range": { @@ -93,8 +93,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -118,8 +120,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -138,7 +142,7 @@ { "type": "raster_image", "from": { - "data": "blobs_multiscale_image_f07e31c4-d497-4aac-8e84-df0746bbcaa1" + "data": "blobs_multiscale_image_bb82d5c7-2729-404d-8ad2-bd5f3dd864eb" }, "zindex": 0, "encode": { @@ -148,7 +152,7 @@ }, "fill": [ { - "scale": "color_e6325245-bce4-4b5b-baf9-a1f98d405d69", + "scale": "color_352b28a7-4da1-4403-a632-c4d38cce1f49", "value": "value" } ] @@ -157,7 +161,7 @@ } ], "usermeta": { - "axis_uuid": "9ba209ef-014b-5806-80ab-65ca0f888be7" + "axis_uuid": "b8525270-3b08-5ee5-a0da-211736cdcd92" } } ] diff --git a/tests/_figures_viewconfig/Images_can_render_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_multiscale_image.json index 95bb98b4..9d41083e 100644 --- a/tests/_figures_viewconfig/Images_can_render_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_multiscale_image.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "56349b13-6e07-43a1-9afe-f4a2b18eefb4", + "name": "8123869d-5833-4634-b023-7b83c0170371", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_multiscale_image_29661d8b-d49a-4534-8887-c6ce89bf948c", + "name": "blobs_multiscale_image_a8fedc1c-a0c5-4123-8f44-3d0de94ddcb2", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "56349b13-6e07-43a1-9afe-f4a2b18eefb4", + "source": "8123869d-5833-4634-b023-7b83c0170371", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_c602bd42-be58-4bc2-8db0-0f8bc310d2f2", + "name": "color_6a308c45-a705-4432-aae9-e663b0fabc6a", "type": "linear", "domain": { - "data": "blobs_multiscale_image_29661d8b-d49a-4534-8887-c6ce89bf948c", + "data": "blobs_multiscale_image_a8fedc1c-a0c5-4123-8f44-3d0de94ddcb2", "field": "value" }, "range": { @@ -93,8 +93,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -118,8 +120,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -138,7 +142,7 @@ { "type": "raster_image", "from": { - "data": "blobs_multiscale_image_29661d8b-d49a-4534-8887-c6ce89bf948c" + "data": "blobs_multiscale_image_a8fedc1c-a0c5-4123-8f44-3d0de94ddcb2" }, "zindex": 0, "encode": { @@ -148,7 +152,7 @@ }, "fill": [ { - "scale": "color_c602bd42-be58-4bc2-8db0-0f8bc310d2f2", + "scale": "color_6a308c45-a705-4432-aae9-e663b0fabc6a", "value": "value" } ] @@ -157,7 +161,7 @@ } ], "usermeta": { - "axis_uuid": "d37a2592-d43a-54ec-8d5d-534ce4dd1620" + "axis_uuid": "217f0086-2a6c-57bd-9902-e4482d0528d8" } } ] diff --git a/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json b/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json index 3c3cd23d..c6a1d004 100644 --- a/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json +++ b/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "0adfcb5d-0ba7-431a-b726-c3eb949963fb", + "name": "1f90f262-66a2-4d85-a5d0-43c136fa7771", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_multiscale_image_c55bc3d7-3026-4ca3-9582-75ffc77620d6", + "name": "blobs_multiscale_image_25adc079-ce67-4291-964e-842f7a5e2cc9", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "0adfcb5d-0ba7-431a-b726-c3eb949963fb", + "source": "1f90f262-66a2-4d85-a5d0-43c136fa7771", "transform": [ { "type": "filter_element", @@ -70,11 +70,11 @@ "range": "height" }, { - "name": "color_ae923d43-2244-48a0-acbf-d29162fd9785", + "name": "color_ff95b421-d4c7-4630-a0e7-470734577891", "type": "linear", "domain": { - "data": "blobs_multiscale_image_c55bc3d7-3026-4ca3-9582-75ffc77620d6", - "field": "channel_0" + "data": "blobs_multiscale_image_25adc079-ce67-4291-964e-842f7a5e2cc9", + "field": "value" }, "range": { "scheme": "Greys", @@ -93,8 +93,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -118,8 +120,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -139,7 +143,7 @@ "type": "gradient", "direction": "vertical", "orient": "none", - "fill": "color_ae923d43-2244-48a0-acbf-d29162fd9785", + "fill": "color_ff95b421-d4c7-4630-a0e7-470734577891", "fillColor": "#ffffff", "gradientLength": 243.2, "gradientOpacity": 1.0, @@ -148,7 +152,8 @@ "gradientStrokeWidth": 0.8888888888888888, "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], "labelAlign": "left", - "labelColor": "#000000ff", + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -162,7 +167,7 @@ { "type": "raster_image", "from": { - "data": "blobs_multiscale_image_c55bc3d7-3026-4ca3-9582-75ffc77620d6" + "data": "blobs_multiscale_image_25adc079-ce67-4291-964e-842f7a5e2cc9" }, "zindex": 0, "encode": { @@ -172,7 +177,7 @@ }, "fill": [ { - "scale": "color_ae923d43-2244-48a0-acbf-d29162fd9785", + "scale": "color_ff95b421-d4c7-4630-a0e7-470734577891", "value": "value" } ] @@ -181,7 +186,7 @@ } ], "usermeta": { - "axis_uuid": "f88dac95-cdc2-5cc2-9c3f-d8013c70228d" + "axis_uuid": "81be769f-7725-5c7a-b81b-93d7595e4428" } } ] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json index c65e1284..35c2e340 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "a69da098-cb50-4f55-91cd-817f17c5a52b", + "name": "33e11ade-b94f-46fe-988c-6c2797d42b63", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9", + "name": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "a69da098-cb50-4f55-91cd-817f17c5a52b", + "source": "33e11ade-b94f-46fe-988c-6c2797d42b63", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_cfab0e24-53b3-4fbb-a2a1-f1937d26264c", + "name": "color_6adfa8d8-d389-45e6-93d4-41316230ed41", "type": "linear", "domain": { - "data": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9", + "data": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923", "field": "channel_0" }, "range": { @@ -82,10 +82,10 @@ } }, { - "name": "color_8d53e0ac-d209-44cb-b225-9322d9ca8b96", + "name": "color_d85ab719-b866-4cb7-9dbf-d740b7ea9972", "type": "linear", "domain": { - "data": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9", + "data": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923", "field": "channel_1" }, "range": { @@ -105,8 +105,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -130,8 +132,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -150,7 +154,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_437c4b1f-2bb4-4ee7-bd12-cdb538d936f9" + "data": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923" }, "zindex": 0, "encode": { @@ -160,11 +164,11 @@ }, "fill": [ { - "scale": "color_cfab0e24-53b3-4fbb-a2a1-f1937d26264c", + "scale": "color_6adfa8d8-d389-45e6-93d4-41316230ed41", "field": "channel_0" }, { - "scale": "color_8d53e0ac-d209-44cb-b225-9322d9ca8b96", + "scale": "color_d85ab719-b866-4cb7-9dbf-d740b7ea9972", "field": "channel_1" } ] @@ -173,7 +177,7 @@ } ], "usermeta": { - "axis_uuid": "76201cde-07a0-5afb-99f2-f13e85339410" + "axis_uuid": "248551f7-f962-5d91-a248-c48417951257" } } ] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json index b38716b1..c49b8ef6 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "c6c62239-dd86-45f5-9cc8-b3bfea498bae", + "name": "0a5f8a39-9cc7-4bf4-961a-7c7fe446250a", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904", + "name": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "c6c62239-dd86-45f5-9cc8-b3bfea498bae", + "source": "0a5f8a39-9cc7-4bf4-961a-7c7fe446250a", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_7f41b4ad-6077-411d-a592-05f1ac316938", + "name": "color_be7b064a-e871-48fc-8381-d7df2b82b594", "type": "linear", "domain": { - "data": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904", + "data": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae", "field": "channel_0" }, "range": { @@ -82,10 +82,10 @@ } }, { - "name": "color_b884e4fe-43f2-4010-a07c-9e4326dfd4ec", + "name": "color_4d70686d-2919-45e5-a58a-19e1640eca46", "type": "linear", "domain": { - "data": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904", + "data": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae", "field": "channel_1" }, "range": { @@ -105,8 +105,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -130,8 +132,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -150,7 +154,7 @@ { "type": "raster_image", "from": { - "data": "blobs_multiscale_image_991dd824-9590-454a-9673-aa5fc7a4a904" + "data": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae" }, "zindex": 0, "encode": { @@ -160,11 +164,11 @@ }, "fill": [ { - "scale": "color_7f41b4ad-6077-411d-a592-05f1ac316938", + "scale": "color_be7b064a-e871-48fc-8381-d7df2b82b594", "field": "channel_0" }, { - "scale": "color_b884e4fe-43f2-4010-a07c-9e4326dfd4ec", + "scale": "color_4d70686d-2919-45e5-a58a-19e1640eca46", "field": "channel_1" } ] @@ -173,7 +177,7 @@ } ], "usermeta": { - "axis_uuid": "02be8923-38c4-5d0d-858c-f14103618653" + "axis_uuid": "09662dc6-87eb-5032-ae3a-272fc72e428c" } } ] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json index 570e2099..85939710 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "e4626e9f-ee78-4ccd-b29b-f27d588f084c", + "name": "f5f05acd-c163-4d7e-b606-bc6ab159c6a9", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8", + "name": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "e4626e9f-ee78-4ccd-b29b-f27d588f084c", + "source": "f5f05acd-c163-4d7e-b606-bc6ab159c6a9", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_37849dc4-7a97-4b4e-95a3-a6564b930652", + "name": "color_519cef40-0b49-4e41-bd07-e68953d2a606", "type": "linear", "domain": { - "data": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8", + "data": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f", "field": "channel_0" }, "range": { @@ -82,10 +82,10 @@ } }, { - "name": "color_7ccc915c-c713-403a-b2a5-7e1cabe499d1", + "name": "color_0ea95ef0-77e0-489b-b5c7-d70ac4f8a640", "type": "linear", "domain": { - "data": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8", + "data": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f", "field": "channel_1" }, "range": { @@ -105,8 +105,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -130,8 +132,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -150,7 +154,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_c1b2dcc2-1220-4be9-99fe-21ad9ac3efe8" + "data": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f" }, "zindex": 0, "encode": { @@ -160,11 +164,11 @@ }, "fill": [ { - "scale": "color_37849dc4-7a97-4b4e-95a3-a6564b930652", + "scale": "color_519cef40-0b49-4e41-bd07-e68953d2a606", "field": "channel_0" }, { - "scale": "color_7ccc915c-c713-403a-b2a5-7e1cabe499d1", + "scale": "color_0ea95ef0-77e0-489b-b5c7-d70ac4f8a640", "field": "channel_1" } ] @@ -173,7 +177,7 @@ } ], "usermeta": { - "axis_uuid": "349318be-8354-50b4-8875-f394ab309ed8" + "axis_uuid": "bb399d0e-2cb1-5a66-9491-7847121c50d1" } } ] diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json index 8aaa9409..73756c50 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "19462dc6-bbde-41e2-92b9-b102f6a65f73", + "name": "2547d2aa-44a8-4022-a755-f656fcd94b7f", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5", + "name": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "19462dc6-bbde-41e2-92b9-b102f6a65f73", + "source": "2547d2aa-44a8-4022-a755-f656fcd94b7f", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_d06afb51-4249-41e8-acb5-d5f8322e9b25", + "name": "color_049a6837-e6a2-4736-9ae3-73dec8664ba8", "type": "linear", "domain": { - "data": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5", + "data": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855", "field": "channel_0" }, "range": { @@ -82,10 +82,10 @@ } }, { - "name": "color_4ae6af24-fa9c-4afe-a74d-3205fa53e67c", + "name": "color_d98f460f-804b-4a55-8ec8-f70fc0e4e419", "type": "linear", "domain": { - "data": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5", + "data": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855", "field": "channel_1" }, "range": { @@ -105,8 +105,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -130,8 +132,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -150,7 +154,7 @@ { "type": "raster_image", "from": { - "data": "blobs_multiscale_image_1b37bcd3-5d72-483b-aa6b-c3e447b5cec5" + "data": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855" }, "zindex": 0, "encode": { @@ -160,11 +164,11 @@ }, "fill": [ { - "scale": "color_d06afb51-4249-41e8-acb5-d5f8322e9b25", + "scale": "color_049a6837-e6a2-4736-9ae3-73dec8664ba8", "field": "channel_0" }, { - "scale": "color_4ae6af24-fa9c-4afe-a74d-3205fa53e67c", + "scale": "color_d98f460f-804b-4a55-8ec8-f70fc0e4e419", "field": "channel_1" } ] @@ -173,7 +177,7 @@ } ], "usermeta": { - "axis_uuid": "6b3277dc-a049-584a-9a8c-efd99d4ef172" + "axis_uuid": "e02813ac-4d6a-5ec4-80b3-0e83933bf9be" } } ] diff --git a/tests/_figures_viewconfig/Images_can_stack_render_images.json b/tests/_figures_viewconfig/Images_can_stack_render_images.json index 0a0c7fde..6c15a809 100644 --- a/tests/_figures_viewconfig/Images_can_stack_render_images.json +++ b/tests/_figures_viewconfig/Images_can_stack_render_images.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "f1acc23e-cc47-493b-b308-4e4ab2e17002", + "name": "c63bccea-c1a9-4466-bc1e-463c2590916e", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_image_cae83642-8855-446a-bd01-6452c2914b76", + "name": "blobs_image_12f4a6c6-7a63-4027-b2f3-e8e4fa5f59ff", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "f1acc23e-cc47-493b-b308-4e4ab2e17002", + "source": "c63bccea-c1a9-4466-bc1e-463c2590916e", "transform": [ { "type": "filter_element", @@ -56,12 +56,12 @@ ] }, { - "name": "blobs_image_815aba87-74c9-4875-925d-e124cee4e4cf", + "name": "blobs_image_f2913717-e85b-40e6-a477-0f1dec97f59e", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "f1acc23e-cc47-493b-b308-4e4ab2e17002", + "source": "c63bccea-c1a9-4466-bc1e-463c2590916e", "transform": [ { "type": "filter_element", @@ -96,11 +96,11 @@ "range": "height" }, { - "name": "color_3def14ba-8ef1-4ff5-88f9-6cc86a43d08b", + "name": "color_b43632ce-2fe0-41e9-9c23-cc70984b4485", "type": "linear", "domain": { - "data": "blobs_image_cae83642-8855-446a-bd01-6452c2914b76", - "field": "channel_0" + "data": "blobs_image_12f4a6c6-7a63-4027-b2f3-e8e4fa5f59ff", + "field": "value" }, "range": { "scheme": "red", @@ -108,11 +108,11 @@ } }, { - "name": "color_815dbcad-1207-48cb-94eb-e37535f185e3", + "name": "color_04992f94-de7a-499b-b874-7a8ed552c258", "type": "linear", "domain": { - "data": "blobs_image_815aba87-74c9-4875-925d-e124cee4e4cf", - "field": "channel_0" + "data": "blobs_image_f2913717-e85b-40e6-a477-0f1dec97f59e", + "field": "value" }, "range": { "scheme": "blue", @@ -131,8 +131,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -156,8 +158,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -177,7 +181,7 @@ "type": "gradient", "direction": "vertical", "orient": "none", - "fill": "color_3def14ba-8ef1-4ff5-88f9-6cc86a43d08b", + "fill": "color_b43632ce-2fe0-41e9-9c23-cc70984b4485", "fillColor": "#ffffff", "gradientLength": 243.2, "gradientOpacity": 1.0, @@ -186,7 +190,8 @@ "gradientStrokeWidth": 0.8888888888888888, "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], "labelAlign": "left", - "labelColor": "#000000ff", + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -199,7 +204,7 @@ "type": "gradient", "direction": "vertical", "orient": "none", - "fill": "color_815dbcad-1207-48cb-94eb-e37535f185e3", + "fill": "color_04992f94-de7a-499b-b874-7a8ed552c258", "fillColor": "#ffffff", "gradientLength": 243.2, "gradientOpacity": 1.0, @@ -208,7 +213,8 @@ "gradientStrokeWidth": 0.8888888888888888, "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], "labelAlign": "left", - "labelColor": "#000000ff", + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -222,7 +228,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_cae83642-8855-446a-bd01-6452c2914b76" + "data": "blobs_image_12f4a6c6-7a63-4027-b2f3-e8e4fa5f59ff" }, "zindex": 0, "encode": { @@ -232,7 +238,7 @@ }, "fill": [ { - "scale": "color_3def14ba-8ef1-4ff5-88f9-6cc86a43d08b", + "scale": "color_b43632ce-2fe0-41e9-9c23-cc70984b4485", "value": "value" } ] @@ -242,7 +248,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_815aba87-74c9-4875-925d-e124cee4e4cf" + "data": "blobs_image_f2913717-e85b-40e6-a477-0f1dec97f59e" }, "zindex": 1, "encode": { @@ -252,7 +258,7 @@ }, "fill": [ { - "scale": "color_815dbcad-1207-48cb-94eb-e37535f185e3", + "scale": "color_04992f94-de7a-499b-b874-7a8ed552c258", "value": "value" } ] @@ -261,7 +267,7 @@ } ], "usermeta": { - "axis_uuid": "1ecea0a6-fa57-51f3-9204-61acfc923a34" + "axis_uuid": "0710cb92-bc50-53e6-9b3c-30799e3f3214" } } ] diff --git a/tests/_figures_viewconfig/Images_can_stick_to_zorder.json b/tests/_figures_viewconfig/Images_can_stick_to_zorder.json index 212c315d..4e55b013 100644 --- a/tests/_figures_viewconfig/Images_can_stick_to_zorder.json +++ b/tests/_figures_viewconfig/Images_can_stick_to_zorder.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "name": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_circles_2011a6f9-bbcf-4613-8d36-e32a56b7d80e", + "name": "blobs_circles_cf9bea02-83c7-4cbf-ab04-3b0fc03a0efe", "format": { "type": "ShapesFormatV02", "version": "0.2" }, - "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", "transform": [ { "type": "filter_element", @@ -48,12 +48,12 @@ ] }, { - "name": "blobs_polygons_d3b7570c-468f-44f7-b2fb-9db2a24fef91", + "name": "blobs_polygons_743fda8d-a7df-46ea-8e9e-b7b02166d0ee", "format": { "type": "ShapesFormatV02", "version": "0.2" }, - "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", "transform": [ { "type": "filter_element", @@ -66,12 +66,12 @@ ] }, { - "name": "blobs_multipolygons_bfc9adb0-62b9-40f4-ae27-602a1621912f", + "name": "blobs_multipolygons_81eb2fbb-e456-44d5-869a-27dc0b455333", "format": { "type": "ShapesFormatV02", "version": "0.2" }, - "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", "transform": [ { "type": "filter_element", @@ -84,12 +84,12 @@ ] }, { - "name": "blobs_image_6b94ea67-7021-4163-a614-13b7d85d7cca", + "name": "blobs_image_8fb8d079-09d7-4aec-95b5-2cf9d02054df", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", "transform": [ { "type": "filter_element", @@ -110,12 +110,12 @@ ] }, { - "name": "blobs_multiscale_image_8d40fd50-d385-4c1a-94af-5d9c78815dd5", + "name": "blobs_multiscale_image_503495d1-1210-4584-a44f-df132a64b4a5", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "f78b3d63-78ad-4fa4-b2b4-5b90deacdbf8", + "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", "transform": [ { "type": "filter_element", @@ -150,10 +150,10 @@ "range": "height" }, { - "name": "color_360709a7-9663-447a-9968-5491a884ba95", + "name": "color_f58f3d5e-13c7-4b7f-8f79-d468e660538c", "type": "linear", "domain": { - "data": "blobs_image_6b94ea67-7021-4163-a614-13b7d85d7cca", + "data": "blobs_image_8fb8d079-09d7-4aec-95b5-2cf9d02054df", "field": "value" }, "range": { @@ -162,10 +162,10 @@ } }, { - "name": "color_28b7bed3-0a23-4705-af69-de2fec0da0d5", + "name": "color_6a9ca815-465f-42a1-8cc7-dd4b00a97446", "type": "linear", "domain": { - "data": "blobs_multiscale_image_8d40fd50-d385-4c1a-94af-5d9c78815dd5", + "data": "blobs_multiscale_image_503495d1-1210-4584-a44f-df132a64b4a5", "field": "value" }, "range": { @@ -185,8 +185,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -210,8 +212,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -230,7 +234,7 @@ { "type": "path", "from": { - "data": "blobs_circles_2011a6f9-bbcf-4613-8d36-e32a56b7d80e" + "data": "blobs_circles_cf9bea02-83c7-4cbf-ab04-3b0fc03a0efe" }, "zindex": 0, "encode": { @@ -257,7 +261,7 @@ { "type": "path", "from": { - "data": "blobs_polygons_d3b7570c-468f-44f7-b2fb-9db2a24fef91" + "data": "blobs_polygons_743fda8d-a7df-46ea-8e9e-b7b02166d0ee" }, "zindex": 1, "encode": { @@ -284,7 +288,7 @@ { "type": "path", "from": { - "data": "blobs_multipolygons_bfc9adb0-62b9-40f4-ae27-602a1621912f" + "data": "blobs_multipolygons_81eb2fbb-e456-44d5-869a-27dc0b455333" }, "zindex": 2, "encode": { @@ -311,7 +315,7 @@ { "type": "raster_image", "from": { - "data": "blobs_image_6b94ea67-7021-4163-a614-13b7d85d7cca" + "data": "blobs_image_8fb8d079-09d7-4aec-95b5-2cf9d02054df" }, "zindex": 3, "encode": { @@ -321,7 +325,7 @@ }, "fill": [ { - "scale": "color_360709a7-9663-447a-9968-5491a884ba95", + "scale": "color_f58f3d5e-13c7-4b7f-8f79-d468e660538c", "value": "value" } ] @@ -331,7 +335,7 @@ { "type": "raster_image", "from": { - "data": "blobs_multiscale_image_8d40fd50-d385-4c1a-94af-5d9c78815dd5" + "data": "blobs_multiscale_image_503495d1-1210-4584-a44f-df132a64b4a5" }, "zindex": 4, "encode": { @@ -341,7 +345,7 @@ }, "fill": [ { - "scale": "color_28b7bed3-0a23-4705-af69-de2fec0da0d5", + "scale": "color_6a9ca815-465f-42a1-8cc7-dd4b00a97446", "value": "value" } ] @@ -350,7 +354,7 @@ } ], "usermeta": { - "axis_uuid": "bce72096-f040-509b-903f-7953efa752d3" + "axis_uuid": "df82fb18-3c1a-5887-b764-365dcbdd9385" } } ] diff --git a/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json b/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json index f328695c..7e3ab231 100644 --- a/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json +++ b/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json @@ -22,7 +22,7 @@ }, "data": [ { - "name": "0f4350cf-6ca8-43d9-9d29-434120f241d6", + "name": "faf8d241-2f6c-4729-836b-c14028d22fd5", "url": "sdata.zarr", "format": { "type": "SpatialData", @@ -30,12 +30,12 @@ } }, { - "name": "blobs_giant_image_6d203839-9086-4229-a7ee-095778bf964f", + "name": "blobs_giant_image_05bc1c72-d646-4974-8096-7abc3654e356", "format": { "type": "RasterFormatV02", "version": "0.2" }, - "source": "0f4350cf-6ca8-43d9-9d29-434120f241d6", + "source": "faf8d241-2f6c-4729-836b-c14028d22fd5", "transform": [ { "type": "filter_element", @@ -70,10 +70,10 @@ "range": "height" }, { - "name": "color_91959b6a-a022-4bc7-8807-e0ae7cd6b2fe", + "name": "color_590e603a-b5e6-4896-8161-3b5cb4c7eec0", "type": "linear", "domain": { - "data": "blobs_giant_image_6d203839-9086-4229-a7ee-095778bf964f", + "data": "blobs_giant_image_05bc1c72-d646-4974-8096-7abc3654e356", "field": "value" }, "range": { @@ -93,8 +93,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -118,8 +120,10 @@ "grid": true, "gridOpacity": 1.0, "gridCap": "butt", - "gridColor": "#ccccccff", + "gridColor": "#cccccc", "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, "labelFont": "Arial", "labelFontSize": 15.555555555555555, "labelFontStyle": "normal", @@ -138,7 +142,7 @@ { "type": "raster_image", "from": { - "data": "blobs_giant_image_6d203839-9086-4229-a7ee-095778bf964f" + "data": "blobs_giant_image_05bc1c72-d646-4974-8096-7abc3654e356" }, "zindex": 0, "encode": { @@ -148,7 +152,7 @@ }, "fill": [ { - "scale": "color_91959b6a-a022-4bc7-8807-e0ae7cd6b2fe", + "scale": "color_590e603a-b5e6-4896-8161-3b5cb4c7eec0", "value": "value" } ] @@ -157,7 +161,7 @@ } ], "usermeta": { - "axis_uuid": "15c97a74-f0df-55df-932b-188eb819eca7" + "axis_uuid": "8407b6de-1716-54b5-b48c-803732f4475c" } } ] From 973ec5ac25f94867f7f5d92151b5d15ebb3348a7 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Wed, 30 Apr 2025 08:46:49 +0200 Subject: [PATCH 44/56] fix na color scale labels --- src/spatialdata_plot/_viewconfig/scales.py | 2 + .../Labels_can_do_rasterization.json | 172 ++++++++++++++ ...nder_given_scale_of_multiscale_labels.json | 172 ++++++++++++++ .../Labels_can_render_labels.json | 172 ++++++++++++++ .../Labels_can_render_multiscale_labels.json | 172 ++++++++++++++ .../Labels_can_stack_render_labels.json | 213 ++++++++++++++++++ ...an_stop_rasterization_with_scale_full.json | 172 ++++++++++++++ 7 files changed, 1075 insertions(+) create mode 100644 tests/_figures_viewconfig/Labels_can_do_rasterization.json create mode 100644 tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json create mode 100644 tests/_figures_viewconfig/Labels_can_render_labels.json create mode 100644 tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json create mode 100644 tests/_figures_viewconfig/Labels_can_stack_render_labels.json create mode 100644 tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py index 90322049..2a9f3e94 100644 --- a/src/spatialdata_plot/_viewconfig/scales.py +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -214,6 +214,8 @@ def create_colorscale_array_points_shapes_labels( data_object["name"], ) ) + else: + return [] return [color_scale_object] diff --git a/tests/_figures_viewconfig/Labels_can_do_rasterization.json b/tests/_figures_viewconfig/Labels_can_do_rasterization.json new file mode 100644 index 00000000..00ece89c --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_do_rasterization.json @@ -0,0 +1,172 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "aabf5af9-109b-44e2-9c5f-a37265475055", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_giant_labels_c034968f-e957-4462-9e82-1b3efa5faaa6", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "aabf5af9-109b-44e2-9c5f-a37265475055", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_7784118b-ce42-430f-98a0-0e06563fafdc", + "type": "ordinal", + "domain": { + "data": "blobs_giant_labels_c034968f-e957-4462-9e82-1b3efa5faaa6", + "field": "value" + }, + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_giant_labels_c034968f-e957-4462-9e82-1b3efa5faaa6" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_7784118b-ce42-430f-98a0-0e06563fafdc", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_7784118b-ce42-430f-98a0-0e06563fafdc", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "517c5bb4-5247-539f-9447-632f5c2cf36b" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json b/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json new file mode 100644 index 00000000..f141762e --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json @@ -0,0 +1,172 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3e3b8e37-fedc-47fe-8f13-e93c8247e6b8", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_labels_0c301e96-1f0a-455b-be38-d76a657a309f", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "3e3b8e37-fedc-47fe-8f13-e93c8247e6b8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale1" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_c0f722a3-2110-440d-a465-27c39242c840", + "type": "ordinal", + "domain": { + "data": "blobs_multiscale_labels_0c301e96-1f0a-455b-be38-d76a657a309f", + "field": "value" + }, + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_0c301e96-1f0a-455b-be38-d76a657a309f" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_c0f722a3-2110-440d-a465-27c39242c840", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_c0f722a3-2110-440d-a465-27c39242c840", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "0c0b63b4-ff52-5b96-9d67-d3557c3aea38" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_render_labels.json b/tests/_figures_viewconfig/Labels_can_render_labels.json new file mode 100644 index 00000000..06dc4102 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_render_labels.json @@ -0,0 +1,172 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "67ee3129-4474-4b34-a06a-392dc462bd30", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_labels_592a6c8b-a235-4b83-8fcb-25b5dea54aab", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "67ee3129-4474-4b34-a06a-392dc462bd30", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_3e3c0c81-6ea6-4697-943e-a99d61ac02f0", + "type": "ordinal", + "domain": { + "data": "blobs_labels_592a6c8b-a235-4b83-8fcb-25b5dea54aab", + "field": "value" + }, + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_592a6c8b-a235-4b83-8fcb-25b5dea54aab" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_3e3c0c81-6ea6-4697-943e-a99d61ac02f0", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_3e3c0c81-6ea6-4697-943e-a99d61ac02f0", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "a1200cf1-7f34-52b9-86c3-3b264b34a4a6" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json b/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json new file mode 100644 index 00000000..269765e8 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json @@ -0,0 +1,172 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "6023d889-bae1-48ee-ab7c-ffbafc6b7f33", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_labels_f3e67ce7-5c47-4bdb-86cd-968c1c869d02", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "6023d889-bae1-48ee-ab7c-ffbafc6b7f33", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_4231a9cf-aa0d-44c9-b56d-4b41f40841af", + "type": "ordinal", + "domain": { + "data": "blobs_multiscale_labels_f3e67ce7-5c47-4bdb-86cd-968c1c869d02", + "field": "value" + }, + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_f3e67ce7-5c47-4bdb-86cd-968c1c869d02" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_4231a9cf-aa0d-44c9-b56d-4b41f40841af", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_4231a9cf-aa0d-44c9-b56d-4b41f40841af", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "74a12ec7-4ee6-507f-9476-700bfe05ca9f" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_stack_render_labels.json b/tests/_figures_viewconfig/Labels_can_stack_render_labels.json new file mode 100644 index 00000000..38e61a86 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_stack_render_labels.json @@ -0,0 +1,213 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "545ba7f6-b28a-4f22-bf95-7dae8458afca", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_labels_d67ce142-5870-4b3a-896c-990c3821bfce", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "545ba7f6-b28a-4f22-bf95-7dae8458afca", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "blobs_labels_47da63b2-1fdc-498e-ae0e-d41989009806", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "545ba7f6-b28a-4f22-bf95-7dae8458afca", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_d67ce142-5870-4b3a-896c-990c3821bfce" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "value": "#ff0000" + } + ], + "fill": [ + { + "value": "#ff0000" + } + ], + "fillOpacity": { + "value": 1 + }, + "strokeOpacity": { + "value": 0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "raster_label", + "from": { + "data": "blobs_labels_47da63b2-1fdc-498e-ae0e-d41989009806" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "value": "#0000ff" + } + ], + "fill": [ + { + "value": "#0000ff" + } + ], + "fillOpacity": { + "value": 0 + }, + "strokeOpacity": { + "value": 1 + }, + "strokeWidth": { + "value": 15 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "b9a14944-c16a-50bf-a25f-c5f37ecba3f0" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json b/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json new file mode 100644 index 00000000..dd2e77f7 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json @@ -0,0 +1,172 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f704d041-82f5-4071-b649-0bf861d3909e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_giant_labels_7c4bb325-4d86-496c-91fa-9cb882bda262", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "f704d041-82f5-4071-b649-0bf861d3909e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_47b4272b-5118-4d15-a467-08fbc16ecc7f", + "type": "ordinal", + "domain": { + "data": "blobs_giant_labels_7c4bb325-4d86-496c-91fa-9cb882bda262", + "field": "value" + }, + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_giant_labels_7c4bb325-4d86-496c-91fa-9cb882bda262" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_47b4272b-5118-4d15-a467-08fbc16ecc7f", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_47b4272b-5118-4d15-a467-08fbc16ecc7f", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "751647c0-0c89-5ddd-9886-922ec7d13488" + } + } +] From 562709b922186bfc550fbebd28b6bc5203d22b0a Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Wed, 30 Apr 2025 14:06:35 +0200 Subject: [PATCH 45/56] fix label color ref and table layer expr --- src/spatialdata_plot/_viewconfig/data.py | 2 +- src/spatialdata_plot/_viewconfig/marks.py | 4 +- ..._can_annotate_labels_with_table_layer.json | 239 +++++++++ ..._color_labels_by_categorical_variable.json | 229 +++++++++ ...n_color_labels_by_continuous_variable.json | 237 +++++++++ ...bels_can_color_with_norm_and_clipping.json | 240 +++++++++ ...abels_can_color_with_norm_no_clipping.json | 240 +++++++++ .../Labels_can_control_label_infill.json | 237 +++++++++ .../Labels_can_control_label_outline.json | 237 +++++++++ ...can_plot_with_one_element_color_table.json | 361 ++++++++++++++ .../Labels_label_categorical_color.json | 229 +++++++++ ...uses_alpha_of_less_transparent_infill.json | 237 +++++++++ ...ses_alpha_of_less_transparent_outline.json | 237 +++++++++ ...set_categorical_label_maintains_order.json | 456 ++++++++++++++++++ ...with_coloring_result_in_two_colorbars.json | 361 ++++++++++++++ tests/pl/test_render_labels.py | 2 +- 16 files changed, 3545 insertions(+), 3 deletions(-) create mode 100644 tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json create mode 100644 tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json create mode 100644 tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json create mode 100644 tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json create mode 100644 tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json create mode 100644 tests/_figures_viewconfig/Labels_can_control_label_infill.json create mode 100644 tests/_figures_viewconfig/Labels_can_control_label_outline.json create mode 100644 tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json create mode 100644 tests/_figures_viewconfig/Labels_label_categorical_color.json create mode 100644 tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json create mode 100644 tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json create mode 100644 tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json create mode 100644 tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json diff --git a/src/spatialdata_plot/_viewconfig/data.py b/src/spatialdata_plot/_viewconfig/data.py index 941774f1..275981a7 100644 --- a/src/spatialdata_plot/_viewconfig/data.py +++ b/src/spatialdata_plot/_viewconfig/data.py @@ -137,7 +137,7 @@ def create_table_data_object(table_name: str, base_uuid: str, table_layer: str | "transform": [{"type": "filter_element", "expr": table_name}], } if table_layer is not None: - table_object["transform"].append({"type": "filter_layer"}) # type: ignore[attr-defined] + table_object["transform"].append({"type": "filter_layer", "expr": table_layer}) # type: ignore[attr-defined] return table_object diff --git a/src/spatialdata_plot/_viewconfig/marks.py b/src/spatialdata_plot/_viewconfig/marks.py index e204722a..eab59844 100644 --- a/src/spatialdata_plot/_viewconfig/marks.py +++ b/src/spatialdata_plot/_viewconfig/marks.py @@ -297,7 +297,9 @@ def create_raster_label_marks_object( encode_update = None if params.colortype == "continuous": - field = color_scale_array[0]["domain"]["field"][0] + if isinstance(field := color_scale_array[0]["domain"]["field"], list): + field = field[0] + fill_color = [{"scale": color_scale_array[0]["name"], "value": field}] encode_update = { "fill": [ diff --git a/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json b/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json new file mode 100644 index 00000000..2613f836 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json @@ -0,0 +1,239 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f2273134-9c3e-48d1-86d5-f8518b6c4041", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "b4e16384-7d2c-470c-ad61-8e84c238efbf", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "f2273134-9c3e-48d1-86d5-f8518b6c4041", + "transform": [ + { + "type": "filter_element", + "expr": "table" + }, + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_labels_7cc1f7c6-c0b0-4202-a96e-bb85890d0391", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "f2273134-9c3e-48d1-86d5-f8518b6c4041", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "b4e16384-7d2c-470c-ad61-8e84c238efbf", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", + "type": "linear", + "domain": { + "data": "blobs_labels_7cc1f7c6-c0b0-4202-a96e-bb85890d0391", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_7cc1f7c6-c0b0-4202-a96e-bb85890d0391" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "8fdf06ac-1da2-596c-abf9-c6359bdee8b7" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json new file mode 100644 index 00000000..0aacc850 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json @@ -0,0 +1,229 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a4ada884-5631-49dd-b4cc-687afa14d2b2", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "7a7b68dd-3a01-44dd-a8b2-28db61cb7e50", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "a4ada884-5631-49dd-b4cc-687afa14d2b2", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_d0589e37-1c9c-4e19-bac3-dff60b01e634", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "a4ada884-5631-49dd-b4cc-687afa14d2b2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "7a7b68dd-3a01-44dd-a8b2-28db61cb7e50", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", + "type": "ordinal", + "domain": ["channel_0_sum", "channel_1_sum", "channel_2_sum"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 174.96555555555554, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_d0589e37-1c9c-4e19-bac3-dff60b01e634" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "dc1798bd-77de-5815-8a44-7b4aaf44bac9" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json b/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json new file mode 100644 index 00000000..a242820a --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json @@ -0,0 +1,237 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "10d8a2b0-2219-4c88-adea-dddf10fe68c6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "1e2706f9-e0ca-4c24-9051-481bfdbdddbf", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "10d8a2b0-2219-4c88-adea-dddf10fe68c6", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_477df7ab-2898-4552-bdc4-2d4bd2c576f4", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "10d8a2b0-2219-4c88-adea-dddf10fe68c6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "1e2706f9-e0ca-4c24-9051-481bfdbdddbf", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", + "type": "linear", + "domain": { + "data": "blobs_labels_477df7ab-2898-4552-bdc4-2d4bd2c576f4", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_477df7ab-2898-4552-bdc4-2d4bd2c576f4" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "52d93b1c-87e1-5344-b819-100e28a7259f" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json b/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json new file mode 100644 index 00000000..27175e97 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json @@ -0,0 +1,240 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "42ef66c8-0f23-423b-b8e1-eeb0ceacd30b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "d1f2f413-ed97-4b73-8e0b-980f7419ffe6", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "42ef66c8-0f23-423b-b8e1-eeb0ceacd30b", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_d657eb5c-2fda-4a6f-92b8-3e147b64fccc", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "42ef66c8-0f23-423b-b8e1-eeb0ceacd30b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "d1f2f413-ed97-4b73-8e0b-980f7419ffe6", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + }, + { + "type": "formula", + "expr": "clamp((datum.value - 400.0) / (1000.0 - 400.0), 0, 1)", + "as": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", + "type": "linear", + "domain": { + "data": "blobs_labels_d657eb5c-2fda-4a6f-92b8-3e147b64fccc", + "field": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.800000000000068, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_d657eb5c-2fda-4a6f-92b8-3e147b64fccc" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", + "value": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" + } + ], + "fill": [ + { + "scale": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", + "value": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", + "field": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "a083a609-d943-5fa6-80f0-5eb601db4d00" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json b/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json new file mode 100644 index 00000000..ffd59530 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json @@ -0,0 +1,240 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "312c2851-9a2c-4ea1-9c37-7ba0ae9d7721", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "eefe0309-bdb9-4640-a4be-140cbcbde358", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "312c2851-9a2c-4ea1-9c37-7ba0ae9d7721", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_6567dc9a-1381-4032-babc-a24882860474", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "312c2851-9a2c-4ea1-9c37-7ba0ae9d7721", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "eefe0309-bdb9-4640-a4be-140cbcbde358", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + }, + { + "type": "formula", + "expr": "(datum.value - 400.0) / (1000.0 - 400.0)", + "as": "c7ba2f98-d170-435d-86e3-b610da7e882e" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", + "type": "linear", + "domain": { + "data": "blobs_labels_6567dc9a-1381-4032-babc-a24882860474", + "field": "c7ba2f98-d170-435d-86e3-b610da7e882e" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.800000000000068, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_6567dc9a-1381-4032-babc-a24882860474" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", + "value": "c7ba2f98-d170-435d-86e3-b610da7e882e" + } + ], + "fill": [ + { + "scale": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", + "value": "c7ba2f98-d170-435d-86e3-b610da7e882e" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", + "field": "c7ba2f98-d170-435d-86e3-b610da7e882e" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "e7e32241-4323-5290-91b6-776aaaf10bbb" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_control_label_infill.json b/tests/_figures_viewconfig/Labels_can_control_label_infill.json new file mode 100644 index 00000000..aac37f2f --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_control_label_infill.json @@ -0,0 +1,237 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5f50c9dd-dce8-431b-af44-460724119037", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "ef42acc9-3c35-469c-a667-257569ee76e7", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "5f50c9dd-dce8-431b-af44-460724119037", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_3cf6a48c-63b2-4c26-bdd2-a10e6b395a33", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "5f50c9dd-dce8-431b-af44-460724119037", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "ef42acc9-3c35-469c-a667-257569ee76e7", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", + "type": "linear", + "domain": { + "data": "blobs_labels_3cf6a48c-63b2-4c26-bdd2-a10e6b395a33", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_3cf6a48c-63b2-4c26-bdd2-a10e6b395a33" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "14302cde-62fc-5181-91f9-84e2f3912c1f" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_control_label_outline.json b/tests/_figures_viewconfig/Labels_can_control_label_outline.json new file mode 100644 index 00000000..10060087 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_control_label_outline.json @@ -0,0 +1,237 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e9784389-b68c-4878-ab10-5a52352ef490", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "91daec16-0a2c-465f-aeba-dfc287137de5", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "e9784389-b68c-4878-ab10-5a52352ef490", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_ba1f6f01-08ca-4cf6-a605-5fd786c179e0", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "e9784389-b68c-4878-ab10-5a52352ef490", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "91daec16-0a2c-465f-aeba-dfc287137de5", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", + "type": "linear", + "domain": { + "data": "blobs_labels_ba1f6f01-08ca-4cf6-a605-5fd786c179e0", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_ba1f6f01-08ca-4cf6-a605-5fd786c179e0" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.0 + }, + "strokeOpacity": { + "value": 0.4 + }, + "strokeWidth": { + "value": 15 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "d056520d-87b8-5acb-a761-b9b9eba72a1f" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json b/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json new file mode 100644 index 00000000..009481dc --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json @@ -0,0 +1,361 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "3bbd27c6-90c9-4702-9ac3-bce8b22f06a4", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_e3602ebc-6ddd-42fa-a15f-1dbf524b09d6", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "3bbd27c6-90c9-4702-9ac3-bce8b22f06a4", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + }, + { + "name": "4050e26b-482c-47de-a5bd-e0cac2c014d4", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", + "transform": [ + { + "type": "filter_element", + "expr": "multi_table" + } + ] + }, + { + "name": "blobs_multiscale_labels_68005dad-a2ff-43e0-a196-d85da7e69473", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "4050e26b-482c-47de-a5bd-e0cac2c014d4", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_1_sum"], + "as": ["channel_1_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", + "type": "linear", + "domain": { + "data": "blobs_labels_e3602ebc-6ddd-42fa-a15f-1dbf524b09d6", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_68005dad-a2ff-43e0-a196-d85da7e69473", + "field": ["channel_1_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + }, + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 266.5651200000001, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_e3602ebc-6ddd-42fa-a15f-1dbf524b09d6" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_68005dad-a2ff-43e0-a196-d85da7e69473" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", + "value": "channel_1_sum" + } + ], + "fill": [ + { + "scale": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", + "value": "channel_1_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "97a70941-9b78-57ec-9ca6-83f70e0465c2" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_label_categorical_color.json b/tests/_figures_viewconfig/Labels_label_categorical_color.json new file mode 100644 index 00000000..caaf6e60 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_label_categorical_color.json @@ -0,0 +1,229 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "faeb2a59-fcb1-4446-8e88-a5c57882c7ce", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "8e0dc6a8-89aa-43a2-b950-966d21afb30a", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "faeb2a59-fcb1-4446-8e88-a5c57882c7ce", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" + } + ] + }, + { + "name": "blobs_labels_6460c403-2063-4b03-a0ac-39a096dc2070", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "faeb2a59-fcb1-4446-8e88-a5c57882c7ce", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "8e0dc6a8-89aa-43a2-b950-966d21afb30a", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_6460c403-2063-4b03-a0ac-39a096dc2070" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", + "value": "category" + } + ], + "fill": [ + { + "scale": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", + "value": "category" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", + "field": "category" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "1090a0cc-54d6-58e2-8f48-5aadb9619cfb" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json new file mode 100644 index 00000000..0b5abad5 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json @@ -0,0 +1,237 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "b048ca4b-c094-4a14-bd37-3a468429eab6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "ce7e0acd-5d23-4e94-9a67-8361adab7ba1", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "b048ca4b-c094-4a14-bd37-3a468429eab6", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_c9e0e989-5505-43a3-b229-000156057239", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "b048ca4b-c094-4a14-bd37-3a468429eab6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "ce7e0acd-5d23-4e94-9a67-8361adab7ba1", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", + "type": "linear", + "domain": { + "data": "blobs_labels_c9e0e989-5505-43a3-b229-000156057239", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.7, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_c9e0e989-5505-43a3-b229-000156057239" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.1 + }, + "strokeOpacity": { + "value": 0.7 + }, + "strokeWidth": { + "value": 15 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "0e2750eb-4bb3-502d-9fa2-d1e0b18db946" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json new file mode 100644 index 00000000..86895693 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json @@ -0,0 +1,237 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "6e01eea7-6f7c-4863-aff9-355bd15c00a7", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "30362437-de67-491c-a3d6-3909c4e95699", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "6e01eea7-6f7c-4863-aff9-355bd15c00a7", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_5312b6b0-e66c-4214-b6b9-c649966b379f", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "6e01eea7-6f7c-4863-aff9-355bd15c00a7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "30362437-de67-491c-a3d6-3909c4e95699", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", + "type": "linear", + "domain": { + "data": "blobs_labels_5312b6b0-e66c-4214-b6b9-c649966b379f", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.7, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_5312b6b0-e66c-4214-b6b9-c649966b379f" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.7 + }, + "strokeOpacity": { + "value": 0.1 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "ff0ae4cc-4386-507d-9105-36ba1543cf03" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json new file mode 100644 index 00000000..27a30db4 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json @@ -0,0 +1,456 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "4a397c93-a896-496d-9c4e-c2af0c6d8781", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "829fa5c3-e0d2-48d0-aff4-e8c94b396601", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "4a397c93-a896-496d-9c4e-c2af0c6d8781", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_ecb33cf0-637e-4472-bb9f-670752e53023", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "4a397c93-a896-496d-9c4e-c2af0c6d8781", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "829fa5c3-e0d2-48d0-aff4-e8c94b396601", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", + "type": "ordinal", + "domain": ["channel_0_sum", "channel_1_sum", "channel_2_sum"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 38.820101010101, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_ecb33cf0-637e-4472-bb9f-670752e53023" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "cfd5a5c9-21ec-588a-84f2-05a39c869aa0" + } + }, + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9c67d25f-01a3-428f-9edc-d33237733d3e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "7ca34ed6-dce0-418f-a5e8-d57c71edece3", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "9c67d25f-01a3-428f-9edc-d33237733d3e", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_2d514dac-028d-4aef-9f5e-9dc1eada1db9", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "9c67d25f-01a3-428f-9edc-d33237733d3e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "7ca34ed6-dce0-418f-a5e8-d57c71edece3", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", + "type": "ordinal", + "domain": ["channel_0_sum"], + "range": ["#1f77b4"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 174.9655555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_2d514dac-028d-4aef-9f5e-9dc1eada1db9" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "bd1edb42-b2e7-52cb-91e2-47002b2b17c9" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json b/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json new file mode 100644 index 00000000..bc8b39a0 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json @@ -0,0 +1,361 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "6292f1b9-dbbe-41ed-8184-792b31448d28", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "5ab91e8a-4567-4a7e-a294-0c5294a15673", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_3438e488-e946-452a-adb9-4bbbf7cb7f53", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "5ab91e8a-4567-4a7e-a294-0c5294a15673", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + }, + { + "name": "9d6b0d7d-e69e-4211-a9af-80254977e5d7", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", + "transform": [ + { + "type": "filter_element", + "expr": "multi_table" + } + ] + }, + { + "name": "blobs_multiscale_labels_102ae6e3-75ff-4db1-9f71-05dbede9bedf", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "9d6b0d7d-e69e-4211-a9af-80254977e5d7", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_1_sum"], + "as": ["channel_1_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_3324069a-8eae-47ca-afc6-8571bef2355c", + "type": "linear", + "domain": { + "data": "blobs_labels_3438e488-e946-452a-adb9-4bbbf7cb7f53", + "field": ["channel_0_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_102ae6e3-75ff-4db1-9f71-05dbede9bedf", + "field": ["channel_1_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_3324069a-8eae-47ca-afc6-8571bef2355c", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + }, + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 266.5651200000001, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_3438e488-e946-452a-adb9-4bbbf7cb7f53" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_3324069a-8eae-47ca-afc6-8571bef2355c", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_3324069a-8eae-47ca-afc6-8571bef2355c", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_3324069a-8eae-47ca-afc6-8571bef2355c", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_102ae6e3-75ff-4db1-9f71-05dbede9bedf" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", + "value": "channel_1_sum" + } + ], + "fill": [ + { + "scale": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", + "value": "channel_1_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "fd90b106-e04c-5122-92b3-064155376445" + } + } +] diff --git a/tests/pl/test_render_labels.py b/tests/pl/test_render_labels.py index 2d1075b5..56135ddc 100644 --- a/tests/pl/test_render_labels.py +++ b/tests/pl/test_render_labels.py @@ -165,7 +165,7 @@ def test_plot_label_colorbar_uses_alpha_of_less_transparent_infill( self, sdata_blobs: SpatialData, ): - + # TODO: ask tim regarding this test as the name is confusing or there is a bug. sdata_blobs.pl.render_labels( "blobs_labels", color="channel_0_sum", fill_alpha=0.1, outline_alpha=0.7, contour_px=15 ).pl.show() From 4ec64b5c3023b29621d07a2321fc3c0af1ac1c29 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Wed, 30 Apr 2025 14:19:08 +0200 Subject: [PATCH 46/56] add example configs labels --- ...y_categorical_variable_in_other_table.json | 645 ++++++++++++++++++ ...aintains_order_when_palette_overwrite.json | 456 +++++++++++++ 2 files changed, 1101 insertions(+) create mode 100644 tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json create mode 100644 tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json diff --git a/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json new file mode 100644 index 00000000..7dc59599 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json @@ -0,0 +1,645 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "ch_1_sum", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fe69e52f-3f3a-494d-8bc8-57d599f4b1c7", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "f9aeda1c-37ed-4723-bbf5-3f3a630d4a44", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "fe69e52f-3f3a-494d-8bc8-57d599f4b1c7", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" + } + ] + }, + { + "name": "blobs_multiscale_labels_0ece1786-4f0c-482f-8bdb-7af9c9cb7675", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "fe69e52f-3f3a-494d-8bc8-57d599f4b1c7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale0" + }, + { + "type": "lookup", + "from": "f9aeda1c-37ed-4723-bbf5-3f3a630d4a44", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_1_sum"], + "as": ["channel_1_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_f57fa739-0dda-41b9-b678-84a435383d0d", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_0ece1786-4f0c-482f-8bdb-7af9c9cb7675", + "field": ["channel_1_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_0ece1786-4f0c-482f-8bdb-7af9c9cb7675" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_f57fa739-0dda-41b9-b678-84a435383d0d", + "value": "channel_1_sum" + } + ], + "fill": [ + { + "scale": "color_f57fa739-0dda-41b9-b678-84a435383d0d", + "value": "channel_1_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_f57fa739-0dda-41b9-b678-84a435383d0d", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "d82988d1-e0be-5902-aed3-9f5eff5601b6" + } + }, + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "ch_2_sum", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "37546081-a386-48c8-ba50-8520264fa1f9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "59ccd34c-4481-49ef-9da6-f22ea236e423", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "37546081-a386-48c8-ba50-8520264fa1f9", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" + } + ] + }, + { + "name": "blobs_multiscale_labels_065f128f-956c-4733-9316-a74a67660406", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "37546081-a386-48c8-ba50-8520264fa1f9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale0" + }, + { + "type": "lookup", + "from": "59ccd34c-4481-49ef-9da6-f22ea236e423", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_2_sum"], + "as": ["channel_2_sum"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_59bc380e-35b4-430f-bc4e-264958a7516b", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_065f128f-956c-4733-9316-a74a67660406", + "field": ["channel_2_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_065f128f-956c-4733-9316-a74a67660406" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_59bc380e-35b4-430f-bc4e-264958a7516b", + "value": "channel_2_sum" + } + ], + "fill": [ + { + "scale": "color_59bc380e-35b4-430f-bc4e-264958a7516b", + "value": "channel_2_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_59bc380e-35b4-430f-bc4e-264958a7516b", + "field": "channel_2_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "c4ecf557-1f8c-5ec4-a592-a8be7c0e6809" + } + }, + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "db5f13e3-9f7a-448f-a87b-41492e4b4ab5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "4fa2f359-256c-416c-b362-22d0d53c3e24", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "db5f13e3-9f7a-448f-a87b-41492e4b4ab5", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" + } + ] + }, + { + "name": "blobs_multiscale_labels_15a49996-c5c5-4c83-9e80-a15179db509f", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "db5f13e3-9f7a-448f-a87b-41492e4b4ab5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale0" + }, + { + "type": "lookup", + "from": "4fa2f359-256c-416c-b362-22d0d53c3e24", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", + "type": "ordinal", + "domain": ["ch1", "ch2", "ch0"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 252.59055555555548, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_15a49996-c5c5-4c83-9e80-a15179db509f" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "ec5e2576-6a31-5cb3-bbfa-9736fdd646d2" + } + } +] diff --git a/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json new file mode 100644 index 00000000..84f54678 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json @@ -0,0 +1,456 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9cc2356b-1b35-4a99-8315-4372e83853f9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "55143373-85a2-4861-9732-84e56bfff312", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "9cc2356b-1b35-4a99-8315-4372e83853f9", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_7573816c-501c-47c3-99c7-5b2805575d2b", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "9cc2356b-1b35-4a99-8315-4372e83853f9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "55143373-85a2-4861-9732-84e56bfff312", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", + "type": "ordinal", + "domain": ["channel_0_sum", "channel_1_sum", "channel_2_sum"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 38.820101010101, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_7573816c-501c-47c3-99c7-5b2805575d2b" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "22a51972-f1b7-5aa7-a614-e211a5e52771" + } + }, + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2975824c-ebf2-4471-8fe4-780eb9c5e279", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "ddc968b4-3316-41fa-a489-180f819266a4", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "2975824c-ebf2-4471-8fe4-780eb9c5e279", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_66d4bf92-c97c-43b8-8fef-f4f77686fd55", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "2975824c-ebf2-4471-8fe4-780eb9c5e279", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "ddc968b4-3316-41fa-a489-180f819266a4", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", + "type": "ordinal", + "domain": ["channel_0_sum"], + "range": ["#ff0000"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 174.9655555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_66d4bf92-c97c-43b8-8fef-f4f77686fd55" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "dd335f6c-3ecc-5ca0-a044-e97216115b03" + } + } +] From c16e81bced6cf6c6b63be621d36f70ebf1dac57c Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 2 May 2025 23:21:36 +0200 Subject: [PATCH 47/56] add completed point configs --- src/spatialdata_plot/_viewconfig/axis.py | 2 +- src/spatialdata_plot/_viewconfig/data.py | 2 +- src/spatialdata_plot/_viewconfig/misc.py | 1 + ...ints_can_annotate_points_with_table_X.json | 231 ++++++++++ ...annotate_points_with_table_and_groups.json | 225 ++++++++++ ..._can_annotate_points_with_table_layer.json | 235 ++++++++++ ...ts_can_annotate_points_with_table_obs.json | 231 ++++++++++ ...can_filter_with_groups_custom_palette.json | 402 ++++++++++++++++++ ...an_filter_with_groups_default_palette.json | 402 ++++++++++++++++++ .../Points_can_render_points.json | 161 +++++++ .../Points_can_stack_render_points.json | 213 ++++++++++ .../Points_can_use_norm_with_clip.json | 221 ++++++++++ .../Points_can_use_norm_without_clip.json | 221 ++++++++++ ...olor_recognises_actual_color_as_color.json | 161 +++++++ .../Points_coloring_with_cmap.json | 202 +++++++++ .../Points_coloring_with_palette.json | 202 +++++++++ ...ints_datashader_can_color_by_category.json | 214 ++++++++++ ...oints_datashader_can_transform_points.json | 173 ++++++++ ...s_datashader_can_use_any_as_reduction.json | 233 ++++++++++ ...s_datashader_can_use_max_as_reduction.json | 233 ++++++++++ ..._datashader_can_use_mean_as_reduction.json | 233 ++++++++++ ...s_datashader_can_use_min_as_reduction.json | 233 ++++++++++ ...nts_datashader_can_use_norm_with_clip.json | 233 ++++++++++ ..._datashader_can_use_norm_without_clip.json | 233 ++++++++++ ...s_datashader_can_use_std_as_reduction.json | 233 ++++++++++ ...can_use_std_as_reduction_not_all_zero.json | 233 ++++++++++ ...s_datashader_can_use_sum_as_reduction.json | 233 ++++++++++ ...s_datashader_can_use_var_as_reduction.json | 233 ++++++++++ .../Points_datashader_continuous_color.json | 233 ++++++++++ .../Points_datashader_matplotlib_stack.json | 225 ++++++++++ ...atashader_norm_vmin_eq_vmax_with_clip.json | 233 ++++++++++ ...shader_norm_vmin_eq_vmax_without_clip.json | 233 ++++++++++ ...r_point_sizes_agree_after_altered_dpi.json | 225 ++++++++++ .../Points_points_categorical_color.json | 225 ++++++++++ ...s_categorical_color_column_datashader.json | 214 ++++++++++ ...s_categorical_color_column_matplotlib.json | 202 +++++++++ ...ts_points_coercable_categorical_color.json | 225 ++++++++++ ...ts_continuous_color_column_datashader.json | 233 ++++++++++ ...ts_continuous_color_column_matplotlib.json | 208 +++++++++ ...points_transformed_ds_agrees_with_mpl.json | 225 ++++++++++ 40 files changed, 8508 insertions(+), 2 deletions(-) create mode 100644 tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json create mode 100644 tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json create mode 100644 tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json create mode 100644 tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json create mode 100644 tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json create mode 100644 tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json create mode 100644 tests/_figures_viewconfig/Points_can_render_points.json create mode 100644 tests/_figures_viewconfig/Points_can_stack_render_points.json create mode 100644 tests/_figures_viewconfig/Points_can_use_norm_with_clip.json create mode 100644 tests/_figures_viewconfig/Points_can_use_norm_without_clip.json create mode 100644 tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json create mode 100644 tests/_figures_viewconfig/Points_coloring_with_cmap.json create mode 100644 tests/_figures_viewconfig/Points_coloring_with_palette.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_color_by_category.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_transform_points.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json create mode 100644 tests/_figures_viewconfig/Points_datashader_continuous_color.json create mode 100644 tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json create mode 100644 tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json create mode 100644 tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json create mode 100644 tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json create mode 100644 tests/_figures_viewconfig/Points_points_categorical_color.json create mode 100644 tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json create mode 100644 tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json create mode 100644 tests/_figures_viewconfig/Points_points_coercable_categorical_color.json create mode 100644 tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json create mode 100644 tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json create mode 100644 tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json diff --git a/src/spatialdata_plot/_viewconfig/axis.py b/src/spatialdata_plot/_viewconfig/axis.py index 5a135f35..f90a3941 100644 --- a/src/spatialdata_plot/_viewconfig/axis.py +++ b/src/spatialdata_plot/_viewconfig/axis.py @@ -58,7 +58,7 @@ def create_axis_block(ax: Axes, axis_scales_block: list[dict[str, Any]], dpi: fl tick_str_values = [ ticklabel.get_text() for ticklabel in axis_props["ticklabels"] - if vmin <= float(ticklabel.get_text()) <= vmax + if vmin <= float(ticklabel.get_text().replace("−", "-")) <= vmax ] axis_config["values"] = parse_numbers_with_exact_format(tick_str_values) diff --git a/src/spatialdata_plot/_viewconfig/data.py b/src/spatialdata_plot/_viewconfig/data.py index 275981a7..e0e645cd 100644 --- a/src/spatialdata_plot/_viewconfig/data.py +++ b/src/spatialdata_plot/_viewconfig/data.py @@ -47,7 +47,7 @@ def _add_datashade_transform( if last_transform["type"] == "formula": field = as_field = data_object["transform"][-1]["as"] - elif params.col_for_color: + else: field = as_field = params.col_for_color or "*" if field == "*": as_field = "count" diff --git a/src/spatialdata_plot/_viewconfig/misc.py b/src/spatialdata_plot/_viewconfig/misc.py index bca11e10..ac6ff222 100644 --- a/src/spatialdata_plot/_viewconfig/misc.py +++ b/src/spatialdata_plot/_viewconfig/misc.py @@ -47,6 +47,7 @@ def parse_numbers_with_exact_format(str_values: list[str]) -> list[float]: """ float_ls = [] for s in str_values: + s = s.replace("−", "-") if "." in s: float_ls.append(float(s)) else: diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json new file mode 100644 index 00000000..e1ef0ea5 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json @@ -0,0 +1,231 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "be39b901-24eb-469a-b339-928b63c9dc2a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "8e37e446-c2ef-48bb-af67-d815400f6f29", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "be39b901-24eb-469a-b339-928b63c9dc2a", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" + } + ] + }, + { + "name": "blobs_points_0ca1f7d3-34ff-4b36-a00e-b9957a5b205a", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "be39b901-24eb-469a-b339-928b63c9dc2a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "8e37e446-c2ef-48bb-af67-d815400f6f29", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["feature0"], + "as": ["feature0"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", + "type": "linear", + "domain": { + "data": "blobs_points_0ca1f7d3-34ff-4b36-a00e-b9957a5b205a", + "field": ["feature0"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_0ca1f7d3-34ff-4b36-a00e-b9957a5b205a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", + "value": "feature0" + }, + "fill": { + "scale": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", + "value": "feature0" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "5b3a3eab-d256-5a25-bc75-ca83f255117c" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json new file mode 100644 index 00000000..4eb4d159 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json @@ -0,0 +1,225 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a00b5c40-3b37-48fc-9b49-e3a02d11a76a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "4107814a-544f-4186-9616-cf3ef40a11fd", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "a00b5c40-3b37-48fc-9b49-e3a02d11a76a", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" + } + ] + }, + { + "name": "blobs_points_5ded845f-6951-46bd-be0b-f1921ce917c9", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "a00b5c40-3b37-48fc-9b49-e3a02d11a76a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "4107814a-544f-4186-9616-cf3ef40a11fd", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["extra_feature_cat"], + "as": ["extra_feature_cat"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", + "type": "ordinal", + "domain": ["two"], + "range": ["#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 253.59055555555548, + "legendY": 239.39555555555555 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_5ded845f-6951-46bd-be0b-f1921ce917c9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", + "field": "extra_feature_cat" + }, + "fill": { + "scale": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", + "field": "extra_feature_cat" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.extra_feature_cat)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "2c539bdf-7947-5742-9fa3-7efea6df4524" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json new file mode 100644 index 00000000..ee85b206 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json @@ -0,0 +1,235 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "edcb867d-2eb5-4945-95ae-10850ca6efca", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "9af66692-ce55-4fb3-a3ba-514c3a8c1f1a", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "edcb867d-2eb5-4945-95ae-10850ca6efca", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" + }, + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_points_456654bd-137e-4588-9dc5-c00f2b95e673", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "edcb867d-2eb5-4945-95ae-10850ca6efca", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "9af66692-ce55-4fb3-a3ba-514c3a8c1f1a", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["feature0"], + "as": ["feature0"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", + "type": "linear", + "domain": { + "data": "blobs_points_456654bd-137e-4588-9dc5-c00f2b95e673", + "field": ["feature0"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_456654bd-137e-4588-9dc5-c00f2b95e673" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", + "value": "feature0" + }, + "fill": { + "scale": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", + "value": "feature0" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "5c53e2fb-56ab-5bf5-9112-6f3f427e15a6" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json new file mode 100644 index 00000000..647bcd04 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json @@ -0,0 +1,231 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1ee8be21-3878-482d-a65c-63f7d05354e6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "955a1874-5c47-4c9d-8e83-20090a682260", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "1ee8be21-3878-482d-a65c-63f7d05354e6", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" + } + ] + }, + { + "name": "blobs_points_5bf4fe35-5fbf-4ed8-a9d3-a0205864d3b1", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "1ee8be21-3878-482d-a65c-63f7d05354e6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "955a1874-5c47-4c9d-8e83-20090a682260", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["extra_feature"], + "as": ["extra_feature"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", + "type": "linear", + "domain": { + "data": "blobs_points_5bf4fe35-5fbf-4ed8-a9d3-a0205864d3b1", + "field": ["extra_feature"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_5bf4fe35-5fbf-4ed8-a9d3-a0205864d3b1" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", + "value": "extra_feature" + }, + "fill": { + "scale": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", + "value": "extra_feature" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.extra_feature)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "99254edd-1775-56de-94ad-27bda952001b" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json b/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json new file mode 100644 index 00000000..72c21737 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json @@ -0,0 +1,402 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f7c98e12-e91a-47ad-ba47-9fbccb8c7541", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_3d3883e7-95e6-4bc7-8391-42302e0331cb", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "f7c98e12-e91a-47ad-ba47-9fbccb8c7541", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 64.75555555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_3d3883e7-95e6-4bc7-8391-42302e0331cb" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", + "field": "genes" + }, + "fill": { + "scale": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "ecb0286a-0f48-5226-9c23-bd1425f8dea7" + } + }, + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a9e0f64c-66fe-4d54-bc68-115c1235d54e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_3bef6fc7-14cc-45b7-b5b1-5860cf747f6a", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "a9e0f64c-66fe-4d54-bc68-115c1235d54e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", + "type": "ordinal", + "domain": ["gene_b"], + "range": ["#ff0000"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 239.25493055555555 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_3bef6fc7-14cc-45b7-b5b1-5860cf747f6a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", + "field": "genes" + }, + "fill": { + "scale": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "c98c320d-229b-5b77-87a3-0cdf8396a0ac" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json b/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json new file mode 100644 index 00000000..9ac4c56c --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json @@ -0,0 +1,402 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1f00c11b-4746-44e8-a411-96fd9edcff4f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_e8bd78b8-9f2a-4f8a-a996-7d3848cb5197", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "1f00c11b-4746-44e8-a411-96fd9edcff4f", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 64.75555555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_e8bd78b8-9f2a-4f8a-a996-7d3848cb5197" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", + "field": "genes" + }, + "fill": { + "scale": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "76de073a-f5b7-53aa-bd3a-baad40bc0bd8" + } + }, + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "4a500245-da71-4a64-bf7b-fc2473f3c84b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_0d6aa88e-245c-42f2-916b-18988c161e08", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "4a500245-da71-4a64-bf7b-fc2473f3c84b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_2428a622-3592-409e-811c-942e23d57a16", + "type": "ordinal", + "domain": ["gene_b"], + "range": ["#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_2428a622-3592-409e-811c-942e23d57a16", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 239.25493055555555 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_0d6aa88e-245c-42f2-916b-18988c161e08" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_2428a622-3592-409e-811c-942e23d57a16", + "field": "genes" + }, + "fill": { + "scale": "color_2428a622-3592-409e-811c-942e23d57a16", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "87f0752f-860a-5611-a0cf-80803dd0f5de" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_render_points.json b/tests/_figures_viewconfig/Points_can_render_points.json new file mode 100644 index 00000000..99e8947e --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_render_points.json @@ -0,0 +1,161 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "800e478c-fe58-4a19-9c73-8d4a794ea1aa", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_29bec1ca-a707-438c-a110-a7724821887a", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "800e478c-fe58-4a19-9c73-8d4a794ea1aa", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_29bec1ca-a707-438c-a110-a7724821887a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#d3d3d3" + }, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + } + } + } + ], + "usermeta": { + "axis_uuid": "e0d9ea92-0131-5f68-9a44-bb4d370f0f5c" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_stack_render_points.json b/tests/_figures_viewconfig/Points_can_stack_render_points.json new file mode 100644 index 00000000..48a34346 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_stack_render_points.json @@ -0,0 +1,213 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2988b30f-e534-4d36-bfef-7f4380e85dc1", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_d191a846-afca-4003-a386-1f0be215a11c", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "2988b30f-e534-4d36-bfef-7f4380e85dc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_points_0092eba3-a066-43be-8ebe-c7dd7dd19460", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "2988b30f-e534-4d36-bfef-7f4380e85dc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_d191a846-afca-4003-a386-1f0be215a11c" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ff0000" + }, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 30 + }, + "shape": { + "value": "circle" + } + } + } + }, + { + "type": "symbol", + "from": { + "data": "blobs_points_0092eba3-a066-43be-8ebe-c7dd7dd19460" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#0000ff" + }, + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + } + } + } + ], + "usermeta": { + "axis_uuid": "d31d154a-118b-5e6b-bab3-5bd254d8cc8a" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json b/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json new file mode 100644 index 00000000..c08a4827 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json @@ -0,0 +1,221 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c9f144c2-a482-49ca-bb25-005db55e4612", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_7e3f8310-dc2a-428a-b57c-f861e8d42213", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "c9f144c2-a482-49ca-bb25-005db55e4612", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "formula", + "expr": "clamp((datum.value - 3.0) / (7.0 - 3.0), 0, 1)", + "as": "92dab238-d55c-4601-8445-c43758de4ba9" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", + "type": "linear", + "domain": { + "data": "blobs_points_7e3f8310-dc2a-428a-b57c-f861e8d42213", + "field": "92dab238-d55c-4601-8445-c43758de4ba9" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_7e3f8310-dc2a-428a-b57c-f861e8d42213" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", + "value": "92dab238-d55c-4601-8445-c43758de4ba9" + }, + "fill": { + "scale": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", + "value": "92dab238-d55c-4601-8445-c43758de4ba9" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" + }, + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "bc41c6ab-c0a9-5d6a-a629-4edc12d8a1fb" + } + } +] diff --git a/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json b/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json new file mode 100644 index 00000000..ef47124f --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json @@ -0,0 +1,221 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "b991e0a5-bbfd-4561-8bcd-84eab170dd74", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_39d8691f-4b0c-4974-8e54-86d9be6f3217", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "b991e0a5-bbfd-4561-8bcd-84eab170dd74", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "formula", + "expr": "(datum.value - 3.0) / (7.0 - 3.0)", + "as": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", + "type": "linear", + "domain": { + "data": "blobs_points_39d8691f-4b0c-4974-8e54-86d9be6f3217", + "field": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_39d8691f-4b0c-4974-8e54-86d9be6f3217" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", + "value": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" + }, + "fill": { + "scale": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", + "value": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" + }, + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "a8d2103d-77f2-54cf-840e-dbd86e030b70" + } + } +] diff --git a/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json b/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json new file mode 100644 index 00000000..a0dad7bc --- /dev/null +++ b/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json @@ -0,0 +1,161 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2e33b710-1336-43e8-a894-76615b6d159b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_2c8944e0-d58c-4821-b226-7c1bf0391248", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "2e33b710-1336-43e8-a894-76615b6d159b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_2c8944e0-d58c-4821-b226-7c1bf0391248" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ff0000" + }, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + } + } + } + ], + "usermeta": { + "axis_uuid": "092a9afa-d843-5295-be01-487eecc277ed" + } + } +] diff --git a/tests/_figures_viewconfig/Points_coloring_with_cmap.json b/tests/_figures_viewconfig/Points_coloring_with_cmap.json new file mode 100644 index 00000000..e81458b8 --- /dev/null +++ b/tests/_figures_viewconfig/Points_coloring_with_cmap.json @@ -0,0 +1,202 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "bb48e2f0-f0e5-4a00-936d-717d4cfc34e0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_30e12d8e-0316-4b1d-be8a-deef59ecc26d", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "bb48e2f0-f0e5-4a00-936d-717d4cfc34e0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#8000ff", "#ff0000"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 217.95875 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_30e12d8e-0316-4b1d-be8a-deef59ecc26d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", + "field": "genes" + }, + "fill": { + "scale": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "e42c5ca4-6b5e-5541-abb2-1c2df673c824" + } + } +] diff --git a/tests/_figures_viewconfig/Points_coloring_with_palette.json b/tests/_figures_viewconfig/Points_coloring_with_palette.json new file mode 100644 index 00000000..0362f006 --- /dev/null +++ b/tests/_figures_viewconfig/Points_coloring_with_palette.json @@ -0,0 +1,202 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "13388e27-1782-4b87-8281-c0ddb14aae1b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_52fb5fc0-9afc-4a57-a869-c39571a5ffbc", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "13388e27-1782-4b87-8281-c0ddb14aae1b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_8b794912-322f-4224-b94a-d46d9cf07caa", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#90ee90", "#00008b"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_8b794912-322f-4224-b94a-d46d9cf07caa", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 217.95875 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_52fb5fc0-9afc-4a57-a869-c39571a5ffbc" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_8b794912-322f-4224-b94a-d46d9cf07caa", + "field": "genes" + }, + "fill": { + "scale": "color_8b794912-322f-4224-b94a-d46d9cf07caa", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "56c80743-91e0-53d6-b998-e32915e55eac" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json b/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json new file mode 100644 index 00000000..be28e53c --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json @@ -0,0 +1,214 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e960e36b-8d16-4105-b7be-fb3f6f948b39", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_db7b1313-a14c-4c36-a92b-67ea2fae974b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "e960e36b-8d16-4105-b7be-fb3f6f948b39", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["genes"], + "ops": ["count"], + "as": ["genes"] + }, + { + "type": "spread", + "field": ["genes"], + "px": 4, + "as": ["genes"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", + "type": "ordinal", + "domain": ["gene_b"], + "range": ["#90ee90"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_db7b1313-a14c-4c36-a92b-67ea2fae974b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", + "field": "genes" + }, + "fill": { + "scale": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 20 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "9e021ca3-a6a0-5755-90c1-d4c752f6ec7d" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_transform_points.json b/tests/_figures_viewconfig/Points_datashader_can_transform_points.json new file mode 100644 index 00000000..74b196f3 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_transform_points.json @@ -0,0 +1,173 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "470bfbb0-19c8-4386-9cca-62940b06c8ca", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_677ad7a8-dfd0-4522-9679-442a0dab40b6", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "470bfbb0-19c8-4386-9cca-62940b06c8ca", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + }, + { + "type": "spread", + "field": ["count"], + "px": 2, + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-775.2755253544179, 221.90573056245066], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-33.48962122763029, -840.7483983512892], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-600, -400, -200, 0, 200], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-800, -600, -400, -200], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_677ad7a8-dfd0-4522-9679-442a0dab40b6" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#000000" + }, + "fill": { + "value": "#000000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 5 + }, + "shape": { + "value": "circle" + } + } + } + } + ], + "usermeta": { + "axis_uuid": "38a61546-4c9f-5ba6-bb81-53bdab597e34" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json new file mode 100644 index 00000000..18acadf1 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e36f96f9-57ec-4cc2-95cc-f5cfebfb4ac0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_5f1df256-43e3-436b-949c-48b3af79677a", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "e36f96f9-57ec-4cc2-95cc-f5cfebfb4ac0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["any"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 1.0) / (2.0 - 1.0)", + "as": "fcfba37c-e0e6-48a7-9745-2d19a076b1d8" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", + "type": "linear", + "domain": { + "data": "blobs_points_5f1df256-43e3-436b-949c-48b3af79677a", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_5f1df256-43e3-436b-949c-48b3af79677a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", + "value": "instance_id" + }, + "fill": { + "scale": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 1.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 2.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "687645d2-ed9d-5f2d-a26d-1261069cad7a" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json new file mode 100644 index 00000000..d2aa5d50 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "581a9a51-b23b-4e3e-9661-bae3df8a8401", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_19dcb55a-628b-42a1-a780-3646bcf77ed0", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "581a9a51-b23b-4e3e-9661-bae3df8a8401", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", + "as": "574c3a0e-9fcf-42d3-8d3c-cde901f15962" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_e0adcb61-4468-4309-b011-19edb4b01312", + "type": "linear", + "domain": { + "data": "blobs_points_19dcb55a-628b-42a1-a780-3646bcf77ed0", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_e0adcb61-4468-4309-b011-19edb4b01312", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_19dcb55a-628b-42a1-a780-3646bcf77ed0" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_e0adcb61-4468-4309-b011-19edb4b01312", + "value": "instance_id" + }, + "fill": { + "scale": "color_e0adcb61-4468-4309-b011-19edb4b01312", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 9.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "c149e50d-ae74-5f87-86a3-84b651810298" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json new file mode 100644 index 00000000..33496927 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9b74f0ec-208d-497e-82ec-0c357cc54c20", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_c948e4b9-7a31-4893-bc51-ba6a2224ab40", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "9b74f0ec-208d-497e-82ec-0c357cc54c20", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["mean"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", + "as": "86222174-3e7a-4908-af4f-6ca944fbc7cf" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_53b2358d-76f1-49bc-b33b-472688998b4e", + "type": "linear", + "domain": { + "data": "blobs_points_c948e4b9-7a31-4893-bc51-ba6a2224ab40", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_53b2358d-76f1-49bc-b33b-472688998b4e", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_c948e4b9-7a31-4893-bc51-ba6a2224ab40" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_53b2358d-76f1-49bc-b33b-472688998b4e", + "value": "instance_id" + }, + "fill": { + "scale": "color_53b2358d-76f1-49bc-b33b-472688998b4e", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 9.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "f42c88af-1f73-563a-9aa0-4992496c7d3e" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json new file mode 100644 index 00000000..093b91a7 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "889cd38f-e8cc-4828-a0a4-8cc51115b0f7", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_dfa8f4e6-1a36-461d-81c2-dbb1b63461f1", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "889cd38f-e8cc-4828-a0a4-8cc51115b0f7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["min"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", + "as": "140f5670-c979-47ca-a3bf-e63e1a32943b" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", + "type": "linear", + "domain": { + "data": "blobs_points_dfa8f4e6-1a36-461d-81c2-dbb1b63461f1", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_dfa8f4e6-1a36-461d-81c2-dbb1b63461f1" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", + "value": "instance_id" + }, + "fill": { + "scale": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 9.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "9f71f68b-70aa-5651-b627-17f540348227" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json b/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json new file mode 100644 index 00000000..fa23e8dc --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "07967b1f-36b9-4707-bf27-ac9297461efa", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_2923e506-957b-4f46-9c71-eb769881481c", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "07967b1f-36b9-4707-bf27-ac9297461efa", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "clamp((datum.instance_id - 3.0) / (7.0 - 3.0), 0, 1)", + "as": "5318f013-808a-4d38-8c4c-81eea0177c17" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_6ca0b889-2c50-477d-bd15-51263c921740", + "type": "linear", + "domain": { + "data": "blobs_points_2923e506-957b-4f46-9c71-eb769881481c", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_6ca0b889-2c50-477d-bd15-51263c921740", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_2923e506-957b-4f46-9c71-eb769881481c" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_6ca0b889-2c50-477d-bd15-51263c921740", + "value": "instance_id" + }, + "fill": { + "scale": "color_6ca0b889-2c50-477d-bd15-51263c921740", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" + }, + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "219ad93c-19f2-5e11-8985-e263a6c1104b" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json b/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json new file mode 100644 index 00000000..ec0e92d5 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a8114eb6-540c-49e0-9f7a-b2a4cd8eec4a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_eb43c523-343b-49d9-9a22-dcfa8322cd3b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "a8114eb6-540c-49e0-9f7a-b2a4cd8eec4a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 3.0) / (7.0 - 3.0)", + "as": "00b44404-8c4d-44f9-b3af-e8823b97f6e4" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_2bc131ec-f456-486d-9c4c-d6731049b157", + "type": "linear", + "domain": { + "data": "blobs_points_eb43c523-343b-49d9-9a22-dcfa8322cd3b", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_2bc131ec-f456-486d-9c4c-d6731049b157", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_eb43c523-343b-49d9-9a22-dcfa8322cd3b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_2bc131ec-f456-486d-9c4c-d6731049b157", + "value": "instance_id" + }, + "fill": { + "scale": "color_2bc131ec-f456-486d-9c4c-d6731049b157", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" + }, + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "abc9ca0e-7d42-56fb-bf14-4cff0cfac071" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json new file mode 100644 index 00000000..096319b3 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fdf4bcf4-ade7-4c9e-90ae-4ca5a11c4eea", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_e3245574-274f-4e36-909f-94bb09851dbc", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "fdf4bcf4-ade7-4c9e-90ae-4ca5a11c4eea", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["stdev"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (1.0 - 0.0)", + "as": "cb2266b2-db15-409a-9888-9c054efc7f15" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", + "type": "linear", + "domain": { + "data": "blobs_points_e3245574-274f-4e36-909f-94bb09851dbc", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_e3245574-274f-4e36-909f-94bb09851dbc" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", + "value": "instance_id" + }, + "fill": { + "scale": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 1.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "6cea5bd5-3f67-50dc-8ead-a4fdf8149c2f" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json new file mode 100644 index 00000000..97b6fef8 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c12539db-53a2-43ff-8a06-1d3cc7055e0c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_df542ec0-fb65-4419-9a71-ce3f2f7cdcf8", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "c12539db-53a2-43ff-8a06-1d3cc7055e0c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["stdev"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (3.5 - 0.0)", + "as": "a69970fe-2058-41a2-9b91-730b92461a47" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", + "type": "linear", + "domain": { + "data": "blobs_points_df542ec0-fb65-4419-9a71-ce3f2f7cdcf8", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_df542ec0-fb65-4419-9a71-ce3f2f7cdcf8" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", + "value": "instance_id" + }, + "fill": { + "scale": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 3.5", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "fd2c678d-7d6e-5208-93c9-2be49387c1a9" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json new file mode 100644 index 00000000..78ed28ba --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "06591540-f5a3-474b-abc8-805ded9aebb5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_5f0edb3e-239b-4b89-b998-aa5ff3c2bf43", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "06591540-f5a3-474b-abc8-805ded9aebb5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["sum"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (23.0 - 0.0)", + "as": "cd5a7563-6768-4091-9fa9-945049362c84" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", + "type": "linear", + "domain": { + "data": "blobs_points_5f0edb3e-239b-4b89-b998-aa5ff3c2bf43", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0, 25.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_5f0edb3e-239b-4b89-b998-aa5ff3c2bf43" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", + "value": "instance_id" + }, + "fill": { + "scale": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 23.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "1292d576-8d89-5104-aff7-4a491c68cc79" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json new file mode 100644 index 00000000..d7bc1f94 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3924ef3f-5bad-4078-a20b-b83cc95e46e0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_37b90668-23fe-41da-8cb6-10e89182ea71", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "3924ef3f-5bad-4078-a20b-b83cc95e46e0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["variance"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (1.0 - 0.0)", + "as": "c88af9ef-d40a-4705-9db8-f44268c34b5a" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", + "type": "linear", + "domain": { + "data": "blobs_points_37b90668-23fe-41da-8cb6-10e89182ea71", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_37b90668-23fe-41da-8cb6-10e89182ea71" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", + "value": "instance_id" + }, + "fill": { + "scale": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 1.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "fc5e6ff7-e126-5c8e-8cd5-e21daf081820" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_continuous_color.json b/tests/_figures_viewconfig/Points_datashader_continuous_color.json new file mode 100644 index 00000000..6390dc7d --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_continuous_color.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e95022f5-d7da-4bce-9839-f14773a8ccd3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_7e8b8c3c-a81c-42c9-aa8d-270e63c58e25", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "e95022f5-d7da-4bce-9839-f14773a8ccd3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["sum"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (23.0 - 0.0)", + "as": "d908fd8c-3c3a-4937-a7db-6ec401c68228" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", + "type": "linear", + "domain": { + "data": "blobs_points_7e8b8c3c-a81c-42c9-aa8d-270e63c58e25", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0, 25.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_7e8b8c3c-a81c-42c9-aa8d-270e63c58e25" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", + "value": "instance_id" + }, + "fill": { + "scale": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", + "value": "instance_id" + }, + "fillOpacity": { + "value": 0.6 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 23.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "d0c328cd-5345-585f-9c5a-00ed4a7e241a" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json b/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json new file mode 100644 index 00000000..9f96e0cd --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json @@ -0,0 +1,225 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "aba23509-b6bd-48f4-abf3-a8ddceb4c7f0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_d7fb57eb-530c-4119-9838-b21d0eae50b1", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "aba23509-b6bd-48f4-abf3-a8ddceb4c7f0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + }, + { + "type": "spread", + "field": ["count"], + "px": 5, + "as": ["count"] + } + ] + }, + { + "name": "blobs_points_8f0a0af2-cd57-427e-bb90-e5e2456f9840", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "aba23509-b6bd-48f4-abf3-a8ddceb4c7f0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_d7fb57eb-530c-4119-9838-b21d0eae50b1" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ff0000" + }, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + } + } + }, + { + "type": "symbol", + "from": { + "data": "blobs_points_8f0a0af2-cd57-427e-bb90-e5e2456f9840" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#0000ff" + }, + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + } + } + } + ], + "usermeta": { + "axis_uuid": "ccd77351-c8fe-50a0-8b81-7fcdb1b0b9a9" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json new file mode 100644 index 00000000..c883544c --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "8c43cf0b-670b-4847-8eb5-5d5baf46bd5e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_8a2764bd-6e6e-418b-a980-8102fce2af6d", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "8c43cf0b-670b-4847-8eb5-5d5baf46bd5e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "clamp((datum.instance_id - 4.5) / (5.5 - 4.5), 0, 1)", + "as": "37038b90-124c-455a-8a0d-881ef89217c2" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_870841cb-9849-486a-9718-b7dc2b9a8696", + "type": "linear", + "domain": { + "data": "blobs_points_8a2764bd-6e6e-418b-a980-8102fce2af6d", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_870841cb-9849-486a-9718-b7dc2b9a8696", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_8a2764bd-6e6e-418b-a980-8102fce2af6d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_870841cb-9849-486a-9718-b7dc2b9a8696", + "value": "instance_id" + }, + "fill": { + "scale": "color_870841cb-9849-486a-9718-b7dc2b9a8696", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 4.5", + "value": "#000000" + }, + { + "test": "datum.instance_id) > 5.5", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "2da4b197-d884-5d88-9b7f-f0938e46d5fc" + } + } +] diff --git a/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json new file mode 100644 index 00000000..7c1cbd2a --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3805b8ab-5acb-4e9d-8832-13692baa5717", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_b8d9acdc-6fe9-4f4c-af19-939db0848fa0", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "3805b8ab-5acb-4e9d-8832-13692baa5717", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 4.5) / (5.5 - 4.5)", + "as": "379b6b6e-8a98-4a19-909c-5b279b1ad6ca" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", + "type": "linear", + "domain": { + "data": "blobs_points_b8d9acdc-6fe9-4f4c-af19-939db0848fa0", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_b8d9acdc-6fe9-4f4c-af19-939db0848fa0" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", + "value": "instance_id" + }, + "fill": { + "scale": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 4.5", + "value": "#000000" + }, + { + "test": "datum.instance_id) > 5.5", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "0bd97ed6-96c9-5b21-aaf5-61df80e48236" + } + } +] diff --git a/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json b/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json new file mode 100644 index 00000000..93a2a053 --- /dev/null +++ b/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json @@ -0,0 +1,225 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 800.0, + "width": 800.0, + "padding": { + "left": 144.0, + "top": 71.99999999999997, + "right": 32.00000000000003, + "bottom": 120.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 38.888888888888886, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fe73f6c8-17d5-473a-84c5-6c8327b3a63d", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_58755652-81c2-4b5a-8179-fa7918be1be9", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "fe73f6c8-17d5-473a-84c5-6c8327b3a63d", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_points_91042950-96b5-4636-942e-8775f1c9ca76", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "fe73f6c8-17d5-473a-84c5-6c8327b3a63d", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + }, + { + "type": "spread", + "field": ["count"], + "px": 40, + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 2.2222222222222223, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 2.7777777777777777, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 38.888888888888886, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 4.166666666666667, + "tickSize": 9.722222222222221, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 2.2222222222222223, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 2.7777777777777777, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 38.888888888888886, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 4.166666666666667, + "tickSize": 9.722222222222221, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_58755652-81c2-4b5a-8179-fa7918be1be9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#0000ff" + }, + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 400 + }, + "shape": { + "value": "circle" + } + } + } + }, + { + "type": "symbol", + "from": { + "data": "blobs_points_91042950-96b5-4636-942e-8775f1c9ca76" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ffff00" + }, + "fill": { + "value": "#ffff00" + }, + "fillOpacity": { + "value": 0.8 + }, + "size": { + "value": 400 + }, + "shape": { + "value": "circle" + } + } + } + } + ], + "usermeta": { + "axis_uuid": "43a1ea63-34d1-5be9-973f-a7e1f6ffbb87" + } + } +] diff --git a/tests/_figures_viewconfig/Points_points_categorical_color.json b/tests/_figures_viewconfig/Points_points_categorical_color.json new file mode 100644 index 00000000..7638f681 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_categorical_color.json @@ -0,0 +1,225 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "76d1df00-edd3-46c8-9035-01a7670977d5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "2c9ee04c-603f-4ed8-b8a1-a30bf739968c", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "76d1df00-edd3-46c8-9035-01a7670977d5", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" + } + ] + }, + { + "name": "blobs_points_239dff7b-58c0-4ae2-b12b-a819153d99fc", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "76d1df00-edd3-46c8-9035-01a7670977d5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "2c9ee04c-603f-4ed8-b8a1-a30bf739968c", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 197.08444444444444 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_239dff7b-58c0-4ae2-b12b-a819153d99fc" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", + "field": "category" + }, + "fill": { + "scale": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "b277432b-3009-5416-9d63-189fcb81800b" + } + } +] diff --git a/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json b/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json new file mode 100644 index 00000000..51045a53 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json @@ -0,0 +1,214 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9fe7d2fe-1bba-461d-bcf8-f9ba438019fd", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_2ddb998f-e6e5-4809-b6b9-6dbe30556cbb", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "9fe7d2fe-1bba-461d-bcf8-f9ba438019fd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["genes"], + "ops": ["count"], + "as": ["genes"] + }, + { + "type": "spread", + "field": ["genes"], + "px": 1, + "as": ["genes"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_2ddb998f-e6e5-4809-b6b9-6dbe30556cbb" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", + "field": "genes" + }, + "fill": { + "scale": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "96ba6439-6a3a-51ba-a922-976f6f3f3c4a" + } + } +] diff --git a/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json b/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json new file mode 100644 index 00000000..391c01b6 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json @@ -0,0 +1,202 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3bdb2a3f-2e0b-4765-b173-22ae708330e3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_bb5e6626-0600-40e2-987f-f78a1520fb50", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "3bdb2a3f-2e0b-4765-b173-22ae708330e3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 217.95875 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_bb5e6626-0600-40e2-987f-f78a1520fb50" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", + "field": "genes" + }, + "fill": { + "scale": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "9b84b104-c451-573c-97c0-d851f9cf1250" + } + } +] diff --git a/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json b/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json new file mode 100644 index 00000000..4a921688 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json @@ -0,0 +1,225 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e1552ed7-ed9a-49f7-bbb6-846bde9e0bc1", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "8e439704-35af-40bc-942e-a10979271074", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "e1552ed7-ed9a-49f7-bbb6-846bde9e0bc1", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" + } + ] + }, + { + "name": "blobs_points_600ab3ba-a578-411e-ac75-109eecf3882d", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "e1552ed7-ed9a-49f7-bbb6-846bde9e0bc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "8e439704-35af-40bc-942e-a10979271074", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 197.08444444444444 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_600ab3ba-a578-411e-ac75-109eecf3882d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", + "field": "category" + }, + "fill": { + "scale": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "a2b14124-7ccb-55cc-a9f8-531a8cefaf74" + } + } +] diff --git a/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json b/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json new file mode 100644 index 00000000..310eb18b --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "882207e6-e04a-47d1-9bf6-68a1c6e59817", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_75d73c23-3eea-4a4f-87cb-a35740cfe77e", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "882207e6-e04a-47d1-9bf6-68a1c6e59817", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["sum"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (14.0 - 0.0)", + "as": "adafac37-bc91-4982-8f59-5e7e1df18c02" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 1, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", + "type": "linear", + "domain": { + "data": "blobs_points_75d73c23-3eea-4a4f-87cb-a35740cfe77e", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_75d73c23-3eea-4a4f-87cb-a35740cfe77e" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", + "value": "instance_id" + }, + "fill": { + "scale": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 14.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "2f5d2cc1-0d47-5802-8fe5-7495f8ec1c22" + } + } +] diff --git a/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json b/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json new file mode 100644 index 00000000..13c8a32f --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json @@ -0,0 +1,208 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "8e280044-564f-4375-840f-9848716f7b85", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_c5148b36-51c9-42c4-bfde-56eea4c4172e", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "8e280044-564f-4375-840f-9848716f7b85", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_c398a8bd-be9a-4337-8599-01bdda452f63", + "type": "linear", + "domain": { + "data": "blobs_points_c5148b36-51c9-42c4-bfde-56eea4c4172e", + "field": "instance_id" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c398a8bd-be9a-4337-8599-01bdda452f63", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_c5148b36-51c9-42c4-bfde-56eea4c4172e" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_c398a8bd-be9a-4337-8599-01bdda452f63", + "value": "instance_id" + }, + "fill": { + "scale": "color_c398a8bd-be9a-4337-8599-01bdda452f63", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "9ef92755-d335-544c-8deb-63c63776e574" + } + } +] diff --git a/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json b/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json new file mode 100644 index 00000000..d4700daa --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json @@ -0,0 +1,225 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1726166b-d3f2-4d72-99da-5002a67ff362", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "points1_a3aaddcc-5548-4b3b-aab8-85bd9fc8655c", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "1726166b-d3f2-4d72-99da-5002a67ff362", + "transform": [ + { + "type": "filter_element", + "expr": "points1" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "points1_5135bd5c-be45-475d-acdb-ba94c1d91548", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "1726166b-d3f2-4d72-99da-5002a67ff362", + "transform": [ + { + "type": "filter_element", + "expr": "points1" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + }, + { + "type": "spread", + "field": ["count"], + "px": 3, + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 20.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [20.0, 0.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 5, 10, 15, 20], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 5, 10, 15, 20], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "points1_a3aaddcc-5548-4b3b-aab8-85bd9fc8655c" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#d3d3d3" + }, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 50 + }, + "shape": { + "value": "circle" + } + } + } + }, + { + "type": "symbol", + "from": { + "data": "points1_5135bd5c-be45-475d-acdb-ba94c1d91548" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ff0000" + }, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + } + } + } + ], + "usermeta": { + "axis_uuid": "ec28cecf-b4ae-5607-b2e6-16c709515234" + } + } +] From 502750466f6f15325a7bef7475e68b5f155762aa Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 2 May 2025 23:25:20 +0200 Subject: [PATCH 48/56] add missing point config --- ...datashader_can_use_count_as_reduction.json | 233 ++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json new file mode 100644 index 00000000..4c4eb426 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json @@ -0,0 +1,233 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "63e0d1c4-ee8a-48bd-a201-58b57be9ee3d", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_points_174854c6-5322-48cd-8218-be7f8636f3c9", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "63e0d1c4-ee8a-48bd-a201-58b57be9ee3d", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["count"], + "as": ["instance_id"] + }, + { + "type": "formula", + "expr": "(datum.instance_id - 0) / (4 - 0)", + "as": "03131f92-2148-43d8-aa35-082dca416e1c" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", + "type": "linear", + "domain": { + "data": "blobs_points_174854c6-5322-48cd-8218-be7f8636f3c9", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 1.0, 2.0, 3.0, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_174854c6-5322-48cd-8218-be7f8636f3c9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", + "value": "instance_id" + }, + "fill": { + "scale": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + }, + { + "test": "datum.instance_id) < 0", + "value": "#440154" + }, + { + "test": "datum.instance_id) > 4", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "4cf9436a-d0fa-5616-9a0c-d199405948ac" + } + } +] From 07428acbea457a16e0809d1c72a852e9977d3c0a Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Sun, 4 May 2025 17:51:01 +0200 Subject: [PATCH 49/56] todos and shapes configs --- src/spatialdata_plot/pl/render.py | 3 + ..._can_annotate_shapes_with_table_layer.json | 227 ++++++++++ .../Shapes_can_color_from_geodataframe.json | 200 +++++++++ ...queried_shapes_elements_by_annotation.json | 323 +++++++++++++++ ...lor_two_shapes_elements_by_annotation.json | 323 +++++++++++++++ ...hapes_can_color_with_norm_no_clipping.json | 213 ++++++++++ .../Shapes_can_do_non_matching_table.json | 223 ++++++++++ .../Shapes_can_filter_with_groups.json | 386 ++++++++++++++++++ ...h_annotation_despite_random_shuffling.json | 217 ++++++++++ ...s_can_plot_shapes_after_spatial_query.json | 244 +++++++++++ ...h_annotation_despite_random_shuffling.json | 217 ++++++++++ .../Shapes_can_render_circles.json | 154 +++++++ ...n_render_circles_with_colored_outline.json | 163 ++++++++ ...hapes_can_render_circles_with_outline.json | 163 ++++++++ ..._circles_with_specified_outline_width.json | 163 ++++++++ .../Shapes_can_render_empty_geometry.json | 244 +++++++++++ .../Shapes_can_render_multipolygons.json | 223 ++++++++++ .../Shapes_can_render_polygons.json | 154 +++++++ ...apes_can_render_polygons_with_outline.json | 163 ++++++++ ...der_polygons_with_rgb_colored_outline.json | 163 ++++++++ ...er_polygons_with_rgba_colored_outline.json | 163 ++++++++ ...der_polygons_with_str_colored_outline.json | 163 ++++++++ .../Shapes_can_scale_shapes.json | 154 +++++++ .../Shapes_can_set_clims_clip.json | 236 +++++++++++ .../Shapes_can_stack_render_shapes.json | 199 +++++++++ ...olor_recognises_actual_color_as_color.json | 154 +++++++ .../Shapes_colorbar_can_be_normalised.json | 213 ++++++++++ ...Shapes_colorbar_respects_input_limits.json | 200 +++++++++ .../Shapes_coloring_with_palette.json | 194 +++++++++ ...apes_datashader_can_color_by_category.json | 223 ++++++++++ ...tashader_can_color_by_identical_value.json | 219 ++++++++++ .../Shapes_datashader_can_color_by_value.json | 219 ++++++++++ ...ader_can_color_with_norm_and_clipping.json | 219 ++++++++++ ...hader_can_color_with_norm_no_clipping.json | 219 ++++++++++ ..._datashader_can_render_colored_shapes.json | 262 ++++++++++++ .../Shapes_datashader_can_render_shapes.json | 262 ++++++++++++ ...hader_can_render_with_colored_outline.json | 169 ++++++++ ...er_can_render_with_diff_alpha_outline.json | 169 ++++++++ ...er_can_render_with_diff_width_outline.json | 169 ++++++++ ...hader_can_render_with_different_alpha.json | 262 ++++++++++++ ...es_datashader_can_render_with_outline.json | 169 ++++++++ ...r_can_render_with_rgb_colored_outline.json | 169 ++++++++ ..._can_render_with_rgba_colored_outline.json | 169 ++++++++ ...apes_datashader_can_transform_circles.json | 169 ++++++++ ...atashader_can_transform_multipolygons.json | 169 ++++++++ ...pes_datashader_can_transform_polygons.json | 169 ++++++++ ...atashader_norm_vmin_eq_vmax_with_clip.json | 223 ++++++++++ ...shader_norm_vmin_eq_vmax_without_clip.json | 223 ++++++++++ ...es_datashader_shades_with_linear_cmap.json | 219 ++++++++++ .../Shapes_shapes_categorical_color.json | 217 ++++++++++ ...es_shapes_coercable_categorical_color.json | 217 ++++++++++ tests/pl/test_render_shapes.py | 2 + 52 files changed, 10349 insertions(+) create mode 100644 tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json create mode 100644 tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json create mode 100644 tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json create mode 100644 tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json create mode 100644 tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json create mode 100644 tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json create mode 100644 tests/_figures_viewconfig/Shapes_can_filter_with_groups.json create mode 100644 tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json create mode 100644 tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json create mode 100644 tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_circles.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_multipolygons.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_polygons.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_can_scale_shapes.json create mode 100644 tests/_figures_viewconfig/Shapes_can_set_clims_clip.json create mode 100644 tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json create mode 100644 tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json create mode 100644 tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json create mode 100644 tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json create mode 100644 tests/_figures_viewconfig/Shapes_coloring_with_palette.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json create mode 100644 tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json create mode 100644 tests/_figures_viewconfig/Shapes_shapes_categorical_color.json create mode 100644 tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 684e00ef..f1eae034 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -121,6 +121,9 @@ def _render_shapes( table_layer=table_layer, ) + if color_mapping: + sdata.plotting_tree[f"{render_count}_render_shapes"].colortype = color_mapping + values_are_categorical = color_source_vector is not None # color_source_vector is None when the values aren't categorical diff --git a/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json b/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json new file mode 100644 index 00000000..27f36f04 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json @@ -0,0 +1,227 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "64e6de4c-0932-40bf-9d1c-1a2c6e98f849", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "5bc16ac0-aa5b-4e59-a7bb-1537955277cb", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "64e6de4c-0932-40bf-9d1c-1a2c6e98f849", + "transform": [ + { + "type": "filter_element", + "expr": "circle_table" + }, + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_circles_38e2c2a8-4313-436b-bb2c-552c6d436637", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "64e6de4c-0932-40bf-9d1c-1a2c6e98f849", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "5bc16ac0-aa5b-4e59-a7bb-1537955277cb", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["feature0"], + "as": ["feature0"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_1e9988a3-db33-4210-9f58-f16cb35e4dcd", + "type": "linear", + "domain": { + "data": "blobs_circles_38e2c2a8-4313-436b-bb2c-552c6d436637", + "field": ["feature0"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_1e9988a3-db33-4210-9f58-f16cb35e4dcd", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_38e2c2a8-4313-436b-bb2c-552c6d436637" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_1e9988a3-db33-4210-9f58-f16cb35e4dcd", + "value": "feature0" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "a3813fed-be51-538f-83dd-06a512830bc3" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json b/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json new file mode 100644 index 00000000..36bbfa9e --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json @@ -0,0 +1,200 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "591c3ffd-494f-4ea3-acfd-f38660ede142", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_7d720f83-4fe2-45e6-a7b5-2d1d7e185a25", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "591c3ffd-494f-4ea3-acfd-f38660ede142", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_e565b379-e9cb-4460-978e-0caef33fb0ec", + "type": "linear", + "domain": { + "data": "blobs_polygons_7d720f83-4fe2-45e6-a7b5-2d1d7e185a25", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_e565b379-e9cb-4460-978e-0caef33fb0ec", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_7d720f83-4fe2-45e6-a7b5-2d1d7e185a25" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_e565b379-e9cb-4460-978e-0caef33fb0ec", + "value": "value" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "805fba9f-d0ad-55ca-b00a-7abaee39455a" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json b/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json new file mode 100644 index 00000000..96c82233 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json @@ -0,0 +1,323 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "59b535a5-8e62-4580-8093-16b150eea0de", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_circles_82866839-6674-4690-a31e-9e634d196ead", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "59b535a5-8e62-4580-8093-16b150eea0de", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + }, + { + "name": "97557ea4-57dd-484c-8b88-e2ba1b8fec7e", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_35e112d2-38d6-4ca3-9197-6743d961e925", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "97557ea4-57dd-484c-8b88-e2ba1b8fec7e", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 342.0621919542923], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [281.69401339357205, 137.62348968860152], + "range": "height" + }, + { + "name": "color_5dc90b1b-cb98-486f-bcbb-b2a533998a36", + "type": "ordinal", + "domain": ["a", "c", "d"], + "range": ["#1f77b4", "#279e68", "#d62728"] + }, + { + "name": "color_31c17caa-10b5-4221-ba4e-5d88017dc127", + "type": "ordinal", + "domain": ["v", "x", "y"], + "range": ["#8c564b", "#b5bd61", "#17becf"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 150, 200, 250, 300], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 175, 200, 225, 250, 275], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_5dc90b1b-cb98-486f-bcbb-b2a533998a36", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.95555555555558 + }, + { + "type": "discrete", + "direction": "vertical", + "fill": "color_31c17caa-10b5-4221-ba4e-5d88017dc127", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_82866839-6674-4690-a31e-9e634d196ead" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_5dc90b1b-cb98-486f-bcbb-b2a533998a36", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_35e112d2-38d6-4ca3-9197-6743d961e925" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_31c17caa-10b5-4221-ba4e-5d88017dc127", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "e9fc6a54-acac-5dd0-b91d-f99aaf858a94" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json b/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json new file mode 100644 index 00000000..a571261f --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json @@ -0,0 +1,323 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "cf52abb3-f6ef-45ee-ae46-6dd3bffa50a1", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_circles_30877445-9767-47e3-9b6c-af54f2ce56df", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "cf52abb3-f6ef-45ee-ae46-6dd3bffa50a1", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + }, + { + "name": "57457ccb-a2b1-4413-9a24-c84c4c9075e5", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_a46e1ec7-77ea-465e-bf00-898e90df608d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "57457ccb-a2b1-4413-9a24-c84c4c9075e5", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + }, + { + "name": "color_5fd8851a-efc5-47c9-992d-30e7ff5f940a", + "type": "ordinal", + "domain": ["a", "b", "c", "d", "e"], + "range": ["#1f77b4", "#ff7f0e", "#279e68", "#d62728", "#aa40fc"] + }, + { + "name": "color_0374d4e6-cb3b-4ff0-8695-39af6558d2b9", + "type": "ordinal", + "domain": ["v", "w", "x", "y", "z"], + "range": ["#8c564b", "#e377c2", "#b5bd61", "#17becf", "#aec7e8"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_5fd8851a-efc5-47c9-992d-30e7ff5f940a", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 265.4655555555555, + "legendY": 35.95555555555558 + }, + { + "type": "discrete", + "direction": "vertical", + "fill": "color_0374d4e6-cb3b-4ff0-8695-39af6558d2b9", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 265.4655555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_30877445-9767-47e3-9b6c-af54f2ce56df" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_5fd8851a-efc5-47c9-992d-30e7ff5f940a", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_a46e1ec7-77ea-465e-bf00-898e90df608d" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_0374d4e6-cb3b-4ff0-8695-39af6558d2b9", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "67d9a1b4-f46c-549a-968a-a356534a99c4" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json b/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json new file mode 100644 index 00000000..ff796d5c --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json @@ -0,0 +1,213 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fdc9e739-d725-4bb7-8a8b-6bfb36e90090", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_b0b960ee-9fb6-4214-81d5-c36a06ecfa06", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "fdc9e739-d725-4bb7-8a8b-6bfb36e90090", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "formula", + "expr": "(datum.value - 2.0) / (4.0 - 2.0)", + "as": "7ad8430a-6e1a-4bc8-87e8-50b6d3b0bc8f" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_00540be8-3804-4816-ab6e-ab1987ae9f96", + "type": "linear", + "domain": { + "data": "blobs_polygons_b0b960ee-9fb6-4214-81d5-c36a06ecfa06", + "field": "7ad8430a-6e1a-4bc8-87e8-50b6d3b0bc8f" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_00540be8-3804-4816-ab6e-ab1987ae9f96", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [2.0, 2.5, 3.0, 3.5, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_b0b960ee-9fb6-4214-81d5-c36a06ecfa06" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_00540be8-3804-4816-ab6e-ab1987ae9f96", + "value": "7ad8430a-6e1a-4bc8-87e8-50b6d3b0bc8f" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.0", + "value": "#000000" + }, + { + "test": "datum.value) > 4.0", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "dbedcdce-a0b3-548e-a168-a371ada06535" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json b/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json new file mode 100644 index 00000000..ebd7da2c --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json @@ -0,0 +1,223 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "290054c4-54ff-482b-b30e-cc8dc4ffcfac", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "6ae783b7-6802-4f4d-bfea-9813d1399bf5", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "290054c4-54ff-482b-b30e-cc8dc4ffcfac", + "transform": [ + { + "type": "filter_element", + "expr": "new_table" + } + ] + }, + { + "name": "blobs_circles_9d96233c-29c2-4e5c-ae9f-5f3a766310da", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "290054c4-54ff-482b-b30e-cc8dc4ffcfac", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "6ae783b7-6802-4f4d-bfea-9813d1399bf5", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["instance_id"], + "as": ["instance_id"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_f1abb57c-2d57-440d-b5c2-c524717cd27b", + "type": "linear", + "domain": { + "data": "blobs_circles_9d96233c-29c2-4e5c-ae9f-5f3a766310da", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f1abb57c-2d57-440d-b5c2-c524717cd27b", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.5, 1.0, 1.5, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_9d96233c-29c2-4e5c-ae9f-5f3a766310da" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_f1abb57c-2d57-440d-b5c2-c524717cd27b", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "f452cde1-5802-5377-90f6-bdc661f7d26d" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json b/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json new file mode 100644 index 00000000..c1235dce --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json @@ -0,0 +1,386 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1d0d7f10-6461-445e-ab6c-2107803df834", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_f52052f0-cd48-4a12-8a30-4e3236e02437", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "1d0d7f10-6461-445e-ab6c-2107803df834", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_f78d5830-3306-41e7-bd3c-2453e91fda69", + "type": "ordinal", + "domain": ["c1", "c2"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_f78d5830-3306-41e7-bd3c-2453e91fda69", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 124.570101010101, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_f52052f0-cd48-4a12-8a30-4e3236e02437" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_f78d5830-3306-41e7-bd3c-2453e91fda69", + "field": "cluster" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "0f35db70-f56e-5b2e-a4fe-ae54aebf0843" + } + }, + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d8f26641-4f98-4242-b6ca-13c06caf2a59", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_10e30c77-7940-4f72-b58d-4ac776605c70", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "d8f26641-4f98-4242-b6ca-13c06caf2a59", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_d2fdfda6-37b0-447a-9a8a-83a344a5d56c", + "type": "ordinal", + "domain": ["c1"], + "range": ["#1f77b4"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_d2fdfda6-37b0-447a-9a8a-83a344a5d56c", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 260.7155555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_10e30c77-7940-4f72-b58d-4ac776605c70" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_d2fdfda6-37b0-447a-9a8a-83a344a5d56c", + "field": "cluster" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "1ab64093-d7dc-5249-ac86-63281b62455a" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json b/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json new file mode 100644 index 00000000..ad85d904 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json @@ -0,0 +1,217 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f99b4087-de4e-494e-9e8e-0e9bef02a71b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "9d227767-95c8-4380-a736-e9dba8590053", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "f99b4087-de4e-494e-9e8e-0e9bef02a71b", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_circles_0296f164-f43f-4e9c-be20-4c794ffad328", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f99b4087-de4e-494e-9e8e-0e9bef02a71b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "9d227767-95c8-4380-a736-e9dba8590053", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 342.0621919542923], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [255.41373271401557, 137.62348968860152], + "range": "height" + }, + { + "name": "color_f93e5a7f-0258-4db4-9a3a-3a2258daf35e", + "type": "ordinal", + "domain": ["a", "c", "d"], + "range": ["#1f77b4", "#279e68", "#d62728"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 150, 200, 250, 300], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [140, 160, 180, 200, 220, 240], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_f93e5a7f-0258-4db4-9a3a-3a2258daf35e", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_0296f164-f43f-4e9c-be20-4c794ffad328" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_f93e5a7f-0258-4db4-9a3a-3a2258daf35e", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "ac76fdef-61c7-5887-9715-552cfa435b5a" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json b/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json new file mode 100644 index 00000000..08972deb --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json @@ -0,0 +1,244 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_8b65a870-2dce-4b7e-ad2c-d920e78dfd61", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_4aacc8a0-1638-4f61-aded-73b9edb526f0", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_76ccf0b8-ea7b-49a6-9ff3-0374a3d64689", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 389.33194389674156], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [319.36204268927, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_8b65a870-2dce-4b7e-ad2c-d920e78dfd61" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_4aacc8a0-1638-4f61-aded-73b9edb526f0" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_76ccf0b8-ea7b-49a6-9ff3-0374a3d64689" + }, + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "c1c63ddd-2cdb-5369-bed1-93c94497960d" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json b/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json new file mode 100644 index 00000000..af6c00ff --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json @@ -0,0 +1,217 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "b8895a18-f11d-405f-8e68-117c6198543b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "635b7492-b0bb-4e58-b9a3-ebe8432deaa6", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "b8895a18-f11d-405f-8e68-117c6198543b", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_circles_86a0cb7a-b9c9-4d98-8eee-70f59114f653", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "b8895a18-f11d-405f-8e68-117c6198543b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "635b7492-b0bb-4e58-b9a3-ebe8432deaa6", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_f2371eeb-084d-4473-adc7-39564f0335e8", + "type": "ordinal", + "domain": ["a", "b", "c", "d", "e"], + "range": ["#1f77b4", "#ff7f0e", "#279e68", "#d62728", "#aa40fc"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_f2371eeb-084d-4473-adc7-39564f0335e8", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_86a0cb7a-b9c9-4d98-8eee-70f59114f653" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_f2371eeb-084d-4473-adc7-39564f0335e8", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "69501ca0-64e0-550e-af86-570cdd5c0e85" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles.json b/tests/_figures_viewconfig/Shapes_can_render_circles.json new file mode 100644 index 00000000..fb0c70c9 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles.json @@ -0,0 +1,154 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1e2c12ff-e82f-41a5-b134-90d96e305ae5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_34e75260-06d3-44ab-816c-71493bff2d50", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "1e2c12ff-e82f-41a5-b134-90d96e305ae5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_34e75260-06d3-44ab-816c-71493bff2d50" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "c0d9a0dd-55ac-5523-bb7c-ef156eb58089" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json new file mode 100644 index 00000000..807d7d98 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "27be6871-7160-418b-865f-dbbb92311e21", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_6adead9b-e64a-47c7-8f4b-9e007681b270", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "27be6871-7160-418b-865f-dbbb92311e21", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_6adead9b-e64a-47c7-8f4b-9e007681b270" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#ff0000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "9410d435-d084-5315-a60b-d28b962e0633" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json b/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json new file mode 100644 index 00000000..edd269b7 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a5b53667-3a01-4efc-a46a-be07ec8e09b9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_9dd00b7c-6f92-4147-aed4-7dffa24327d2", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "a5b53667-3a01-4efc-a46a-be07ec8e09b9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_9dd00b7c-6f92-4147-aed4-7dffa24327d2" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "b2c4c534-07b7-52ad-88b9-b3790b721a4d" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json b/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json new file mode 100644 index 00000000..cbe335b5 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "4a6fd48c-74a8-4b8f-a331-3169a7efc16f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_27372d34-f2cd-4d2b-8244-f5169027166f", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "4a6fd48c-74a8-4b8f-a331-3169a7efc16f", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_27372d34-f2cd-4d2b-8244-f5169027166f" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 3.0 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "1cdc0b18-b0e5-5d62-9e10-185036328b0b" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json b/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json new file mode 100644 index 00000000..b98a1612 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json @@ -0,0 +1,244 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "8be5fec3-9041-4dcb-a151-36eee5b59329", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_4db9df4c-afe2-4ec3-adc7-ba23029695bf", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "8be5fec3-9041-4dcb-a151-36eee5b59329", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_c7b061fa-deec-4f7d-bc41-fa2774f43445", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "8be5fec3-9041-4dcb-a151-36eee5b59329", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_06a1b477-0139-4eaf-9c56-7c63310ae38d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "8be5fec3-9041-4dcb-a151-36eee5b59329", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_4db9df4c-afe2-4ec3-adc7-ba23029695bf" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_c7b061fa-deec-4f7d-bc41-fa2774f43445" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_06a1b477-0139-4eaf-9c56-7c63310ae38d" + }, + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "8fe7bd47-b5f7-5bc9-915e-4df6ad03b3ec" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json b/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json new file mode 100644 index 00000000..2d1c4bbc --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json @@ -0,0 +1,223 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cc2f0451-ee50-4d68-9bdf-c711b64e16cf", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "eed76153-df16-491b-bfbf-de61eebd25f9", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "cc2f0451-ee50-4d68-9bdf-c711b64e16cf", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "p_88b7854d-7bb4-4c9b-9d72-132554cd3765", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "cc2f0451-ee50-4d68-9bdf-c711b64e16cf", + "transform": [ + { + "type": "filter_element", + "expr": "p" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "eed76153-df16-491b-bfbf-de61eebd25f9", + "key": "val", + "fields": ["instance_ids"], + "values": ["val"], + "as": ["val"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 6.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [1.0, 0.0], + "range": "height" + }, + { + "name": "color_640d8695-1303-43fe-844a-35acb08513a5", + "type": "linear", + "domain": { + "data": "p_88b7854d-7bb4-4c9b-9d72-132554cd3765", + "field": ["val"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 2, 4, 6], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_640d8695-1303-43fe-844a-35acb08513a5", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "p_88b7854d-7bb4-4c9b-9d72-132554cd3765" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_640d8695-1303-43fe-844a-35acb08513a5", + "value": "val" + }, + "fillOpacity": { + "value": 0.3 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.val)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "95ef9fa5-0963-527b-b705-bafa68e6d8e9" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons.json b/tests/_figures_viewconfig/Shapes_can_render_polygons.json new file mode 100644 index 00000000..d9ea1cda --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons.json @@ -0,0 +1,154 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "582320bd-bb01-4d2a-9295-4e6935164963", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_7ea96831-b6ae-4114-8227-d30df9363d6a", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "582320bd-bb01-4d2a-9295-4e6935164963", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_7ea96831-b6ae-4114-8227-d30df9363d6a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "70175a6c-f1a9-528f-b779-3d58fa786939" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json new file mode 100644 index 00000000..6e1f5fcf --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "431396c7-6a65-421e-93fe-829b9a296176", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_abb7a36b-0076-4762-96ab-e965d9bf9fd0", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "431396c7-6a65-421e-93fe-829b9a296176", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_abb7a36b-0076-4762-96ab-e965d9bf9fd0" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "ff5a6897-2997-5f11-86dd-7ab5af324065" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json new file mode 100644 index 00000000..165c08a1 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "49db8c4f-d285-47cc-965b-3ed46f8de32d", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_76373f25-e023-4fc7-905a-7e3df1c5e7f8", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "49db8c4f-d285-47cc-965b-3ed46f8de32d", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_76373f25-e023-4fc7-905a-7e3df1c5e7f8" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#0000ff" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "c9ea0f63-15b7-5e8a-8dca-1acadf21482e" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json new file mode 100644 index 00000000..6eedad53 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "92834385-85c3-4dc3-85c8-87c377c019d5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_0a3d48d9-adaf-4e1e-aaf0-daa174a170bd", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "92834385-85c3-4dc3-85c8-87c377c019d5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_0a3d48d9-adaf-4e1e-aaf0-daa174a170bd" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#00ff00" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "583b7282-bf50-5748-ad32-b24bad278544" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json new file mode 100644 index 00000000..9b2159d4 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json @@ -0,0 +1,163 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "05f78781-8b35-4f0f-be2d-5b181fdead45", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_4cd8ae3a-284b-4d34-b511-77b416b7c9de", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "05f78781-8b35-4f0f-be2d-5b181fdead45", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_4cd8ae3a-284b-4d34-b511-77b416b7c9de" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#ff0000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "ba88967e-a86e-53d0-af08-cabdabbd1a1b" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_scale_shapes.json b/tests/_figures_viewconfig/Shapes_can_scale_shapes.json new file mode 100644 index 00000000..3750bb9d --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_scale_shapes.json @@ -0,0 +1,154 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "67e0f819-729b-4ec9-bb9b-481f8f3a2985", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_14992c4d-1468-42e2-8582-2f323898bf2b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "67e0f819-729b-4ec9-bb9b-481f8f3a2985", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_14992c4d-1468-42e2-8582-2f323898bf2b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 0.5, + "scaleY": 0.5, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "c0cfccdd-a654-5e35-a07e-d13ea6bfbd44" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_set_clims_clip.json b/tests/_figures_viewconfig/Shapes_can_set_clims_clip.json new file mode 100644 index 00000000..c0b3e584 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_set_clims_clip.json @@ -0,0 +1,236 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f662f079-28e1-4a39-b4d5-fc3580734d2e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "6b521bc3-8c5d-4241-9e72-7456da5c6d7f", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "f662f079-28e1-4a39-b4d5-fc3580734d2e", + "transform": [ + { + "type": "filter_element", + "expr": "new_table" + } + ] + }, + { + "name": "blobs_circles_169f7a20-801a-49a5-a91a-17583ed1e77f", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f662f079-28e1-4a39-b4d5-fc3580734d2e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "6b521bc3-8c5d-4241-9e72-7456da5c6d7f", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["dummy_gene_expression"], + "as": ["dummy_gene_expression"], + "default": null + }, + { + "type": "formula", + "expr": "clamp((datum.value - 20.0) / (40.0 - 20.0), 0, 1)", + "as": "755d5782-45ab-4779-9772-14b1a83202cd" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_f754374e-a114-4d13-a07b-c0eb86407b75", + "type": "linear", + "domain": { + "data": "blobs_circles_169f7a20-801a-49a5-a91a-17583ed1e77f", + "field": "755d5782-45ab-4779-9772-14b1a83202cd" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f754374e-a114-4d13-a07b-c0eb86407b75", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [20.0, 25.0, 30.0, 35.0, 40.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_169f7a20-801a-49a5-a91a-17583ed1e77f" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_f754374e-a114-4d13-a07b-c0eb86407b75", + "value": "755d5782-45ab-4779-9772-14b1a83202cd" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.dummy_gene_expression)", + "value": "#d3d3d3" + }, + { + "test": "datum.dummy_gene_expression) < 20.0", + "value": "#440154" + }, + { + "test": "datum.dummy_gene_expression) > 40.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "7421b78b-6b82-5a10-843e-0d5cac78b3d4" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json b/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json new file mode 100644 index 00000000..b04033c1 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json @@ -0,0 +1,199 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1b094ecf-b5f9-409f-a5b0-05231c273f99", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_8bb8596d-074d-4ec7-81dd-2d1559ac346f", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "1b094ecf-b5f9-409f-a5b0-05231c273f99", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_382204a7-2eda-41ba-9789-7bb6e18732af", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "1b094ecf-b5f9-409f-a5b0-05231c273f99", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_8bb8596d-074d-4ec7-81dd-2d1559ac346f" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 0.5 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_382204a7-2eda-41ba-9789-7bb6e18732af" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 0.5 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "3a92b839-c72d-598c-b9da-1115576566d9" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json b/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json new file mode 100644 index 00000000..d2cf2864 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json @@ -0,0 +1,154 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1da193e0-56bc-4aa7-9160-81767ffac519", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_b63d35d9-5470-412f-853f-d2f3af28f458", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "1da193e0-56bc-4aa7-9160-81767ffac519", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_b63d35d9-5470-412f-853f-d2f3af28f458" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "962e7c05-5553-5fef-8a06-80433149b302" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json b/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json new file mode 100644 index 00000000..374b1b5f --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json @@ -0,0 +1,213 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "8bd301eb-998c-4eef-92c1-ba3f1025d451", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_2ce35219-7787-425b-9718-7292e48cf327", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "8bd301eb-998c-4eef-92c1-ba3f1025d451", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "formula", + "expr": "clamp((datum.value - 0.0) / (5.0 - 0.0), 0, 1)", + "as": "82c58aab-eef4-4008-999b-c4dd11b6cd37" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_c3f1a7f3-ee2f-453b-8a84-c6980d62cbb2", + "type": "linear", + "domain": { + "data": "blobs_polygons_2ce35219-7787-425b-9718-7292e48cf327", + "field": "82c58aab-eef4-4008-999b-c4dd11b6cd37" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c3f1a7f3-ee2f-453b-8a84-c6980d62cbb2", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 2.0, 3.0, 4.0, 5.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_2ce35219-7787-425b-9718-7292e48cf327" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_c3f1a7f3-ee2f-453b-8a84-c6980d62cbb2", + "value": "82c58aab-eef4-4008-999b-c4dd11b6cd37" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + }, + { + "test": "datum.cluster) < 0.0", + "value": "#440154" + }, + { + "test": "datum.cluster) > 5.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "108d6796-fa19-5d41-8b3f-77aa6baf6f29" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json b/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json new file mode 100644 index 00000000..0f32102e --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json @@ -0,0 +1,200 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3e737133-5ffa-456c-9096-3d907307ebe3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_80272402-f751-45e3-818f-d60c6afc48f3", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "3e737133-5ffa-456c-9096-3d907307ebe3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_abaf73b0-b8cb-499d-82e6-dd9498d848e7", + "type": "linear", + "domain": { + "data": "blobs_polygons_80272402-f751-45e3-818f-d60c6afc48f3", + "field": "cluster" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_abaf73b0-b8cb-499d-82e6-dd9498d848e7", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_80272402-f751-45e3-818f-d60c6afc48f3" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_abaf73b0-b8cb-499d-82e6-dd9498d848e7", + "value": "cluster" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "f8f95fb2-d404-58e5-9ab0-fdd44b67a0dc" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_coloring_with_palette.json b/tests/_figures_viewconfig/Shapes_coloring_with_palette.json new file mode 100644 index 00000000..5e5e593f --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_coloring_with_palette.json @@ -0,0 +1,194 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f43838f7-345e-4a47-9567-85f186602bc1", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_8820ce63-6f54-47de-b29c-a73561a1627a", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f43838f7-345e-4a47-9567-85f186602bc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_9923049f-a36c-4456-8c18-5ceff4ce733e", + "type": "ordinal", + "domain": ["c2", "c1"], + "range": ["#008000", "#ffff00"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_9923049f-a36c-4456-8c18-5ceff4ce733e", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 260.7155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_8820ce63-6f54-47de-b29c-a73561a1627a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_9923049f-a36c-4456-8c18-5ceff4ce733e", + "field": "cluster" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "33e65d2a-b503-57b1-bb52-96d1b066eebe" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json new file mode 100644 index 00000000..31d62b81 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json @@ -0,0 +1,223 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3b930536-afb0-428a-a840-5c734a0ba2c2", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "ca6f742f-8b45-4061-a972-d3350ff3d16b", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "3b930536-afb0-428a-a840-5c734a0ba2c2", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_962691cc-8618-4e51-b774-dad8ce8fbf0e", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "3b930536-afb0-428a-a840-5c734a0ba2c2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "ca6f742f-8b45-4061-a972-d3350ff3d16b", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + }, + { + "type": "aggregate", + "field": ["category"], + "ops": ["count"], + "as": ["category"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_d12adf9f-cb82-4faa-851e-1206ef55b9d0", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_d12adf9f-cb82-4faa-851e-1206ef55b9d0", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_962691cc-8618-4e51-b774-dad8ce8fbf0e" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_d12adf9f-cb82-4faa-851e-1206ef55b9d0", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "4564f80e-7fef-5c92-8f32-bb2421df1de9" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json new file mode 100644 index 00000000..58d94d14 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json @@ -0,0 +1,219 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2c184418-2e73-4ff7-8fd8-2ff5dd30af13", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_635d30b9-e4dc-43a1-b098-1e7be9026bcc", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "2c184418-2e73-4ff7-8fd8-2ff5dd30af13", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["sum"], + "as": ["value"] + }, + { + "type": "formula", + "expr": "(datum.value - 1.0) / (2.0 - 1.0)", + "as": "da72bf32-2360-4381-a926-da2be34efbb4" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_f6e724e5-2877-41a7-b4fb-7bcc6bdad9f3", + "type": "linear", + "domain": { + "data": "blobs_polygons_635d30b9-e4dc-43a1-b098-1e7be9026bcc", + "field": "da72bf32-2360-4381-a926-da2be34efbb4" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f6e724e5-2877-41a7-b4fb-7bcc6bdad9f3", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_635d30b9-e4dc-43a1-b098-1e7be9026bcc" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_f6e724e5-2877-41a7-b4fb-7bcc6bdad9f3", + "value": "da72bf32-2360-4381-a926-da2be34efbb4" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 1.0", + "value": "#440154" + }, + { + "test": "datum.value) > 2.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "67955123-93da-509d-bb41-8823df32760c" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json new file mode 100644 index 00000000..c734974e --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json @@ -0,0 +1,219 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cd742906-bd05-4493-b826-a826f48660b8", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_b23b0e7f-f8e5-4ca2-886b-5212eff7134d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "cd742906-bd05-4493-b826-a826f48660b8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["sum"], + "as": ["value"] + }, + { + "type": "formula", + "expr": "(datum.value - 1.0) / (20.0 - 1.0)", + "as": "d5439005-ed2c-4f77-be9b-18e825b83a41" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_d33e08b1-6007-4f5e-b270-bd04dd237c01", + "type": "linear", + "domain": { + "data": "blobs_polygons_b23b0e7f-f8e5-4ca2-886b-5212eff7134d", + "field": "d5439005-ed2c-4f77-be9b-18e825b83a41" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_d33e08b1-6007-4f5e-b270-bd04dd237c01", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_b23b0e7f-f8e5-4ca2-886b-5212eff7134d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_d33e08b1-6007-4f5e-b270-bd04dd237c01", + "value": "d5439005-ed2c-4f77-be9b-18e825b83a41" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 1.0", + "value": "#440154" + }, + { + "test": "datum.value) > 20.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "cca606e1-2622-5fd8-bde3-8ea997c9e79e" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json new file mode 100644 index 00000000..367a53d8 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json @@ -0,0 +1,219 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f24e68c6-200c-4441-8c20-37dcb9758c5b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_9a88a1d0-53d7-497e-a5d4-e612ba7759f1", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f24e68c6-200c-4441-8c20-37dcb9758c5b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] + }, + { + "type": "formula", + "expr": "clamp((datum.value - 2.0) / (4.0 - 2.0), 0, 1)", + "as": "fe77b431-471f-4f58-9143-b3fdbb81d24b" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_99cb7335-7d2e-43e1-b0b4-dba12158de2a", + "type": "linear", + "domain": { + "data": "blobs_polygons_9a88a1d0-53d7-497e-a5d4-e612ba7759f1", + "field": "fe77b431-471f-4f58-9143-b3fdbb81d24b" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_99cb7335-7d2e-43e1-b0b4-dba12158de2a", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [2.0, 2.5, 3.0, 3.5, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_9a88a1d0-53d7-497e-a5d4-e612ba7759f1" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_99cb7335-7d2e-43e1-b0b4-dba12158de2a", + "value": "fe77b431-471f-4f58-9143-b3fdbb81d24b" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.0", + "value": "#000000" + }, + { + "test": "datum.value) > 4.0", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "31584187-588f-5769-b393-edd0730253af" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json new file mode 100644 index 00000000..e7061038 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json @@ -0,0 +1,219 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d5d943ac-1d68-4a64-8dbd-30a6472c5929", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_a00043bc-e062-4f29-b28d-850351bed71b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "d5d943ac-1d68-4a64-8dbd-30a6472c5929", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] + }, + { + "type": "formula", + "expr": "(datum.value - 2.0) / (4.0 - 2.0)", + "as": "fcb9e930-f5ac-4c02-879b-b9bdcf2ce68b" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_224d59eb-cbea-435e-9210-86acfaf88182", + "type": "linear", + "domain": { + "data": "blobs_polygons_a00043bc-e062-4f29-b28d-850351bed71b", + "field": "fcb9e930-f5ac-4c02-879b-b9bdcf2ce68b" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_224d59eb-cbea-435e-9210-86acfaf88182", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [2.0, 2.5, 3.0, 3.5, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_a00043bc-e062-4f29-b28d-850351bed71b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_224d59eb-cbea-435e-9210-86acfaf88182", + "value": "fcb9e930-f5ac-4c02-879b-b9bdcf2ce68b" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.0", + "value": "#000000" + }, + { + "test": "datum.value) > 4.0", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "fd9eb870-535f-55ec-bfbc-5eb1a2207b8c" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json new file mode 100644 index 00000000..2caee8be --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json @@ -0,0 +1,262 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "205a4223-178a-471c-8c62-1ac89cace850", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_300e9c83-98ad-4adc-8e33-b028405d7087", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "205a4223-178a-471c-8c62-1ac89cace850", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_polygons_4a4b7dc6-de81-4ccb-b1f5-bf5da64ef46c", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "205a4223-178a-471c-8c62-1ac89cace850", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_multipolygons_368bcc6a-0a1d-4c6c-b501-2cf7dc9b840c", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "205a4223-178a-471c-8c62-1ac89cace850", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_300e9c83-98ad-4adc-8e33-b028405d7087" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_4a4b7dc6-de81-4ccb-b1f5-bf5da64ef46c" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_368bcc6a-0a1d-4c6c-b501-2cf7dc9b840c" + }, + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "34d5b766-51ed-54e6-b228-7bb13d8fea6d" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json new file mode 100644 index 00000000..1b64a845 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json @@ -0,0 +1,262 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7f5c3f13-540c-451b-b82c-1027c78b96f0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_fb23125b-a71e-4b2e-916b-1d879228122c", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7f5c3f13-540c-451b-b82c-1027c78b96f0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_polygons_60e2553f-a6fe-4617-b6a9-164aed069beb", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7f5c3f13-540c-451b-b82c-1027c78b96f0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_multipolygons_442f6b85-086c-42f7-af5a-19f4c9860924", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7f5c3f13-540c-451b-b82c-1027c78b96f0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_fb23125b-a71e-4b2e-916b-1d879228122c" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_60e2553f-a6fe-4617-b6a9-164aed069beb" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_442f6b85-086c-42f7-af5a-19f4c9860924" + }, + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "f010839a-dfdc-531d-bf8f-b01b17f53b90" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json new file mode 100644 index 00000000..1d0cdf8a --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "b8524803-d1d6-4435-b38c-10bda92cfb3c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_27c0a723-98e7-4bb1-9b27-684992d38566", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "b8524803-d1d6-4435-b38c-10bda92cfb3c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_27c0a723-98e7-4bb1-9b27-684992d38566" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#ff0000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "715bd498-2f4c-5976-a4ab-9871bde47282" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json new file mode 100644 index 00000000..15cf4d60 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "020be3e6-b83e-4750-98ce-798777208495", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_f73adae1-8ff9-4bbd-8cdf-068501b1ca72", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "020be3e6-b83e-4750-98ce-798777208495", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_f73adae1-8ff9-4bbd-8cdf-068501b1ca72" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 0.5 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "19a9c0b0-0710-53b7-8569-1d2504250f6b" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json new file mode 100644 index 00000000..c3eadff5 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "ce8f2c18-e2f8-4765-b08a-afdd56111184", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_16884a1c-57b7-48e3-85d6-33a7401980c8", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "ce8f2c18-e2f8-4765-b08a-afdd56111184", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_16884a1c-57b7-48e3-85d6-33a7401980c8" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 5.0 + }, + "strokeOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "c6b82c47-ae51-5658-a684-7e9ad87fa771" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json new file mode 100644 index 00000000..6a0fbaaa --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json @@ -0,0 +1,262 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_851d287a-ac9c-477b-b9a8-c44ed440aac1", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_polygons_448beade-eb12-4971-8f5f-8246fa2b9eff", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_multipolygons_069cd020-b7c3-4672-98f5-55b5e32ad178", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_851d287a-ac9c-477b-b9a8-c44ed440aac1" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 0.7 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_448beade-eb12-4971-8f5f-8246fa2b9eff" + }, + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 0.7 + } + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_069cd020-b7c3-4672-98f5-55b5e32ad178" + }, + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 0.7 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "a8190cc1-bd58-56c4-8340-e2dc2434bb68" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json new file mode 100644 index 00000000..73f3b751 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5b9a605c-1cf9-4b8a-9e39-434df47e14aa", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_009a0417-9db2-4c42-9631-92df181dbf54", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "5b9a605c-1cf9-4b8a-9e39-434df47e14aa", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_009a0417-9db2-4c42-9631-92df181dbf54" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "f9e173df-a025-5278-8c63-592350da3bce" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json new file mode 100644 index 00000000..59326843 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f26835e9-8aab-4ab6-8b67-f052fcaddd48", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_b25a638c-60d0-43d1-a844-2af3cbfeaa5d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f26835e9-8aab-4ab6-8b67-f052fcaddd48", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_b25a638c-60d0-43d1-a844-2af3cbfeaa5d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#0000ff" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "f89408da-a17b-58df-b713-c8d3cad3b2a0" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json new file mode 100644 index 00000000..d33b93d1 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "63b2022f-6b96-4c68-894d-cf2719905a50", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_b1b1ea36-31a7-4470-aa93-f60e346ac579", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "63b2022f-6b96-4c68-894d-cf2719905a50", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_b1b1ea36-31a7-4470-aa93-f60e346ac579" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#00ff00" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "b03f9b9f-bfb5-5dd3-abc7-975ea5ed4c70" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json b/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json new file mode 100644 index 00000000..7c959867 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "78e57bd6-7699-4552-8d1e-d63962996de5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_circles_c2e87394-bcd6-4828-8ee9-c393f797f4b8", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "78e57bd6-7699-4552-8d1e-d63962996de5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-580.5624257141354, -45.275966500273434], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-204.149037642031, -623.3858457994218], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-400, -200], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-600, -500, -400, -300], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_c2e87394-bcd6-4828-8ee9-c393f797f4b8" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "db38b25c-02f3-5e15-8cc2-f17fdb5bb1a4" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json b/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json new file mode 100644 index 00000000..3e9b562d --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "62ed2e0e-7954-4e32-ba5e-6efd036dbbde", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multipolygons_79ac14b8-ec94-4bf9-9ff5-001caa0d9297", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "62ed2e0e-7954-4e32-ba5e-6efd036dbbde", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-503.3827552451457, -373.83299073217603], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-363.0369921097614, -599.7025350355941], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-500, -450, -400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-550, -500, -450, -400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_multipolygons_79ac14b8-ec94-4bf9-9ff5-001caa0d9297" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "8f19df5c-f1ca-58d7-ae3f-1ff267f6ad47" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json b/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json new file mode 100644 index 00000000..3c156f2b --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json @@ -0,0 +1,169 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7a577ba6-3f68-4bfc-9414-b79c0c3d658e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_03610787-9e2f-44b3-9f69-d46560a66f87", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7a577ba6-3f68-4bfc-9414-b79c0c3d658e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-592.0096679034098, -117.03467315555264], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-310.74557710724594, -668.0575932183025], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-500, -400, -300, -200], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-600, -500, -400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_03610787-9e2f-44b3-9f69-d46560a66f87" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1.0 + } + } + } + } + ], + "usermeta": { + "axis_uuid": "b9aaeb23-f3da-5259-acd0-e91080c8dd49" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json new file mode 100644 index 00000000..878b745c --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json @@ -0,0 +1,223 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9fd3ee24-2c76-482f-bfd6-c4cd8fda8408", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_db440e45-8335-4b68-bef0-2e9682f7ebc2", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "9fd3ee24-2c76-482f-bfd6-c4cd8fda8408", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] + }, + { + "type": "formula", + "expr": "clamp((datum.value - 2.5) / (3.5 - 2.5), 0, 1)", + "as": "b9fc6adf-3907-4f4b-94da-62e705a320bb" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_6d131c1f-d4ab-4ada-a0a9-5f1729f4a503", + "type": "linear", + "domain": { + "data": "blobs_polygons_db440e45-8335-4b68-bef0-2e9682f7ebc2", + "field": "b9fc6adf-3907-4f4b-94da-62e705a320bb" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_6d131c1f-d4ab-4ada-a0a9-5f1729f4a503", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 2.4000000000000004, 2.6000000000000005, 2.8000000000000003, + 3.0000000000000004, 3.2, 3.4000000000000004, + 3.6000000000000005 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_db440e45-8335-4b68-bef0-2e9682f7ebc2" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_6d131c1f-d4ab-4ada-a0a9-5f1729f4a503", + "value": "b9fc6adf-3907-4f4b-94da-62e705a320bb" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.5", + "value": "#000000" + }, + { + "test": "datum.value) > 3.5", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "8548bc92-78ab-58e5-b323-d8fb0834790b" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json new file mode 100644 index 00000000..6cf3576b --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json @@ -0,0 +1,223 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7bb83c5c-2428-42b4-8c7b-e020bbd1e198", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_f717dfb3-4678-47e1-b0b3-2474d426f6de", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7bb83c5c-2428-42b4-8c7b-e020bbd1e198", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] + }, + { + "type": "formula", + "expr": "(datum.value - 2.5) / (3.5 - 2.5)", + "as": "3f56c6b7-07da-4508-b101-22dd9c2e6221" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_8ee1b08a-0d11-425d-9cfd-30ab8d5ca193", + "type": "linear", + "domain": { + "data": "blobs_polygons_f717dfb3-4678-47e1-b0b3-2474d426f6de", + "field": "3f56c6b7-07da-4508-b101-22dd9c2e6221" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_8ee1b08a-0d11-425d-9cfd-30ab8d5ca193", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 2.4000000000000004, 2.6000000000000005, 2.8000000000000003, + 3.0000000000000004, 3.2, 3.4000000000000004, + 3.6000000000000005 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_f717dfb3-4678-47e1-b0b3-2474d426f6de" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_8ee1b08a-0d11-425d-9cfd-30ab8d5ca193", + "value": "3f56c6b7-07da-4508-b101-22dd9c2e6221" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.5", + "value": "#000000" + }, + { + "test": "datum.value) > 3.5", + "value": "#808080" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "13381ec3-b11e-5ba6-8704-72248334c11f" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json b/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json new file mode 100644 index 00000000..43575dbe --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json @@ -0,0 +1,219 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e9290aa5-431f-4b97-b09e-3e5d120db95a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_polygons_6c6e6ce6-3192-4385-b75d-04f1fdec87d3", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "e9290aa5-431f-4b97-b09e-3e5d120db95a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["sum"], + "as": ["value"] + }, + { + "type": "formula", + "expr": "(datum.value - 1.0) / (20.0 - 1.0)", + "as": "ba4786e0-c7d4-46bc-8988-5e0b48426372" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_d0dd5d47-1faf-44e8-bbe6-6cf1c417b5bb", + "type": "linear", + "domain": { + "data": "blobs_polygons_6c6e6ce6-3192-4385-b75d-04f1fdec87d3", + "field": "ba4786e0-c7d4-46bc-8988-5e0b48426372" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_d0dd5d47-1faf-44e8-bbe6-6cf1c417b5bb", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_6c6e6ce6-3192-4385-b75d-04f1fdec87d3" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_d0dd5d47-1faf-44e8-bbe6-6cf1c417b5bb", + "value": "ba4786e0-c7d4-46bc-8988-5e0b48426372" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 1.0", + "value": "#440154" + }, + { + "test": "datum.value) > 20.0", + "value": "#fde725" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "aea21008-1acf-574c-a1f5-bd34acf3262d" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json b/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json new file mode 100644 index 00000000..54547125 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json @@ -0,0 +1,217 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7f09f346-c7a4-4dc1-8216-bf8d53cf1f1e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "b9bb444b-5de9-4d9c-b28c-ecdf50bb154c", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "7f09f346-c7a4-4dc1-8216-bf8d53cf1f1e", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_28c6b35e-06a8-4b07-b4cb-36fc6e494ff1", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7f09f346-c7a4-4dc1-8216-bf8d53cf1f1e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "b9bb444b-5de9-4d9c-b28c-ecdf50bb154c", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_4bdb204c-f15d-4b9f-b669-0e939e18652b", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_4bdb204c-f15d-4b9f-b669-0e939e18652b", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_28c6b35e-06a8-4b07-b4cb-36fc6e494ff1" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_4bdb204c-f15d-4b9f-b669-0e939e18652b", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "b31d077e-eecd-53fb-ba3c-f779f19bc620" + } + } +] diff --git a/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json b/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json new file mode 100644 index 00000000..b8a1c598 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json @@ -0,0 +1,217 @@ +[ + { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "49d67eee-d1c9-4735-9f13-84a3f285f081", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "1e2aeef0-0d99-4763-ab7e-f7e915538461", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "49d67eee-d1c9-4735-9f13-84a3f285f081", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_5a762587-da69-4c16-a024-b403ef7be586", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "49d67eee-d1c9-4735-9f13-84a3f285f081", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "1e2aeef0-0d99-4763-ab7e-f7e915538461", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_21ad53a3-eb0e-4679-a24f-935d8fde7fe7", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_21ad53a3-eb0e-4679-a24f-935d8fde7fe7", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_5a762587-da69-4c16-a024-b403ef7be586" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_21ad53a3-eb0e-4679-a24f-935d8fde7fe7", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ], + "usermeta": { + "axis_uuid": "e44c0e72-0819-570d-bfe6-38c3cd4dd76a" + } + } +] diff --git a/tests/pl/test_render_shapes.py b/tests/pl/test_render_shapes.py index 5ccca4f8..e3c8546e 100644 --- a/tests/pl/test_render_shapes.py +++ b/tests/pl/test_render_shapes.py @@ -217,6 +217,7 @@ def test_plot_can_plot_queried_with_annotation_despite_random_shuffling(self, sd sdata_cropped.pl.render_shapes("blobs_circles", color="annotation").pl.show() def test_plot_can_color_two_shapes_elements_by_annotation(self, sdata_blobs: SpatialData): + # TODO: discuss 2 color scales resulting in one legend -> array values for source? sdata_blobs["table"].obs["region"] = "blobs_circles" new_table = sdata_blobs["table"][:10].copy() new_table.uns["spatialdata_attrs"]["region"] = ["blobs_circles", "blobs_polygons"] @@ -450,6 +451,7 @@ def test_plot_datashader_can_transform_circles(self, sdata_blobs: SpatialData): sdata_blobs.pl.render_shapes("blobs_circles", method="datashader", outline_alpha=1.0).pl.show() def test_plot_can_do_non_matching_table(self, sdata_blobs: SpatialData): + # TODO: discuss isvalid logic table_shapes = sdata_blobs["table"][:3].copy() table_shapes.obs.instance_id = list(range(3)) table_shapes.obs["region"] = "blobs_circles" From b18ba6b363cee857f0c0c83cb614c18594057282 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Wed, 21 May 2025 13:58:56 +0200 Subject: [PATCH 50/56] update to support subplots --- src/spatialdata_plot/_viewconfig/config.py | 125 +++++++++++++++++---- src/spatialdata_plot/config.py | 2 +- src/spatialdata_plot/pl/basic.py | 57 +++++----- tests/conftest.py | 8 +- 4 files changed, 140 insertions(+), 52 deletions(-) diff --git a/src/spatialdata_plot/_viewconfig/config.py b/src/spatialdata_plot/_viewconfig/config.py index 95480491..1d686a05 100644 --- a/src/spatialdata_plot/_viewconfig/config.py +++ b/src/spatialdata_plot/_viewconfig/config.py @@ -1,8 +1,11 @@ +from __future__ import annotations + from pathlib import Path from typing import Any from matplotlib.axes import Axes from matplotlib.figure import Figure +from matplotlib.text import Text from spatialdata import SpatialData from spatialdata_plot._viewconfig.axis import create_axis_block @@ -73,7 +76,7 @@ def create_padding_object(fig: Figure) -> dict[str, float]: } -def create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: +def create_title_config(ax: Axes, fig: Figure, suptitle: Text | None = None) -> dict[str, Any]: """Create a vega title object for a spatialdata view configuration. Note that not all field values as obtained from matplotlib are supported by the official @@ -85,10 +88,23 @@ def create_title_config(ax: Axes, fig: Figure) -> dict[str, Any]: A matplotlib Axes instance which represents one (sub)plot in a matplotlib figure. fig : Figure The matplotlib figure. The top level container for all the plot elements. + suptitle : Text + The figure title Text object. Specified in case the figure contains multiple subplots, but has a + figure title which is not an empty string. + + Returns + ------- + dict[str, Any] + """ - title_text = ax.get_title() - title_obj = ax.title - title_font = title_obj.get_fontproperties() + if not suptitle: + title_text = ax.get_title() + title_obj = ax.title + title_font = title_obj.get_fontproperties() + else: + title_text = suptitle.get_text() + title_obj = suptitle + title_font = suptitle.get_fontproperties() return { "text": title_text, @@ -233,7 +249,42 @@ def _create_data_configs( return data_array, marks_array, color_scale_array_full, legend_array_full -def create_viewconfig(sdata: SpatialData, fig_params: FigParams, cs: str) -> dict[str, Any]: +def create_group_mark( + fig: Figure, + ax: Axes, + scales: list[dict[str, Any]], + axis_array: list[dict[str, Any]], + marks_array: list[dict[str, Any]], + legend_array: list[dict[str, Any]], +) -> dict[str, Any]: + """Create a Vega like groups mark object.""" + ax_pos = ax.get_position() + + encode_enter_obj = { + "x": {"value": ax_pos.x0 * fig.bbox.width}, + "y": {"value": (1 - ax_pos.y1) * fig.bbox.height}, + "width": {"value": (ax_pos.x1 - ax_pos.x0) * fig.bbox.width}, + "height": {"value": (ax_pos.y1 - ax_pos.y0) * fig.bbox.height}, + } + + group_config = { + "type": "group", + "encode": { + "enter": encode_enter_obj, + }, + "scales": scales, + "axes": axis_array, + } + if legend_array: + group_config["legend"] = legend_array + group_config["marks"] = marks_array + + return group_config + + +def create_viewconfig( + sdata: SpatialData, fig_params: FigParams, cs: str, existing_config: dict[str, Any] | None = None +) -> dict[str, Any]: """Create a vega like view configuration based on the spatialdata-plot visualization. Parameters @@ -244,6 +295,8 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, cs: str) -> dic The figure parameters containing for example the matplotlib figure and axes. cs: str The name of the coordinate system in which the SpatialData elements were plotted. + existing_config : dict[str, Any] + Existing config to which to add a subplot. The subplot will be added mostly in the marks array in the config. """ fig = fig_params.fig ax = fig_params.ax @@ -254,19 +307,53 @@ def create_viewconfig(sdata: SpatialData, fig_params: FigParams, cs: str) -> dic scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array - viewconfig = { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": fig.bbox.height, - "width": fig.bbox.width, - "padding": create_padding_object(fig), - "title": create_title_config(ax, fig), - "data": data_array, - "scales": scales, - "axes": axis_array, - } - - if len(legend_array) > 0: - viewconfig["legend"] = legend_array - viewconfig["marks"] = marks_array + if len(fig.get_axes()) == 1: + viewconfig = { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": fig.bbox.height, + "width": fig.bbox.width, + "padding": create_padding_object(fig), + "title": create_title_config(ax, fig), + "data": data_array, + "scales": scales, + "axes": axis_array, + } + + if len(legend_array) > 0: + viewconfig["legend"] = legend_array + viewconfig["marks"] = marks_array + + if len(fig.get_axes()) > 1: + ax_index = fig.get_axes().index(ax) + + if not existing_config: + viewconfig = { + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": fig.bbox.height, + "width": fig.bbox.width, + "padding": create_padding_object(fig), + } + + # While matplotlib has an api for accessing the title object of individual axes, it does not have this for + # suptitle. So this here is quite hacky and we need to come up with a better way for this. + if fig.texts: + viewconfig["title"] = create_title_config(ax, fig, fig.texts[0]) + + viewconfig["data"] = data_array + + else: + viewconfig = existing_config + for index, scale in enumerate(scales): + if "scale" in scale["name"]: + scale["name"] = f"{scale['name']}_{ax_index}" + axis_array[index]["scale"] = f"{scale['name']}" + + if "marks" not in viewconfig: + viewconfig["marks"] = [] + + if len(viewconfig["marks"]) != ax_index: + raise ValueError("It seems like you are missing part of the viewconfig.") + group_mark = create_group_mark(fig, ax, scales, axis_array, marks_array, legend_array) + viewconfig["marks"].append(group_mark) return viewconfig diff --git a/src/spatialdata_plot/config.py b/src/spatialdata_plot/config.py index 73ed3256..f643554c 100644 --- a/src/spatialdata_plot/config.py +++ b/src/spatialdata_plot/config.py @@ -1,2 +1,2 @@ # default value for the parameter store_viewconfig_in_attrs for .pl.show() -STORE_VIEWCONFIG_IN_ATTRS = False +STORE_VIEWCONFIG_NAME = None diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index b4d464d3..08925ee5 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -2,7 +2,6 @@ import json import sys -import uuid import warnings from collections import OrderedDict from copy import deepcopy @@ -727,7 +726,7 @@ def show( ax: list[Axes] | Axes | None = None, return_ax: bool = False, save: str | Path | None = None, - store_viewconfig_in_attrs: bool | None = None, + store_viewconfig_name: str | None = None, store_viewconfig_to_disk: Path | None = None, ) -> sd.SpatialData: """ @@ -781,9 +780,9 @@ def show( Whether to return the axes object created. save : Path to save the plot to a file. - store_viewconfig_in_attrs : - Whether to store the view configuration in `.attrs` slot of the `SpatialData` object. It defaults to - `spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS`. + store_viewconfig_name : + Key name by which to store the view configuration in `.attrs["viewconfig"]` slot of the `SpatialData` + object. It defaults to `spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS`. store_viewconfig_to_disk : Path to store the view configuration on disk. By default, the view configuration is not stored on disk. @@ -823,8 +822,8 @@ def show( save, ) - if store_viewconfig_in_attrs is None: - store_viewconfig_in_attrs = spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS + if store_viewconfig_name is None: + store_viewconfig_name = spatialdata_plot.config.STORE_VIEWCONFIG_NAME sdata = self._copy() @@ -871,14 +870,14 @@ def show( # Only reason for multiple coordinate systems is to show quick overview, but this would complicate the # view config implementation. For testing now, global is used as default. - if not isinstance(coordinate_systems, str) and store_viewconfig_in_attrs: + if not isinstance(coordinate_systems, str) and store_viewconfig_name: # TODO: change this when having full implementation. store_viewconfig_cs = "global" # raise ValueError("If wanting to store the view configuration. A single coordinate system must be # provided") if isinstance(coordinate_systems, str): - if store_viewconfig_in_attrs: + if store_viewconfig_name: store_viewconfig_cs = coordinate_systems coordinate_systems = [coordinate_systems] @@ -1081,29 +1080,31 @@ def show( ax.set_xlim(x_min, x_max) ax.set_ylim(y_max, y_min) # (0, 0) is top-left - def get_current_ax_uuid(ax: Axes) -> str: - return str(uuid.uuid5(uuid.NAMESPACE_DNS, str(id(ax)))) - - def _concat_viewconfig( - old_viewconfig: list[dict[str, Any]], new_viewconfig: list[dict[str, Any]] - ) -> list[dict[str, Any]]: - return old_viewconfig + new_viewconfig - - viewconfig: list[dict[str, Any]] | None = None - if store_viewconfig_in_attrs or store_viewconfig_to_disk: - viewconfig = [create_viewconfig(sdata, fig_params, store_viewconfig_cs)] - if store_viewconfig_in_attrs: + existing_viewconfig = None + if store_viewconfig_name: + root = sdata + while hasattr(root, "_sdata"): + root = root._sdata + if ( + "viewconfigs" in root.attrs + and store_viewconfig_name + and store_viewconfig_name in root.attrs["viewconfigs"] + ): + existing_viewconfig = root.attrs["viewconfigs"][store_viewconfig_name] + + viewconfig: dict[str, Any] | None = None + if store_viewconfig_name or store_viewconfig_to_disk: + viewconfig = create_viewconfig(sdata, fig_params, store_viewconfig_cs, existing_viewconfig) + if store_viewconfig_name: root = sdata while hasattr(root, "_sdata"): root = root._sdata - assert isinstance(viewconfig, list) - viewconfig[0]["usermeta"] = {"axis_uuid": get_current_ax_uuid(ax)} - if "viewconfig" not in root.attrs: - root.attrs["viewconfig"] = viewconfig - else: - merged_viewconfig = _concat_viewconfig(root.attrs["viewconfig"], viewconfig) - root.attrs["viewconfig"] = merged_viewconfig + if "viewconfigs" not in root.attrs: + root.attrs["viewconfigs"] = [] + + root.attrs["viewconfigs"][store_viewconfig_name] = viewconfig + if store_viewconfig_to_disk: with open(store_viewconfig_to_disk, "w") as outfile: json.dump(viewconfig, outfile) diff --git a/tests/conftest.py b/tests/conftest.py index a0f0b475..43990fc3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -498,14 +498,14 @@ def save_and_compare(self, *args, **kwargs): break if sdata is not None: - old_config = spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS - spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS = True + old_config = spatialdata_plot.config.STORE_VIEWCONFIG_NAME + spatialdata_plot.config.STORE_VIEWCONFIG_NAME = "test_config" fn(self, *args, **kwargs) if sdata is not None: spatialdata_plot.config.STORE_VIEWCONFIG_IN_ATTRS = old_config - if "viewconfig" in sdata.attrs: - viewconfig = sdata.attrs["viewconfig"] + if "viewconfigs" in sdata.attrs: + viewconfig = sdata.attrs["viewconfigs"][spatialdata_plot.config.STORE_VIEWCONFIG_NAME] VIEWCONFIG_ACTUAL.mkdir(parents=True, exist_ok=True) with open(VIEWCONFIG_ACTUAL / f"{fig_name}.json", "w") as outfile: json.dump(viewconfig, outfile, indent=4) From 7a97b4f77ec9e1e17730a1308c2a57603160c8ce Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Wed, 21 May 2025 14:08:44 +0200 Subject: [PATCH 51/56] correct --- src/spatialdata_plot/pl/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 08925ee5..597546bd 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -1101,7 +1101,7 @@ def show( root = root._sdata if "viewconfigs" not in root.attrs: - root.attrs["viewconfigs"] = [] + root.attrs["viewconfigs"] = {} root.attrs["viewconfigs"][store_viewconfig_name] = viewconfig From 26252e2b92519f849d456453dcd2d91143b07464 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Wed, 21 May 2025 15:46:35 +0200 Subject: [PATCH 52/56] fix error due to colorbar --- src/spatialdata_plot/_viewconfig/config.py | 8 +- .../Images_can_pass_cmap.json | 167 --------------- .../Images_can_pass_cmap_list.json | 199 ------------------ .../Images_can_pass_str_cmap.json | 167 --------------- .../Images_can_pass_str_cmap_list.json | 199 ------------------ .../Images_can_render_image.json | 167 --------------- 6 files changed, 5 insertions(+), 902 deletions(-) delete mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap.json delete mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap_list.json delete mode 100644 tests/_figures_viewconfig/Images_can_pass_str_cmap.json delete mode 100644 tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json delete mode 100644 tests/_figures_viewconfig/Images_can_render_image.json diff --git a/src/spatialdata_plot/_viewconfig/config.py b/src/spatialdata_plot/_viewconfig/config.py index 1d686a05..8a8d943b 100644 --- a/src/spatialdata_plot/_viewconfig/config.py +++ b/src/spatialdata_plot/_viewconfig/config.py @@ -307,7 +307,9 @@ def create_viewconfig( scales = scales_array + color_scale_array if len(color_scale_array) > 0 else scales_array - if len(fig.get_axes()) == 1: + # To avoid counting the colorbar axes object. + subplot_axes_objects = [i for i in fig.get_axes() if i.get_label() == ""] + if len(subplot_axes_objects) == 1: viewconfig = { "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", "height": fig.bbox.height, @@ -323,8 +325,8 @@ def create_viewconfig( viewconfig["legend"] = legend_array viewconfig["marks"] = marks_array - if len(fig.get_axes()) > 1: - ax_index = fig.get_axes().index(ax) + if len(subplot_axes_objects) > 1: + ax_index = subplot_axes_objects.index(ax) if not existing_config: viewconfig = { diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap.json b/tests/_figures_viewconfig/Images_can_pass_cmap.json deleted file mode 100644 index eeaaae87..00000000 --- a/tests/_figures_viewconfig/Images_can_pass_cmap.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "618ae2df-ce0b-4de2-8599-642e1eb9e5f3", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250415" - } - }, - { - "name": "blobs_image_4b5db09b-181d-4f95-9bfc-d38ed2f5b3ba", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "618ae2df-ce0b-4de2-8599-642e1eb9e5f3", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_bbdbc56d-9ac8-4a8c-8176-aef96af1c18b", - "type": "linear", - "domain": { - "data": "blobs_image_4b5db09b-181d-4f95-9bfc-d38ed2f5b3ba", - "field": "value" - }, - "range": { - "scheme": "seismic", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_4b5db09b-181d-4f95-9bfc-d38ed2f5b3ba" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_bbdbc56d-9ac8-4a8c-8176-aef96af1c18b", - "value": "value" - } - ] - } - } - } - ], - "usermeta": { - "axis_uuid": "1a13b428-0012-571b-b56c-43a1552ddbdc" - } - } -] diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_list.json b/tests/_figures_viewconfig/Images_can_pass_cmap_list.json deleted file mode 100644 index 15c71f1f..00000000 --- a/tests/_figures_viewconfig/Images_can_pass_cmap_list.json +++ /dev/null @@ -1,199 +0,0 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "6dddd0c6-d18a-4f68-ba2d-cd0544e5d1f9", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250415" - } - }, - { - "name": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "6dddd0c6-d18a-4f68-ba2d-cd0544e5d1f9", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_68df9a72-7768-47d6-b15b-935d41905b2d", - "type": "linear", - "domain": { - "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", - "field": "channel_0" - }, - "range": { - "scheme": "seismic", - "count": 256 - } - }, - { - "name": "color_32fce90e-82bf-4408-a94f-1647827a9aa0", - "type": "linear", - "domain": { - "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", - "field": "channel_1" - }, - "range": { - "scheme": "Reds", - "count": 256 - } - }, - { - "name": "color_5b397def-2357-4041-8bb2-b3d5249d5a41", - "type": "linear", - "domain": { - "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344", - "field": "channel_2" - }, - "range": { - "scheme": "Blues", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_4b2436d5-3d56-4618-b6b3-fdd4b306a344" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_68df9a72-7768-47d6-b15b-935d41905b2d", - "field": "channel_0" - }, - { - "scale": "color_32fce90e-82bf-4408-a94f-1647827a9aa0", - "field": "channel_1" - }, - { - "scale": "color_5b397def-2357-4041-8bb2-b3d5249d5a41", - "field": "channel_2" - } - ] - } - } - } - ], - "usermeta": { - "axis_uuid": "1937985d-7ef9-5ffc-b33e-e352723d8da2" - } - } -] diff --git a/tests/_figures_viewconfig/Images_can_pass_str_cmap.json b/tests/_figures_viewconfig/Images_can_pass_str_cmap.json deleted file mode 100644 index 200781f4..00000000 --- a/tests/_figures_viewconfig/Images_can_pass_str_cmap.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "07970747-8edc-4315-9a7d-6228a4bde18d", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250324" - } - }, - { - "name": "blobs_image_f2023937-f7cf-4f48-b32b-1cb59f258644", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "07970747-8edc-4315-9a7d-6228a4bde18d", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_3fe2d8fb-3d3e-48a9-9453-0eeefc82d1cf", - "type": "linear", - "domain": { - "data": "blobs_image_f2023937-f7cf-4f48-b32b-1cb59f258644", - "field": "value" - }, - "range": { - "scheme": "seismic", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_f2023937-f7cf-4f48-b32b-1cb59f258644" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_3fe2d8fb-3d3e-48a9-9453-0eeefc82d1cf", - "value": "value" - } - ] - } - } - } - ], - "usermeta": { - "axis_uuid": "4abfb043-e957-52d7-a20c-2e44d0f09148" - } - } -] diff --git a/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json b/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json deleted file mode 100644 index fb3546db..00000000 --- a/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json +++ /dev/null @@ -1,199 +0,0 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "d47b5cb4-fea4-44af-84ac-bf5e1d0846e9", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250415" - } - }, - { - "name": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "d47b5cb4-fea4-44af-84ac-bf5e1d0846e9", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_7faaedbf-ad06-4c14-a8bb-987412bccfdb", - "type": "linear", - "domain": { - "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", - "field": "channel_0" - }, - "range": { - "scheme": "seismic", - "count": 256 - } - }, - { - "name": "color_af611f7e-f600-44ad-b72f-e464558633d6", - "type": "linear", - "domain": { - "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", - "field": "channel_1" - }, - "range": { - "scheme": "Reds", - "count": 256 - } - }, - { - "name": "color_c2ed37e4-a051-4ac5-9591-15d22ab0ca4a", - "type": "linear", - "domain": { - "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d", - "field": "channel_2" - }, - "range": { - "scheme": "Blues", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_f3d3baed-66d9-480f-8fb6-6acfcc5daf9d" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_7faaedbf-ad06-4c14-a8bb-987412bccfdb", - "field": "channel_0" - }, - { - "scale": "color_af611f7e-f600-44ad-b72f-e464558633d6", - "field": "channel_1" - }, - { - "scale": "color_c2ed37e4-a051-4ac5-9591-15d22ab0ca4a", - "field": "channel_2" - } - ] - } - } - } - ], - "usermeta": { - "axis_uuid": "d774872a-6947-570c-9566-80f668ab0cb9" - } - } -] diff --git a/tests/_figures_viewconfig/Images_can_render_image.json b/tests/_figures_viewconfig/Images_can_render_image.json deleted file mode 100644 index a25cdd12..00000000 --- a/tests/_figures_viewconfig/Images_can_render_image.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "c1e9dc90-4b40-4773-a20d-e5e0b5cd7785", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250324" - } - }, - { - "name": "blobs_image_177f9ae8-9150-47d6-ba81-c5c624fdbd2a", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "c1e9dc90-4b40-4773-a20d-e5e0b5cd7785", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_5762c824-6494-4bd6-be18-315bd971fa3b", - "type": "linear", - "domain": { - "data": "blobs_image_177f9ae8-9150-47d6-ba81-c5c624fdbd2a", - "field": "value" - }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_177f9ae8-9150-47d6-ba81-c5c624fdbd2a" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_5762c824-6494-4bd6-be18-315bd971fa3b", - "value": "value" - } - ] - } - } - } - ], - "usermeta": { - "axis_uuid": "0bfb55b4-ef99-5eaf-bdf8-d0e42d531ff5" - } - } -] From 61da73abf00f95068b333494469168c717d05593 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 23 May 2025 17:31:21 +0200 Subject: [PATCH 53/56] support subplots --- src/spatialdata_plot/_viewconfig/config.py | 30 +- src/spatialdata_plot/_viewconfig/misc.py | 13 + .../Images_can_do_rasterization.json | 309 +++-- .../Images_can_pass_cmap.json | 162 +++ .../Images_can_pass_cmap_list.json | 194 +++ .../Images_can_pass_cmap_to_each_channel.json | 365 +++-- ...mages_can_pass_cmap_to_single_channel.json | 359 +++-- ...Images_can_pass_color_to_each_channel.json | 365 +++-- ...ages_can_pass_color_to_single_channel.json | 359 +++-- .../Images_can_pass_normalize_clip_False.json | 369 +++-- .../Images_can_pass_normalize_clip_True.json | 369 +++-- ...an_pass_normalize_clip_true_list_cmap.json | 375 +++-- .../Images_can_pass_str_cmap.json | 162 +++ .../Images_can_pass_str_cmap_list.json | 194 +++ ...an_render_a_single_channel_from_image.json | 359 +++-- ..._single_channel_from_multiscale_image.json | 359 +++-- ...ender_a_single_channel_str_from_image.json | 359 +++-- ...gle_channel_str_from_multiscale_image.json | 359 +++-- ...ender_given_scale_of_multiscale_image.json | 309 +++-- .../Images_can_render_image.json | 162 +++ .../Images_can_render_multiscale_image.json | 309 +++-- ...der_multiscale_image_with_custom_cmap.json | 359 +++-- ...es_can_render_two_channels_from_image.json | 335 +++-- ...er_two_channels_from_multiscale_image.json | 335 +++-- ...an_render_two_channels_str_from_image.json | 335 +++-- ...wo_channels_str_from_multiscale_image.json | 335 +++-- .../Images_can_stack_render_images.json | 505 ++++--- .../Images_can_stick_to_zorder.json | 651 +++++---- ...an_stop_rasterization_with_scale_full.json | 309 +++-- ..._can_annotate_labels_with_table_layer.json | 443 +++--- ..._color_labels_by_categorical_variable.json | 425 +++--- ...y_categorical_variable_in_other_table.json | 1212 +++++++++-------- ...n_color_labels_by_continuous_variable.json | 439 +++--- ...bels_can_color_with_norm_and_clipping.json | 445 +++--- ...abels_can_color_with_norm_no_clipping.json | 445 +++--- .../Labels_can_control_label_infill.json | 439 +++--- .../Labels_can_control_label_outline.json | 439 +++--- .../Labels_can_do_rasterization.json | 319 +++-- ...can_plot_with_one_element_color_table.json | 665 +++++---- ...nder_given_scale_of_multiscale_labels.json | 319 +++-- .../Labels_can_render_labels.json | 319 +++-- .../Labels_can_render_multiscale_labels.json | 319 +++-- .../Labels_can_stack_render_labels.json | 389 +++--- ...an_stop_rasterization_with_scale_full.json | 319 +++-- .../Labels_label_categorical_color.json | 425 +++--- ...uses_alpha_of_less_transparent_infill.json | 439 +++--- ...ses_alpha_of_less_transparent_outline.json | 439 +++--- ...set_categorical_label_maintains_order.json | 884 ++++++------ ...aintains_order_when_palette_overwrite.json | 884 ++++++------ ...with_coloring_result_in_two_colorbars.json | 665 +++++---- tests/conftest.py | 2 +- 51 files changed, 10236 insertions(+), 9443 deletions(-) create mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_cmap_list.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_str_cmap.json create mode 100644 tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json create mode 100644 tests/_figures_viewconfig/Images_can_render_image.json diff --git a/src/spatialdata_plot/_viewconfig/config.py b/src/spatialdata_plot/_viewconfig/config.py index 8a8d943b..129106d3 100644 --- a/src/spatialdata_plot/_viewconfig/config.py +++ b/src/spatialdata_plot/_viewconfig/config.py @@ -21,7 +21,7 @@ create_raster_label_marks_object, create_shapes_marks_object, ) -from spatialdata_plot._viewconfig.misc import VegaAlignment, strip_call +from spatialdata_plot._viewconfig.misc import VegaAlignment, VegaTextBaseline, strip_call from spatialdata_plot._viewconfig.scales import ( create_axis_scale_array, create_colorscale_array_image, @@ -110,7 +110,7 @@ def create_title_config(ax: Axes, fig: Figure, suptitle: Text | None = None) -> "text": title_text, "orient": "top", # there is not really a nice conversion here of matplotlib to vega "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), - "baseline": title_obj.get_va(), + "baseline": VegaTextBaseline.from_matplotlib(title_obj.get_va()), "color": title_obj.get_color(), "font": title_obj.get_fontname(), "fontSize": (title_font.get_size() * fig.dpi) / 72, @@ -249,6 +249,30 @@ def _create_data_configs( return data_array, marks_array, color_scale_array_full, legend_array_full +def create_subtitle_config(fig: Figure, ax: Axes) -> dict[str, Any] | None: + """Create text mark for subplot title text.""" + title_text_mark = None + if ax.get_title(): + title_encode_enter_obj = create_title_config(ax, fig) + title_encode_enter_obj["align"] = {"value": ax.title.properties()["horizontalalignment"]} + for key, value in title_encode_enter_obj.items(): + title_encode_enter_obj[key] = {"value": value} + del title_encode_enter_obj["anchor"] + del title_encode_enter_obj["orient"] + + renderer = fig.canvas.get_renderer() + bbox = ax.title.get_window_extent(renderer=renderer) + title_encode_enter_obj["x"] = {"value": bbox.x0} + title_encode_enter_obj["y"] = {"value": fig.bbox.height - bbox.y1} + title_encode_enter_obj["linebreak"] = {"value": "\n"} + title_text_mark = { + "type": "text", + "encode": {"enter": title_encode_enter_obj}, + "zindex": ax.title.properties()["zorder"], + } + return title_text_mark + + def create_group_mark( fig: Figure, ax: Axes, @@ -356,6 +380,8 @@ def create_viewconfig( if len(viewconfig["marks"]) != ax_index: raise ValueError("It seems like you are missing part of the viewconfig.") group_mark = create_group_mark(fig, ax, scales, axis_array, marks_array, legend_array) + if title_text_mark := create_subtitle_config(fig, ax): + group_mark["marks"].append(title_text_mark) viewconfig["marks"].append(group_mark) return viewconfig diff --git a/src/spatialdata_plot/_viewconfig/misc.py b/src/spatialdata_plot/_viewconfig/misc.py index ac6ff222..f0c1bc19 100644 --- a/src/spatialdata_plot/_viewconfig/misc.py +++ b/src/spatialdata_plot/_viewconfig/misc.py @@ -15,6 +15,19 @@ def from_matplotlib(cls, alignment: str) -> str: return mapping.get(alignment, cls.CENTER).value +class VegaTextBaseline(Enum): + ALPHABETIC = "alphabetic" + TOP = "top" + MIDDLE = "middle" + BOTTOM = "bottom" + + @classmethod + def from_matplotlib(cls, alignment: str) -> str: + """Convert Matplotlib horizontal alignment to Vega alignment.""" + mapping = {"baseline": cls.ALPHABETIC, "top": cls.TOP, "center": cls.MIDDLE, "bottom": cls.BOTTOM} + return mapping.get(alignment, cls.MIDDLE).value + + def _count_trailing(num: float) -> int | None: str_num = str(num) if "." in str_num: diff --git a/tests/_figures_viewconfig/Images_can_do_rasterization.json b/tests/_figures_viewconfig/Images_can_do_rasterization.json index bf3df851..bff641e5 100644 --- a/tests/_figures_viewconfig/Images_can_do_rasterization.json +++ b/tests/_figures_viewconfig/Images_can_do_rasterization.json @@ -1,167 +1,162 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "310f27ee-6454-459b-8f5e-4e16b623c0e0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "c1ad6e92-bdb2-4bb4-bd65-caf36ff21609", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_giant_image_83d630c4-742c-4760-8689-cfc36982f767", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_giant_image_3d54d789-b359-4cdc-b0f9-6b61bcf55472", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "310f27ee-6454-459b-8f5e-4e16b623c0e0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_image" }, - "source": "c1ad6e92-bdb2-4bb4-bd65-caf36ff21609", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_giant_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 3072.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [3072.0, 0.0], - "range": "height" - }, - { - "name": "color_6d9c9f78-afec-41c8-859b-c862bdf16bf8", - "type": "linear", - "domain": { - "data": "blobs_giant_image_3d54d789-b359-4cdc-b0f9-6b61bcf55472", - "field": "value" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_channel", + "expr": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 1000, 2000, 3000], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_479b979e-0b64-4446-a073-f289ec0964e1", + "type": "linear", + "domain": { + "data": "blobs_giant_image_83d630c4-742c-4760-8689-cfc36982f767", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500, 1000, 1500, 2000, 2500, 3000], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_giant_image_3d54d789-b359-4cdc-b0f9-6b61bcf55472" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_6d9c9f78-afec-41c8-859b-c862bdf16bf8", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_giant_image_83d630c4-742c-4760-8689-cfc36982f767" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_479b979e-0b64-4446-a073-f289ec0964e1", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "e228fd3a-5d97-5b42-932a-14df5ad2275b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap.json b/tests/_figures_viewconfig/Images_can_pass_cmap.json new file mode 100644 index 00000000..3f565a00 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_cmap.json @@ -0,0 +1,162 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "30b4723b-6fdd-47a0-ada8-02c234753830", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_2c487a3f-2f46-4885-905c-ddfe5987f64d", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "30b4723b-6fdd-47a0-ada8-02c234753830", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_bd3c8928-d083-43cb-8670-0e5b916f4cc9", + "type": "linear", + "domain": { + "data": "blobs_image_2c487a3f-2f46-4885-905c-ddfe5987f64d", + "field": "value" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_2c487a3f-2f46-4885-905c-ddfe5987f64d" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_bd3c8928-d083-43cb-8670-0e5b916f4cc9", + "value": "value" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_list.json b/tests/_figures_viewconfig/Images_can_pass_cmap_list.json new file mode 100644 index 00000000..463a3ca9 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_list.json @@ -0,0 +1,194 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a519d139-5392-47b9-aff5-079685d4568e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_41c16b24-ac13-41c6-888c-2e9c92855e0e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "a519d139-5392-47b9-aff5-079685d4568e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_2a75c363-1747-49a9-9687-8cca885df3ae", + "type": "linear", + "domain": { + "data": "blobs_image_41c16b24-ac13-41c6-888c-2e9c92855e0e", + "field": "channel_0" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + }, + { + "name": "color_fd4dddce-e36e-4f74-818a-2e75410b35c9", + "type": "linear", + "domain": { + "data": "blobs_image_41c16b24-ac13-41c6-888c-2e9c92855e0e", + "field": "channel_1" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "name": "color_3431d881-65e8-4f30-afe2-a376ed765ec3", + "type": "linear", + "domain": { + "data": "blobs_image_41c16b24-ac13-41c6-888c-2e9c92855e0e", + "field": "channel_2" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_41c16b24-ac13-41c6-888c-2e9c92855e0e" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_2a75c363-1747-49a9-9687-8cca885df3ae", + "field": "channel_0" + }, + { + "scale": "color_fd4dddce-e36e-4f74-818a-2e75410b35c9", + "field": "channel_1" + }, + { + "scale": "color_3431d881-65e8-4f30-afe2-a376ed765ec3", + "field": "channel_2" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json b/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json index f3bfb5a1..69c96565 100644 --- a/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.json @@ -1,199 +1,194 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5a0bb292-f260-4cbd-b3e0-47af4aba90ee", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "97d394a9-4c4a-4189-9318-0fecc7b541a8", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_4b0bddae-3ec9-47e8-b8b2-6347a616addb", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "5a0bb292-f260-4cbd-b3e0-47af4aba90ee", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "97d394a9-4c4a-4189-9318-0fecc7b541a8", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0, 1, 2] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_dbd18e2b-50e8-4bca-ac4f-33d26f0f99a1", - "type": "linear", - "domain": { - "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", - "field": "channel_0" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "Reds", - "count": 256 - } - }, - { - "name": "color_0b6ba62b-3241-463f-b2b1-cbed9271e421", - "type": "linear", - "domain": { - "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", - "field": "channel_1" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "Greens", - "count": 256 + { + "type": "filter_channel", + "expr": [0, 1, 2] } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_92ab80f1-bed8-4fbc-89b5-577a017537dd", + "type": "linear", + "domain": { + "data": "blobs_image_4b0bddae-3ec9-47e8-b8b2-6347a616addb", + "field": "channel_0" }, - { - "name": "color_94b0271e-0e6e-4e16-b6f4-3e9f71661875", - "type": "linear", - "domain": { - "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a", - "field": "channel_2" - }, - "range": { - "scheme": "Blues", - "count": 256 - } + "range": { + "scheme": "Reds", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_29e1b005-ce0b-43ea-a493-5d9ebd2932db", + "type": "linear", + "domain": { + "data": "blobs_image_4b0bddae-3ec9-47e8-b8b2-6347a616addb", + "field": "channel_1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "Greens", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_06772d4a-ba12-4951-99ef-f3a10771de9a" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 + }, + { + "name": "color_5f9f8ab3-fef5-4769-8234-9cc992ada633", + "type": "linear", + "domain": { + "data": "blobs_image_4b0bddae-3ec9-47e8-b8b2-6347a616addb", + "field": "channel_2" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_4b0bddae-3ec9-47e8-b8b2-6347a616addb" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_92ab80f1-bed8-4fbc-89b5-577a017537dd", + "field": "channel_0" + }, + { + "scale": "color_29e1b005-ce0b-43ea-a493-5d9ebd2932db", + "field": "channel_1" }, - "fill": [ - { - "scale": "color_dbd18e2b-50e8-4bca-ac4f-33d26f0f99a1", - "field": "channel_0" - }, - { - "scale": "color_0b6ba62b-3241-463f-b2b1-cbed9271e421", - "field": "channel_1" - }, - { - "scale": "color_94b0271e-0e6e-4e16-b6f4-3e9f71661875", - "field": "channel_2" - } - ] - } + { + "scale": "color_5f9f8ab3-fef5-4769-8234-9cc992ada633", + "field": "channel_2" + } + ] } } - ], - "usermeta": { - "axis_uuid": "f8fdd4b4-7e46-53cd-9e67-f9acbf3b2ebd" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json b/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json index 63c7c151..273e4060 100644 --- a/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_to_single_channel.json @@ -1,192 +1,187 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1cfd0773-9e4b-4648-873b-dc2de16dac79", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "0e5176f6-5eef-495a-b667-f32d27eaccab", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_69c900bf-5fb9-49d9-beeb-ec427033c897", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_e6c332dc-cac7-4f17-8304-fefcf3fc35b2", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "1cfd0773-9e4b-4648-873b-dc2de16dac79", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "0e5176f6-5eef-495a-b667-f32d27eaccab", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [1] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_921b657b-6ea4-4364-bd48-7b0e508c9b60", - "type": "linear", - "domain": { - "data": "blobs_image_e6c332dc-cac7-4f17-8304-fefcf3fc35b2", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "Reds", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [1] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_2b265a69-5444-4a45-8c48-58992831d857", + "type": "linear", + "domain": { + "data": "blobs_image_69c900bf-5fb9-49d9-beeb-ec427033c897", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "Reds", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_921b657b-6ea4-4364-bd48-7b0e508c9b60", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_e6c332dc-cac7-4f17-8304-fefcf3fc35b2" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_921b657b-6ea4-4364-bd48-7b0e508c9b60", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_2b265a69-5444-4a45-8c48-58992831d857", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_69c900bf-5fb9-49d9-beeb-ec427033c897" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_2b265a69-5444-4a45-8c48-58992831d857", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "e0a1c378-6efe-5c05-b1a7-41fdecfb89f5" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json b/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json index 186746a2..114172ba 100644 --- a/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.json @@ -1,199 +1,194 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e3ed7e3d-c431-401e-9016-96758d66ed26", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "3ef5fc74-d8bf-4ac2-afa7-ff06c5419866", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_630d6c03-37fc-4649-aaaf-d3d3e3a76ad7", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "e3ed7e3d-c431-401e-9016-96758d66ed26", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "3ef5fc74-d8bf-4ac2-afa7-ff06c5419866", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0, 1, 2] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_624da7f3-22b5-474c-a8be-5e96e7ecfe55", - "type": "linear", - "domain": { - "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", - "field": "channel_0" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "red", - "count": 256 - } - }, - { - "name": "color_51f4f3eb-05aa-424b-958b-70f9b01bad8e", - "type": "linear", - "domain": { - "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", - "field": "channel_1" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "green", - "count": 256 + { + "type": "filter_channel", + "expr": [0, 1, 2] } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_b081d115-aff5-4522-80ed-08e136a620aa", + "type": "linear", + "domain": { + "data": "blobs_image_630d6c03-37fc-4649-aaaf-d3d3e3a76ad7", + "field": "channel_0" }, - { - "name": "color_39e05901-104c-42a0-bd8d-af16385852df", - "type": "linear", - "domain": { - "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee", - "field": "channel_2" - }, - "range": { - "scheme": "blue", - "count": 256 - } + "range": { + "scheme": "red", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_a3f8b7d7-7e9e-48aa-b998-e6e6f15da4bf", + "type": "linear", + "domain": { + "data": "blobs_image_630d6c03-37fc-4649-aaaf-d3d3e3a76ad7", + "field": "channel_1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "green", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_21b60667-3779-4533-a5a2-d08d5d3d85ee" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 + }, + { + "name": "color_fc2bb56c-d9f6-4903-b421-e884d7ccf4b9", + "type": "linear", + "domain": { + "data": "blobs_image_630d6c03-37fc-4649-aaaf-d3d3e3a76ad7", + "field": "channel_2" + }, + "range": { + "scheme": "blue", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_630d6c03-37fc-4649-aaaf-d3d3e3a76ad7" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_b081d115-aff5-4522-80ed-08e136a620aa", + "field": "channel_0" + }, + { + "scale": "color_a3f8b7d7-7e9e-48aa-b998-e6e6f15da4bf", + "field": "channel_1" }, - "fill": [ - { - "scale": "color_624da7f3-22b5-474c-a8be-5e96e7ecfe55", - "field": "channel_0" - }, - { - "scale": "color_51f4f3eb-05aa-424b-958b-70f9b01bad8e", - "field": "channel_1" - }, - { - "scale": "color_39e05901-104c-42a0-bd8d-af16385852df", - "field": "channel_2" - } - ] - } + { + "scale": "color_fc2bb56c-d9f6-4903-b421-e884d7ccf4b9", + "field": "channel_2" + } + ] } } - ], - "usermeta": { - "axis_uuid": "6fd40027-90c5-5ebf-82f6-539e62ff78f6" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json b/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json index c574ade0..1f3a2dc3 100644 --- a/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json +++ b/tests/_figures_viewconfig/Images_can_pass_color_to_single_channel.json @@ -1,192 +1,187 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5e7d03da-0619-4b9e-8f37-74ebcb652893", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "edf683b1-b910-4334-a7c5-b91163e5b92a", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_f9ebf8a6-4d3b-4553-92b2-f44e92c411cd", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_3d099333-2c05-47ee-a6aa-a9ba6ea0e5af", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "5e7d03da-0619-4b9e-8f37-74ebcb652893", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "edf683b1-b910-4334-a7c5-b91163e5b92a", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [1] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_16c33042-b157-4b60-b7b6-09c46f27ab9c", - "type": "linear", - "domain": { - "data": "blobs_image_3d099333-2c05-47ee-a6aa-a9ba6ea0e5af", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "red", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [1] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_cd39d565-2502-48df-b81d-25f612e96a8e", + "type": "linear", + "domain": { + "data": "blobs_image_f9ebf8a6-4d3b-4553-92b2-f44e92c411cd", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "red", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_16c33042-b157-4b60-b7b6-09c46f27ab9c", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_3d099333-2c05-47ee-a6aa-a9ba6ea0e5af" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_16c33042-b157-4b60-b7b6-09c46f27ab9c", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_cd39d565-2502-48df-b81d-25f612e96a8e", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_f9ebf8a6-4d3b-4553-92b2-f44e92c411cd" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_cd39d565-2502-48df-b81d-25f612e96a8e", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "b6b7d383-d94d-5a35-8720-95970716d062" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json index ea95e08c..99f67c6e 100644 --- a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_False.json @@ -1,197 +1,192 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c3a00559-2577-4250-94d9-4dc536170140", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "60539284-ba6e-4636-9d35-c6910572947c", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_e36aa1bf-ab1d-4d46-8aeb-1369e1380772", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_98572d7a-7431-41d7-b9a1-70774003b905", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "c3a00559-2577-4250-94d9-4dc536170140", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "60539284-ba6e-4636-9d35-c6910572947c", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0] - }, - { - "type": "formula", - "expr": "(datum.value - 0.1) / (0.5 - 0.1)", - "as": "21f2454f-f780-4162-baec-ef4ab4287677" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_bdb2b8ed-5cd9-4862-867e-bdb17ee88734", - "type": "linear", - "domain": { - "data": "21f2454f-f780-4162-baec-ef4ab4287677", - "field": "value" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 0.1) / (0.5 - 0.1)", + "as": "8d7ccef3-8b28-4588-92bb-afdf8e57a5e9" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_6f821057-af51-4881-88e8-0580ef744f2d", + "type": "linear", + "domain": { + "data": "8d7ccef3-8b28-4588-92bb-afdf8e57a5e9", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_bdb2b8ed-5cd9-4862-867e-bdb17ee88734", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.1, 0.2, 0.3, 0.4, 0.5], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "21f2454f-f780-4162-baec-ef4ab4287677" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_bdb2b8ed-5cd9-4862-867e-bdb17ee88734", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_6f821057-af51-4881-88e8-0580ef744f2d", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.1, 0.2, 0.3, 0.4, 0.5], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "8d7ccef3-8b28-4588-92bb-afdf8e57a5e9" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_6f821057-af51-4881-88e8-0580ef744f2d", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "56385cf7-daed-5bc2-86c4-841d9c8ce841" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json index 24e8143d..ba8e48bb 100644 --- a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_True.json @@ -1,197 +1,192 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d860d8a5-5790-4ef1-aa6c-175850621d3e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "be82ba36-7d40-4997-bbcb-dbcae87e94a8", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_6fc8439c-15a9-4e9a-a30e-301b3646c6c7", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_fafdb666-41bf-4659-97f0-d14c74034549", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "d860d8a5-5790-4ef1-aa6c-175850621d3e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "be82ba36-7d40-4997-bbcb-dbcae87e94a8", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0] - }, - { - "type": "formula", - "expr": "clamp((datum.value - 0.1) / (0.5 - 0.1), 0, 1)", - "as": "f60c47f4-8240-4bb7-9de3-dd8278c24a7d" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_1d487bca-ac88-48a0-901d-b60eb5aa9d4e", - "type": "linear", - "domain": { - "data": "f60c47f4-8240-4bb7-9de3-dd8278c24a7d", - "field": "value" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 0.1) / (0.5 - 0.1), 0, 1)", + "as": "efb5b22f-9657-462f-bca2-5764b6ae6693" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_ec43668d-7a17-4a52-b9b2-8a486d89ecf6", + "type": "linear", + "domain": { + "data": "efb5b22f-9657-462f-bca2-5764b6ae6693", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_1d487bca-ac88-48a0-901d-b60eb5aa9d4e", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.1, 0.2, 0.3, 0.4, 0.5], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "f60c47f4-8240-4bb7-9de3-dd8278c24a7d" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_1d487bca-ac88-48a0-901d-b60eb5aa9d4e", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_ec43668d-7a17-4a52-b9b2-8a486d89ecf6", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.1, 0.2, 0.3, 0.4, 0.5], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "efb5b22f-9657-462f-bca2-5764b6ae6693" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_ec43668d-7a17-4a52-b9b2-8a486d89ecf6", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "81610a8c-0de9-53d5-82b1-280052035603" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json index a0d3b81d..58da2fc3 100644 --- a/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.json @@ -1,204 +1,199 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3913eefe-b116-4c2e-bfb6-d7d336be7624", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "24df284f-a11d-4340-a143-2b5cf233a298", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_0910ac60-0a75-4ed7-b471-14c74b68e318", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_a20c7fe3-8480-45ab-8fd4-21773ccb688a", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "3913eefe-b116-4c2e-bfb6-d7d336be7624", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "24df284f-a11d-4340-a143-2b5cf233a298", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - }, - { - "type": "formula", - "expr": "clamp((datum.value - 0.0) / (0.4 - 0.0), 0, 1)", - "as": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_3a788edc-90f7-4165-8f32-9ef4fea44fb3", - "type": "linear", - "domain": { - "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73", - "field": "channel_0" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "seismic", - "count": 256 - } - }, - { - "name": "color_f3dcaaa5-34f5-45c1-83ff-6de3bb979044", - "type": "linear", - "domain": { - "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73", - "field": "channel_1" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "Reds", - "count": 256 - } - }, - { - "name": "color_4bc87e63-19d4-4b1b-9de4-d3deb8cbceaa", - "type": "linear", - "domain": { - "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73", - "field": "channel_2" + { + "type": "filter_channel", + "expr": null }, - "range": { - "scheme": "Blues", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 0.0) / (0.4 - 0.0), 0, 1)", + "as": "281ad89d-ff5e-45b1-8871-69a330bc5b0a" } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_015dec18-7fc0-41a0-b5c4-822fdd5e09e0", + "type": "linear", + "domain": { + "data": "281ad89d-ff5e-45b1-8871-69a330bc5b0a", + "field": "channel_0" + }, + "range": { + "scheme": "seismic", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_55ff1948-3d0d-4303-a66f-622a691cb1f7", + "type": "linear", + "domain": { + "data": "281ad89d-ff5e-45b1-8871-69a330bc5b0a", + "field": "channel_1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "Reds", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "eec38c7c-3a6e-4c5c-a674-8d38ca62bf73" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 + }, + { + "name": "color_b4ebab40-e949-49c4-9b3b-2538c6c1ba68", + "type": "linear", + "domain": { + "data": "281ad89d-ff5e-45b1-8871-69a330bc5b0a", + "field": "channel_2" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "281ad89d-ff5e-45b1-8871-69a330bc5b0a" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_015dec18-7fc0-41a0-b5c4-822fdd5e09e0", + "field": "channel_0" + }, + { + "scale": "color_55ff1948-3d0d-4303-a66f-622a691cb1f7", + "field": "channel_1" }, - "fill": [ - { - "scale": "color_3a788edc-90f7-4165-8f32-9ef4fea44fb3", - "field": "channel_0" - }, - { - "scale": "color_f3dcaaa5-34f5-45c1-83ff-6de3bb979044", - "field": "channel_1" - }, - { - "scale": "color_4bc87e63-19d4-4b1b-9de4-d3deb8cbceaa", - "field": "channel_2" - } - ] - } + { + "scale": "color_b4ebab40-e949-49c4-9b3b-2538c6c1ba68", + "field": "channel_2" + } + ] } } - ], - "usermeta": { - "axis_uuid": "3c9ffcd5-4dd7-5958-b857-40807b961040" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_str_cmap.json b/tests/_figures_viewconfig/Images_can_pass_str_cmap.json new file mode 100644 index 00000000..921f4892 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_str_cmap.json @@ -0,0 +1,162 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cc751d12-3acf-4dce-9d86-f9acc839b7e4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_b0eb61d1-6a68-4eae-95a4-f932d38aceb8", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "cc751d12-3acf-4dce-9d86-f9acc839b7e4", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_7af2ffd9-b145-4b82-9998-7f745c0220ee", + "type": "linear", + "domain": { + "data": "blobs_image_b0eb61d1-6a68-4eae-95a4-f932d38aceb8", + "field": "value" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_b0eb61d1-6a68-4eae-95a4-f932d38aceb8" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_7af2ffd9-b145-4b82-9998-7f745c0220ee", + "value": "value" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json b/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json new file mode 100644 index 00000000..e50df4ee --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_str_cmap_list.json @@ -0,0 +1,194 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "89b3fc99-ebd9-4498-886f-b318cd660b57", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_0c014e37-b257-49cf-9a55-d701fdb77b96", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "89b3fc99-ebd9-4498-886f-b318cd660b57", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_5d9a1b9e-f59f-4804-a739-d996a34a9ee3", + "type": "linear", + "domain": { + "data": "blobs_image_0c014e37-b257-49cf-9a55-d701fdb77b96", + "field": "channel_0" + }, + "range": { + "scheme": "seismic", + "count": 256 + } + }, + { + "name": "color_ea5038c8-5eea-49c4-9415-a1a11fd1f47e", + "type": "linear", + "domain": { + "data": "blobs_image_0c014e37-b257-49cf-9a55-d701fdb77b96", + "field": "channel_1" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "name": "color_a606ee59-7a0a-429c-9631-0ee3c6ad2ccd", + "type": "linear", + "domain": { + "data": "blobs_image_0c014e37-b257-49cf-9a55-d701fdb77b96", + "field": "channel_2" + }, + "range": { + "scheme": "Blues", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_0c014e37-b257-49cf-9a55-d701fdb77b96" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_5d9a1b9e-f59f-4804-a739-d996a34a9ee3", + "field": "channel_0" + }, + { + "scale": "color_ea5038c8-5eea-49c4-9415-a1a11fd1f47e", + "field": "channel_1" + }, + { + "scale": "color_a606ee59-7a0a-429c-9631-0ee3c6ad2ccd", + "field": "channel_2" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json index b036a600..492d42cd 100644 --- a/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.json @@ -1,192 +1,187 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "8b73b613-7de4-4b66-99e8-adf8495fe2f9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "56f04217-b689-4274-b500-dec7befb106f", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250415" - } + { + "name": "blobs_image_c9157b68-6ffc-499d-8129-cf64c4208f10", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_ad47c090-252a-4f3c-b58a-1e254a77d795", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "8b73b613-7de4-4b66-99e8-adf8495fe2f9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "56f04217-b689-4274-b500-dec7befb106f", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_952f733c-56fb-4144-b086-ad7896b637b8", - "type": "linear", - "domain": { - "data": "blobs_image_ad47c090-252a-4f3c-b58a-1e254a77d795", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_da1920b3-21fc-4831-9c25-759322e747ba", + "type": "linear", + "domain": { + "data": "blobs_image_c9157b68-6ffc-499d-8129-cf64c4208f10", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_952f733c-56fb-4144-b086-ad7896b637b8", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_ad47c090-252a-4f3c-b58a-1e254a77d795" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_952f733c-56fb-4144-b086-ad7896b637b8", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_da1920b3-21fc-4831-9c25-759322e747ba", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_c9157b68-6ffc-499d-8129-cf64c4208f10" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_da1920b3-21fc-4831-9c25-759322e747ba", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "08ff015c-efa0-5c98-8aa4-20aee18dfc48" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json index 72c25b17..d067307f 100644 --- a/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.json @@ -1,192 +1,187 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "18c56ea6-26db-471f-a90d-f4f7c1160496", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "4111627c-32ef-4490-8fdf-a6db626fc25c", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250415" - } + { + "name": "blobs_multiscale_image_05c6ea95-9022-4098-9cc0-15e00818271e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_image_5fb765e6-aef3-413c-b3e7-339fb6220260", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "18c56ea6-26db-471f-a90d-f4f7c1160496", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" }, - "source": "4111627c-32ef-4490-8fdf-a6db626fc25c", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_45a5c423-6a0f-4775-9615-c0d8665eded8", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_5fb765e6-aef3-413c-b3e7-339fb6220260", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [0] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_0b446852-de5c-4f0b-a174-25fbad30ca8f", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_05c6ea95-9022-4098-9cc0-15e00818271e", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_45a5c423-6a0f-4775-9615-c0d8665eded8", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_5fb765e6-aef3-413c-b3e7-339fb6220260" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_45a5c423-6a0f-4775-9615-c0d8665eded8", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_0b446852-de5c-4f0b-a174-25fbad30ca8f", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_05c6ea95-9022-4098-9cc0-15e00818271e" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_0b446852-de5c-4f0b-a174-25fbad30ca8f", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "b5af35e4-2361-557d-a263-4c538a77447f" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json index 673393f3..223ebf0d 100644 --- a/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.json @@ -1,192 +1,187 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "825b16c6-6b89-4091-8809-5b6823c66348", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "580417c8-67c0-4c50-9780-d3ec398a7c26", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250415" - } + { + "name": "blobs_image_bb84f6ff-822e-49ee-88f3-1a3460d879df", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_6fe528cc-687c-460f-a9ac-cfb7fa3ccf5f", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "825b16c6-6b89-4091-8809-5b6823c66348", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "580417c8-67c0-4c50-9780-d3ec398a7c26", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": ["c1"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_c6083c03-ba40-4f9c-bb82-b65e988612b7", - "type": "linear", - "domain": { - "data": "blobs_image_6fe528cc-687c-460f-a9ac-cfb7fa3ccf5f", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": ["c1"] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_1cc6a24e-19e0-4056-aedf-2deae948a3eb", + "type": "linear", + "domain": { + "data": "blobs_image_bb84f6ff-822e-49ee-88f3-1a3460d879df", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_c6083c03-ba40-4f9c-bb82-b65e988612b7", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_6fe528cc-687c-460f-a9ac-cfb7fa3ccf5f" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_c6083c03-ba40-4f9c-bb82-b65e988612b7", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_1cc6a24e-19e0-4056-aedf-2deae948a3eb", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_bb84f6ff-822e-49ee-88f3-1a3460d879df" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_1cc6a24e-19e0-4056-aedf-2deae948a3eb", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "42157cf8-172c-5e67-85b5-66b15e34a28e" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json index 56a806cc..1952e7d6 100644 --- a/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.json @@ -1,192 +1,187 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "73169fe4-42d5-4031-a2cf-1e91891796c3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "90247fcc-e145-4dbd-b8f3-4eb9441939a6", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250415" - } + { + "name": "blobs_multiscale_image_bfc72005-530b-4856-8326-6a217664011a", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_image_bbf7976f-d89c-4101-9732-565128c50627", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "73169fe4-42d5-4031-a2cf-1e91891796c3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" }, - "source": "90247fcc-e145-4dbd-b8f3-4eb9441939a6", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": ["c1"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_21c6fe86-5eb2-4875-bea4-0102c1a8fe6b", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_bbf7976f-d89c-4101-9732-565128c50627", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": ["c1"] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_7b255ff1-7bbb-419d-96ff-3adc33c5d784", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_bfc72005-530b-4856-8326-6a217664011a", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_21c6fe86-5eb2-4875-bea4-0102c1a8fe6b", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1.0, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_bbf7976f-d89c-4101-9732-565128c50627" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_21c6fe86-5eb2-4875-bea4-0102c1a8fe6b", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_7b255ff1-7bbb-419d-96ff-3adc33c5d784", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_bfc72005-530b-4856-8326-6a217664011a" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_7b255ff1-7bbb-419d-96ff-3adc33c5d784", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "c2f924ac-65f6-5229-a7d9-e56fdbdf4f8d" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json index a284d677..e0b952c9 100644 --- a/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_image.json @@ -1,167 +1,162 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "26e46eea-c230-4ec1-b66d-4c9087f07a5e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "ac722766-e035-48d5-a1bf-cfb7de29f323", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multiscale_image_cbc68b20-0373-4e7e-b03b-021f929292e6", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_image_bb82d5c7-2729-404d-8ad2-bd5f3dd864eb", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "26e46eea-c230-4ec1-b66d-4c9087f07a5e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" }, - "source": "ac722766-e035-48d5-a1bf-cfb7de29f323", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "scale2" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_352b28a7-4da1-4403-a632-c4d38cce1f49", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_bb82d5c7-2729-404d-8ad2-bd5f3dd864eb", - "field": "value" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale2" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_channel", + "expr": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_6bbd2fcc-2048-41e5-8f94-5a82261da007", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_cbc68b20-0373-4e7e-b03b-021f929292e6", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_bb82d5c7-2729-404d-8ad2-bd5f3dd864eb" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_352b28a7-4da1-4403-a632-c4d38cce1f49", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_cbc68b20-0373-4e7e-b03b-021f929292e6" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_6bbd2fcc-2048-41e5-8f94-5a82261da007", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "b8525270-3b08-5ee5-a0da-211736cdcd92" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_image.json b/tests/_figures_viewconfig/Images_can_render_image.json new file mode 100644 index 00000000..ca349be2 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_image.json @@ -0,0 +1,162 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "bc697316-1f4f-4852-95dd-2ebcc36a5a7b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_ba193f43-8eb8-4ab0-99c0-283719f658a4", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "bc697316-1f4f-4852-95dd-2ebcc36a5a7b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_10c9c707-f3e1-4273-be00-49ad57c44da9", + "type": "linear", + "domain": { + "data": "blobs_image_ba193f43-8eb8-4ab0-99c0-283719f658a4", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_ba193f43-8eb8-4ab0-99c0-283719f658a4" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_10c9c707-f3e1-4273-be00-49ad57c44da9", + "value": "value" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_multiscale_image.json index 9d41083e..3a0b4d80 100644 --- a/tests/_figures_viewconfig/Images_can_render_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_multiscale_image.json @@ -1,167 +1,162 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fca0896d-55a1-4f0c-ae3d-30748c67aa9a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "8123869d-5833-4634-b023-7b83c0170371", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multiscale_image_75a801cf-b82f-443b-bfca-4917b3a4567b", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_image_a8fedc1c-a0c5-4123-8f44-3d0de94ddcb2", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "fca0896d-55a1-4f0c-ae3d-30748c67aa9a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" }, - "source": "8123869d-5833-4634-b023-7b83c0170371", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_6a308c45-a705-4432-aae9-e663b0fabc6a", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_a8fedc1c-a0c5-4123-8f44-3d0de94ddcb2", - "field": "value" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_channel", + "expr": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_b0792709-3fe3-447b-a882-af004a788e12", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_75a801cf-b82f-443b-bfca-4917b3a4567b", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_a8fedc1c-a0c5-4123-8f44-3d0de94ddcb2" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_6a308c45-a705-4432-aae9-e663b0fabc6a", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_75a801cf-b82f-443b-bfca-4917b3a4567b" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_b0792709-3fe3-447b-a882-af004a788e12", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "217f0086-2a6c-57bd-9902-e4482d0528d8" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json b/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json index c6a1d004..732dcce9 100644 --- a/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json +++ b/tests/_figures_viewconfig/Images_can_render_multiscale_image_with_custom_cmap.json @@ -1,192 +1,187 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "43ed4d7b-b39c-476f-b492-e29ab0b537e5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1f90f262-66a2-4d85-a5d0-43c136fa7771", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multiscale_image_22c88290-dd1f-47dd-9219-bcae514b2c5b", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_image_25adc079-ce67-4291-964e-842f7a5e2cc9", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "43ed4d7b-b39c-476f-b492-e29ab0b537e5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" }, - "source": "1f90f262-66a2-4d85-a5d0-43c136fa7771", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "scale2" - }, - { - "type": "filter_channel", - "expr": [0] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_ff95b421-d4c7-4630-a0e7-470734577891", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_25adc079-ce67-4291-964e-842f7a5e2cc9", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "Greys", - "count": 256 + { + "type": "filter_scale", + "expr": "scale2" + }, + { + "type": "filter_channel", + "expr": [0] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_95961a83-8b52-4225-bc77-d47b5c7db421", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_22c88290-dd1f-47dd-9219-bcae514b2c5b", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "Greys", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_ff95b421-d4c7-4630-a0e7-470734577891", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_25adc079-ce67-4291-964e-842f7a5e2cc9" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_ff95b421-d4c7-4630-a0e7-470734577891", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_95961a83-8b52-4225-bc77-d47b5c7db421", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_22c88290-dd1f-47dd-9219-bcae514b2c5b" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_95961a83-8b52-4225-bc77-d47b5c7db421", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "81be769f-7725-5c7a-b81b-93d7595e4428" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json index 35c2e340..17985c70 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json @@ -1,183 +1,178 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "52adc31c-ff3c-413a-9e1a-42f70abd463b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "33e11ade-b94f-46fe-988c-6c2797d42b63", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_58d4303d-cf92-4241-82f3-d4ff0c0de44f", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "52adc31c-ff3c-413a-9e1a-42f70abd463b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "33e11ade-b94f-46fe-988c-6c2797d42b63", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0, 1] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_6adfa8d8-d389-45e6-93d4-41316230ed41", - "type": "linear", - "domain": { - "data": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923", - "field": "channel_0" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "red", - "count": 256 - } - }, - { - "name": "color_d85ab719-b866-4cb7-9dbf-d740b7ea9972", - "type": "linear", - "domain": { - "data": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923", - "field": "channel_1" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "lime", - "count": 256 + { + "type": "filter_channel", + "expr": [0, 1] } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_474a59ad-5353-4979-b2a6-8b15235ea292", + "type": "linear", + "domain": { + "data": "blobs_image_58d4303d-cf92-4241-82f3-d4ff0c0de44f", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_7e710624-0e4d-4585-844b-4520a1760c27", + "type": "linear", + "domain": { + "data": "blobs_image_58d4303d-cf92-4241-82f3-d4ff0c0de44f", + "field": "channel_1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "lime", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_b4d75cdb-1184-4307-9cc3-df2d78d04923" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_58d4303d-cf92-4241-82f3-d4ff0c0de44f" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_474a59ad-5353-4979-b2a6-8b15235ea292", + "field": "channel_0" }, - "fill": [ - { - "scale": "color_6adfa8d8-d389-45e6-93d4-41316230ed41", - "field": "channel_0" - }, - { - "scale": "color_d85ab719-b866-4cb7-9dbf-d740b7ea9972", - "field": "channel_1" - } - ] - } + { + "scale": "color_7e710624-0e4d-4585-844b-4520a1760c27", + "field": "channel_1" + } + ] } } - ], - "usermeta": { - "axis_uuid": "248551f7-f962-5d91-a248-c48417951257" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json index c49b8ef6..45830102 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json @@ -1,183 +1,178 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "b25cb110-4d88-47d4-af39-2216bc347dbf", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "0a5f8a39-9cc7-4bf4-961a-7c7fe446250a", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multiscale_image_969bab36-b421-43df-bf58-530489006d0e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "b25cb110-4d88-47d4-af39-2216bc347dbf", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" }, - "source": "0a5f8a39-9cc7-4bf4-961a-7c7fe446250a", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0, 1] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_be7b064a-e871-48fc-8381-d7df2b82b594", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae", - "field": "channel_0" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "red", - "count": 256 - } - }, - { - "name": "color_4d70686d-2919-45e5-a58a-19e1640eca46", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae", - "field": "channel_1" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "lime", - "count": 256 + { + "type": "filter_channel", + "expr": [0, 1] } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_aeeb9789-8ff3-4d7e-be0f-7f27c368cc3d", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_969bab36-b421-43df-bf58-530489006d0e", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_81b34f18-602d-43b7-9dd0-75fe46fafbcd", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_969bab36-b421-43df-bf58-530489006d0e", + "field": "channel_1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "lime", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_2c4159f6-979e-4661-894d-2ddba587c8ae" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_969bab36-b421-43df-bf58-530489006d0e" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_aeeb9789-8ff3-4d7e-be0f-7f27c368cc3d", + "field": "channel_0" }, - "fill": [ - { - "scale": "color_be7b064a-e871-48fc-8381-d7df2b82b594", - "field": "channel_0" - }, - { - "scale": "color_4d70686d-2919-45e5-a58a-19e1640eca46", - "field": "channel_1" - } - ] - } + { + "scale": "color_81b34f18-602d-43b7-9dd0-75fe46fafbcd", + "field": "channel_1" + } + ] } } - ], - "usermeta": { - "axis_uuid": "09662dc6-87eb-5032-ae3a-272fc72e428c" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json index 85939710..79b1f147 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json @@ -1,183 +1,178 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2bb8c9cf-3ede-4a75-a651-e2e4033cfe30", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f5f05acd-c163-4d7e-b606-bc6ab159c6a9", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_6a5ce105-d7f0-448e-b18e-6c466e40a3e4", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "2bb8c9cf-3ede-4a75-a651-e2e4033cfe30", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "f5f05acd-c163-4d7e-b606-bc6ab159c6a9", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": ["c1", "c2"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_519cef40-0b49-4e41-bd07-e68953d2a606", - "type": "linear", - "domain": { - "data": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f", - "field": "channel_0" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "red", - "count": 256 - } - }, - { - "name": "color_0ea95ef0-77e0-489b-b5c7-d70ac4f8a640", - "type": "linear", - "domain": { - "data": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f", - "field": "channel_1" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "lime", - "count": 256 + { + "type": "filter_channel", + "expr": ["c1", "c2"] } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_385e32f0-3036-44ad-bfe6-bc945f2e882b", + "type": "linear", + "domain": { + "data": "blobs_image_6a5ce105-d7f0-448e-b18e-6c466e40a3e4", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_35a9d003-2c62-4bd1-80d5-7f4e62a58b16", + "type": "linear", + "domain": { + "data": "blobs_image_6a5ce105-d7f0-448e-b18e-6c466e40a3e4", + "field": "channel_1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "lime", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_32b2e6e1-4f28-4174-aed5-2a689a69415f" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_6a5ce105-d7f0-448e-b18e-6c466e40a3e4" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_385e32f0-3036-44ad-bfe6-bc945f2e882b", + "field": "channel_0" }, - "fill": [ - { - "scale": "color_519cef40-0b49-4e41-bd07-e68953d2a606", - "field": "channel_0" - }, - { - "scale": "color_0ea95ef0-77e0-489b-b5c7-d70ac4f8a640", - "field": "channel_1" - } - ] - } + { + "scale": "color_35a9d003-2c62-4bd1-80d5-7f4e62a58b16", + "field": "channel_1" + } + ] } } - ], - "usermeta": { - "axis_uuid": "bb399d0e-2cb1-5a66-9491-7847121c50d1" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json index 73756c50..489377ff 100644 --- a/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json @@ -1,183 +1,178 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f656da23-df6a-4138-a077-a7387db7be53", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "2547d2aa-44a8-4022-a755-f656fcd94b7f", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multiscale_image_699e2f11-1b9a-4664-a024-4927881d0e82", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "f656da23-df6a-4138-a077-a7387db7be53", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" }, - "source": "2547d2aa-44a8-4022-a755-f656fcd94b7f", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": ["c1", "c2"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_049a6837-e6a2-4736-9ae3-73dec8664ba8", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855", - "field": "channel_0" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "red", - "count": 256 - } - }, - { - "name": "color_d98f460f-804b-4a55-8ec8-f70fc0e4e419", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855", - "field": "channel_1" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "lime", - "count": 256 + { + "type": "filter_channel", + "expr": ["c1", "c2"] } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_5c93128c-3760-4270-9bde-ce76042e0ec4", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_699e2f11-1b9a-4664-a024-4927881d0e82", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_2cf38f71-902c-4bfb-97c9-be49c9ef8037", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_699e2f11-1b9a-4664-a024-4927881d0e82", + "field": "channel_1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "lime", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_e687bad5-a08f-47b1-b546-ac186497d855" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_699e2f11-1b9a-4664-a024-4927881d0e82" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_5c93128c-3760-4270-9bde-ce76042e0ec4", + "field": "channel_0" }, - "fill": [ - { - "scale": "color_049a6837-e6a2-4736-9ae3-73dec8664ba8", - "field": "channel_0" - }, - { - "scale": "color_d98f460f-804b-4a55-8ec8-f70fc0e4e419", - "field": "channel_1" - } - ] - } + { + "scale": "color_2cf38f71-902c-4bfb-97c9-be49c9ef8037", + "field": "channel_1" + } + ] } } - ], - "usermeta": { - "axis_uuid": "e02813ac-4d6a-5ec4-80b3-0e83933bf9be" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_stack_render_images.json b/tests/_figures_viewconfig/Images_can_stack_render_images.json index 6c15a809..c714b15f 100644 --- a/tests/_figures_viewconfig/Images_can_stack_render_images.json +++ b/tests/_figures_viewconfig/Images_can_stack_render_images.json @@ -1,273 +1,268 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "914ee764-08a4-4ad7-8b63-3182de6d8b1c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "c63bccea-c1a9-4466-bc1e-463c2590916e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_image_fb9a125e-f992-4d8d-9398-72076c339a87", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_12f4a6c6-7a63-4027-b2f3-e8e4fa5f59ff", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "914ee764-08a4-4ad7-8b63-3182de6d8b1c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "c63bccea-c1a9-4466-bc1e-463c2590916e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [0] - } - ] - }, - { - "name": "blobs_image_f2913717-e85b-40e6-a477-0f1dec97f59e", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "c63bccea-c1a9-4466-bc1e-463c2590916e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": [1] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_b43632ce-2fe0-41e9-9c23-cc70984b4485", - "type": "linear", - "domain": { - "data": "blobs_image_12f4a6c6-7a63-4027-b2f3-e8e4fa5f59ff", - "field": "value" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "red", - "count": 256 + { + "type": "filter_channel", + "expr": [0] } + ] + }, + { + "name": "blobs_image_2dd09406-f795-418e-88d7-cb80a4bc0edc", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "color_04992f94-de7a-499b-b874-7a8ed552c258", - "type": "linear", - "domain": { - "data": "blobs_image_f2913717-e85b-40e6-a477-0f1dec97f59e", - "field": "value" + "source": "914ee764-08a4-4ad7-8b63-3182de6d8b1c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "blue", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": [1] } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_1eac3ec0-f7bf-4fa8-8194-9ba1fedfb91b", + "type": "linear", + "domain": { + "data": "blobs_image_fb9a125e-f992-4d8d-9398-72076c339a87", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + "range": { + "scheme": "red", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_b43632ce-2fe0-41e9-9c23-cc70984b4485", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 269.76, - "legendY": 22.80000000000001, - "zindex": 0 + }, + { + "name": "color_6778ee81-85e2-4a13-9da5-2dbcf226b2d3", + "type": "linear", + "domain": { + "data": "blobs_image_2dd09406-f795-418e-88d7-cb80a4bc0edc", + "field": "value" }, - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_04992f94-de7a-499b-b874-7a8ed552c258", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 12.16000000000001, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 227.32800000000003, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "blue", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_image_12f4a6c6-7a63-4027-b2f3-e8e4fa5f59ff" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 0.5 - }, - "fill": [ - { - "scale": "color_b43632ce-2fe0-41e9-9c23-cc70984b4485", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_1eac3ec0-f7bf-4fa8-8194-9ba1fedfb91b", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 269.76, + "legendY": 22.80000000000001, + "zindex": 0 + }, + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_6778ee81-85e2-4a13-9da5-2dbcf226b2d3", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 12.16000000000001, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 227.32800000000003, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_fb9a125e-f992-4d8d-9398-72076c339a87" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 0.5 + }, + "fill": [ + { + "scale": "color_1eac3ec0-f7bf-4fa8-8194-9ba1fedfb91b", + "value": "value" + } + ] } + } + }, + { + "type": "raster_image", + "from": { + "data": "blobs_image_2dd09406-f795-418e-88d7-cb80a4bc0edc" }, - { - "type": "raster_image", - "from": { - "data": "blobs_image_f2913717-e85b-40e6-a477-0f1dec97f59e" - }, - "zindex": 1, - "encode": { - "enter": { - "opacity": { - "value": 0.5 - }, - "fill": [ - { - "scale": "color_04992f94-de7a-499b-b874-7a8ed552c258", - "value": "value" - } - ] - } + "zindex": 1, + "encode": { + "enter": { + "opacity": { + "value": 0.5 + }, + "fill": [ + { + "scale": "color_6778ee81-85e2-4a13-9da5-2dbcf226b2d3", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "0710cb92-bc50-53e6-9b3c-30799e3f3214" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_stick_to_zorder.json b/tests/_figures_viewconfig/Images_can_stick_to_zorder.json index 4e55b013..866ccbbb 100644 --- a/tests/_figures_viewconfig/Images_can_stick_to_zorder.json +++ b/tests/_figures_viewconfig/Images_can_stick_to_zorder.json @@ -1,360 +1,355 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_187eae9c-2bdd-4d16-a4e5-be4f21be076b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_cf9bea02-83c7-4cbf-ab04-3b0fc03a0efe", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_d443aa65-ae23-4fa6-89ad-386f54c0e362", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_743fda8d-a7df-46ea-8e9e-b7b02166d0ee", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_728308be-d846-4ab0-a9e6-7842ba2f6b5c", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_multipolygons_81eb2fbb-e456-44d5-869a-27dc0b455333", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" }, - "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multipolygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_image_6da32144-7f97-4e3a-933f-d0e14d202be9", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_image_8fb8d079-09d7-4aec-95b5-2cf9d02054df", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" }, - "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - }, - { - "name": "blobs_multiscale_image_503495d1-1210-4584-a44f-df132a64b4a5", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "c44f74f8-f792-42b7-8c1d-38b250ce3c59", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_f58f3d5e-13c7-4b7f-8f79-d468e660538c", - "type": "linear", - "domain": { - "data": "blobs_image_8fb8d079-09d7-4aec-95b5-2cf9d02054df", - "field": "value" + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_channel", + "expr": null } + ] + }, + { + "name": "blobs_multiscale_image_2747caaa-a6f5-4b36-9da5-14a00e57d0a8", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "color_6a9ca815-465f-42a1-8cc7-dd4b00a97446", - "type": "linear", - "domain": { - "data": "blobs_multiscale_image_503495d1-1210-4584-a44f-df132a64b4a5", - "field": "value" + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_image" + }, + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_7cc8cbd4-1f81-4540-bf76-deae65d7d419", + "type": "linear", + "domain": { + "data": "blobs_image_6da32144-7f97-4e3a-933f-d0e14d202be9", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "name": "color_6e1ecf3c-e558-4319-bde0-dd4054b51883", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_2747caaa-a6f5-4b36-9da5-14a00e57d0a8", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_cf9bea02-83c7-4cbf-ab04-3b0fc03a0efe" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_187eae9c-2bdd-4d16-a4e5-be4f21be076b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_d443aa65-ae23-4fa6-89ad-386f54c0e362" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_743fda8d-a7df-46ea-8e9e-b7b02166d0ee" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_728308be-d846-4ab0-a9e6-7842ba2f6b5c" }, - { - "type": "path", - "from": { - "data": "blobs_multipolygons_81eb2fbb-e456-44d5-869a-27dc0b455333" - }, - "zindex": 2, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "raster_image", + "from": { + "data": "blobs_image_6da32144-7f97-4e3a-933f-d0e14d202be9" }, - { - "type": "raster_image", - "from": { - "data": "blobs_image_8fb8d079-09d7-4aec-95b5-2cf9d02054df" - }, - "zindex": 3, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_f58f3d5e-13c7-4b7f-8f79-d468e660538c", - "value": "value" - } - ] - } + "zindex": 3, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_7cc8cbd4-1f81-4540-bf76-deae65d7d419", + "value": "value" + } + ] } + } + }, + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_2747caaa-a6f5-4b36-9da5-14a00e57d0a8" }, - { - "type": "raster_image", - "from": { - "data": "blobs_multiscale_image_503495d1-1210-4584-a44f-df132a64b4a5" - }, - "zindex": 4, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_6a9ca815-465f-42a1-8cc7-dd4b00a97446", - "value": "value" - } - ] - } + "zindex": 4, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_6e1ecf3c-e558-4319-bde0-dd4054b51883", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "df82fb18-3c1a-5887-b764-365dcbdd9385" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json b/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json index 7e3ab231..be1df037 100644 --- a/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json +++ b/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.json @@ -1,167 +1,162 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2cdd9e63-38e2-4d06-a449-a236fb828aa3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "faf8d241-2f6c-4729-836b-c14028d22fd5", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_giant_image_00816b4e-df7d-401d-a590-623139665e4e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_giant_image_05bc1c72-d646-4974-8096-7abc3654e356", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "2cdd9e63-38e2-4d06-a449-a236fb828aa3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_image" }, - "source": "faf8d241-2f6c-4729-836b-c14028d22fd5", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_giant_image" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "filter_channel", - "expr": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 3072.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [3072.0, 0.0], - "range": "height" - }, - { - "name": "color_590e603a-b5e6-4896-8161-3b5cb4c7eec0", - "type": "linear", - "domain": { - "data": "blobs_giant_image_05bc1c72-d646-4974-8096-7abc3654e356", - "field": "value" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_channel", + "expr": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 1000, 2000, 3000], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_ec0ae51e-e677-467e-9268-93af907100f0", + "type": "linear", + "domain": { + "data": "blobs_giant_image_00816b4e-df7d-401d-a590-623139665e4e", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500, 1000, 1500, 2000, 2500, 3000], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_image", - "from": { - "data": "blobs_giant_image_05bc1c72-d646-4974-8096-7abc3654e356" - }, - "zindex": 0, - "encode": { - "enter": { - "opacity": { - "value": 1.0 - }, - "fill": [ - { - "scale": "color_590e603a-b5e6-4896-8161-3b5cb4c7eec0", - "value": "value" - } - ] - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_giant_image_00816b4e-df7d-401d-a590-623139665e4e" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_ec0ae51e-e677-467e-9268-93af907100f0", + "value": "value" + } + ] } } - ], - "usermeta": { - "axis_uuid": "8407b6de-1716-54b5-b48c-803732f4475c" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json b/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json index 2613f836..29efecc4 100644 --- a/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json +++ b/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json @@ -1,239 +1,234 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "508c0d93-5996-49a6-b67c-1f5992327e6e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f2273134-9c3e-48d1-86d5-f8518b6c4041", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "6d94b8ab-9478-48bd-943b-134755ffae6f", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "b4e16384-7d2c-470c-ad61-8e84c238efbf", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "508c0d93-5996-49a6-b67c-1f5992327e6e", + "transform": [ + { + "type": "filter_element", + "expr": "table" }, - "source": "f2273134-9c3e-48d1-86d5-f8518b6c4041", - "transform": [ - { - "type": "filter_element", - "expr": "table" - }, - { - "type": "filter_layer", - "expr": "normalized" - } - ] + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_labels_e2efe281-9f48-4f2d-aa63-ae4f7b872b9c", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_labels_7cc1f7c6-c0b0-4202-a96e-bb85890d0391", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "508c0d93-5996-49a6-b67c-1f5992327e6e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "f2273134-9c3e-48d1-86d5-f8518b6c4041", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "b4e16384-7d2c-470c-ad61-8e84c238efbf", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", - "type": "linear", - "domain": { - "data": "blobs_labels_7cc1f7c6-c0b0-4202-a96e-bb85890d0391", - "field": ["channel_0_sum"] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "6d94b8ab-9478-48bd-943b-134755ffae6f", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_813c1063-5d20-4cb5-a4e7-a2624c981c3c", + "type": "linear", + "domain": { + "data": "blobs_labels_e2efe281-9f48-4f2d-aa63-ae4f7b872b9c", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_7cc1f7c6-c0b0-4202-a96e-bb85890d0391" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_813c1063-5d20-4cb5-a4e7-a2624c981c3c", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_e2efe281-9f48-4f2d-aa63-ae4f7b872b9c" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_813c1063-5d20-4cb5-a4e7-a2624c981c3c", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_813c1063-5d20-4cb5-a4e7-a2624c981c3c", + "value": "channel_0_sum" } + ], + "fillOpacity": { + "value": 0.4 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_05d72bf6-5e72-4cc8-a904-a20b0adfaa42", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_813c1063-5d20-4cb5-a4e7-a2624c981c3c", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "8fdf06ac-1da2-596c-abf9-c6359bdee8b7" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json index 0aacc850..c1b10451 100644 --- a/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json @@ -1,229 +1,224 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0fefd8ec-6282-4244-ad12-df06477b3a01", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "a4ada884-5631-49dd-b4cc-687afa14d2b2", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "ab7e7fb8-5b60-412d-9c21-699402deac58", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "0fefd8ec-6282-4244-ad12-df06477b3a01", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_2e7ab542-5440-443b-9e26-90bfdf4ac2e2", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "7a7b68dd-3a01-44dd-a8b2-28db61cb7e50", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "0fefd8ec-6282-4244-ad12-df06477b3a01", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "a4ada884-5631-49dd-b4cc-687afa14d2b2", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_d0589e37-1c9c-4e19-bac3-dff60b01e634", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "a4ada884-5631-49dd-b4cc-687afa14d2b2", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "ab7e7fb8-5b60-412d-9c21-699402deac58", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_e246018a-8b16-4177-ac54-a6f98d4deaab", + "type": "ordinal", + "domain": ["channel_0_sum", "channel_1_sum", "channel_2_sum"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_e246018a-8b16-4177-ac54-a6f98d4deaab", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 174.96555555555554, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_2e7ab542-5440-443b-9e26-90bfdf4ac2e2" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_e246018a-8b16-4177-ac54-a6f98d4deaab", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_e246018a-8b16-4177-ac54-a6f98d4deaab", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 }, - { - "type": "filter_scale", - "expr": "full" + "strokeOpacity": { + "value": 0.0 }, - { - "type": "lookup", - "from": "7a7b68dd-3a01-44dd-a8b2-28db61cb7e50", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["which_max"], - "as": ["which_max"], - "default": null + "strokeWidth": { + "value": 3 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", - "type": "ordinal", - "domain": ["channel_0_sum", "channel_1_sum", "channel_2_sum"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 174.96555555555554, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_d0589e37-1c9c-4e19-bac3-dff60b01e634" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", - "value": "which_max" - } - ], - "fill": [ - { - "scale": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", - "value": "which_max" - } - ], - "fillOpacity": { - "value": 0.4 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_e246018a-8b16-4177-ac54-a6f98d4deaab", + "field": "which_max" }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + { + "value": "#d3d3d3ff" } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_c3de20ad-a11f-4d09-98d5-695f211afe14", - "field": "which_max" - }, - { - "value": "#d3d3d3ff" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "dc1798bd-77de-5815-8a44-7b4aaf44bac9" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json index 7dc59599..c2736bbb 100644 --- a/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json @@ -1,645 +1,657 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "ch_1_sum", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "data": [ + { + "name": "11a31e13-7858-42ff-b3c4-051a0a1a655a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "fe69e52f-3f3a-494d-8bc8-57d599f4b1c7", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "cbc860e1-af02-4325-95b1-2e998af6c672", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "11a31e13-7858-42ff-b3c4-051a0a1a655a", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" } + ] + }, + { + "name": "blobs_multiscale_labels_03be7290-3c7e-4e9d-b2ed-4a6deb5eab60", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "f9aeda1c-37ed-4723-bbf5-3f3a630d4a44", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "11a31e13-7858-42ff-b3c4-051a0a1a655a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" }, - "source": "fe69e52f-3f3a-494d-8bc8-57d599f4b1c7", - "transform": [ - { - "type": "filter_element", - "expr": "other_table" - } - ] - }, - { - "name": "blobs_multiscale_labels_0ece1786-4f0c-482f-8bdb-7af9c9cb7675", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale0" }, - "source": "fe69e52f-3f3a-494d-8bc8-57d599f4b1c7", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_labels" + { + "type": "lookup", + "from": "cbc860e1-af02-4325-95b1-2e998af6c672", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_1_sum"], + "as": ["channel_1_sum"], + "default": null + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 57.599999999999994 }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "value": 113.6941176470588 }, - { - "type": "filter_scale", - "expr": "scale0" + "width": { + "value": 73.41176470588236 }, - { - "type": "lookup", - "from": "f9aeda1c-37ed-4723-bbf5-3f3a630d4a44", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_1_sum"], - "as": ["channel_1_sum"], - "default": null + "height": { + "value": 73.41176470588238 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" + } }, - { - "name": "color_f57fa739-0dda-41b9-b678-84a435383d0d", - "type": "linear", - "domain": { - "data": "blobs_multiscale_labels_0ece1786-4f0c-482f-8bdb-7af9c9cb7675", - "field": ["channel_1_sum"] + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale_0", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "name": "color_1d0e960e-5e61-49b3-bfde-f2d15dc7d9f8", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_03be7290-3c7e-4e9d-b2ed-4a6deb5eab60", + "field": ["channel_1_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_multiscale_labels_0ece1786-4f0c-482f-8bdb-7af9c9cb7675" + ], + "axes": [ + { + "scale": "X_scale_0", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_f57fa739-0dda-41b9-b678-84a435383d0d", - "value": "channel_1_sum" - } - ], - "fill": [ - { - "scale": "color_f57fa739-0dda-41b9-b678-84a435383d0d", - "value": "channel_1_sum" + { + "scale": "Y_scale_0", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_03be7290-3c7e-4e9d-b2ed-4a6deb5eab60" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_1d0e960e-5e61-49b3-bfde-f2d15dc7d9f8", + "value": "channel_1_sum" + } + ], + "fill": [ + { + "scale": "color_1d0e960e-5e61-49b3-bfde-f2d15dc7d9f8", + "value": "channel_1_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } - ], - "fillOpacity": { - "value": 0.4 }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_1d0e960e-5e61-49b3-bfde-f2d15dc7d9f8", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_f57fa739-0dda-41b9-b678-84a435383d0d", - "field": "channel_1_sum" - }, - { - "value": "#d3d3d3ff" - } - ] } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "ch_1_sum" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 58.55588235294117 + }, + "y": { + "value": 95.02745098039216 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "d82988d1-e0be-5902-aed3-9f5eff5601b6" - } - }, - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 + ] }, - "title": { - "text": "ch_2_sum", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "37546081-a386-48c8-ba50-8520264fa1f9", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } - }, - { - "name": "59ccd34c-4481-49ef-9da6-f22ea236e423", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "37546081-a386-48c8-ba50-8520264fa1f9", - "transform": [ - { - "type": "filter_element", - "expr": "other_table" - } - ] - }, - { - "name": "blobs_multiscale_labels_065f128f-956c-4733-9316-a74a67660406", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "37546081-a386-48c8-ba50-8520264fa1f9", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_labels" + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 145.69411764705882 }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "value": 113.6941176470588 }, - { - "type": "filter_scale", - "expr": "scale0" + "width": { + "value": 73.41176470588232 }, - { - "type": "lookup", - "from": "59ccd34c-4481-49ef-9da6-f22ea236e423", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_2_sum"], - "as": ["channel_2_sum"], - "default": null + "height": { + "value": 73.41176470588235 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" + } }, - { - "name": "color_59bc380e-35b4-430f-bc4e-264958a7516b", - "type": "linear", - "domain": { - "data": "blobs_multiscale_labels_065f128f-956c-4733-9316-a74a67660406", - "field": ["channel_2_sum"] + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "name": "Y_scale_1", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_22521af9-1104-4fe0-8082-a03bed3a4a4b", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_41340935-62c3-480e-b9d2-908bd6043b63", + "field": ["channel_2_sum"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_multiscale_labels_065f128f-956c-4733-9316-a74a67660406" + ], + "axes": [ + { + "scale": "X_scale_1", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_59bc380e-35b4-430f-bc4e-264958a7516b", - "value": "channel_2_sum" - } - ], - "fill": [ - { - "scale": "color_59bc380e-35b4-430f-bc4e-264958a7516b", - "value": "channel_2_sum" + { + "scale": "Y_scale_1", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_41340935-62c3-480e-b9d2-908bd6043b63" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_22521af9-1104-4fe0-8082-a03bed3a4a4b", + "value": "channel_2_sum" + } + ], + "fill": [ + { + "scale": "color_22521af9-1104-4fe0-8082-a03bed3a4a4b", + "value": "channel_2_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } - ], - "fillOpacity": { - "value": 0.4 }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_22521af9-1104-4fe0-8082-a03bed3a4a4b", + "field": "channel_2_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_59bc380e-35b4-430f-bc4e-264958a7516b", - "field": "channel_2_sum" - }, - { - "value": "#d3d3d3ff" - } - ] } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "ch_2_sum" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 146.64999999999998 + }, + "y": { + "value": 95.02745098039216 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "c4ecf557-1f8c-5ec4-a592-a8be7c0e6809" - } - }, - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 + ] }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "db5f13e3-9f7a-448f-a87b-41492e4b4ab5", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } - }, - { - "name": "4fa2f359-256c-416c-b362-22d0d53c3e24", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "db5f13e3-9f7a-448f-a87b-41492e4b4ab5", - "transform": [ - { - "type": "filter_element", - "expr": "other_table" - } - ] - }, - { - "name": "blobs_multiscale_labels_15a49996-c5c5-4c83-9e80-a15179db509f", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "db5f13e3-9f7a-448f-a87b-41492e4b4ab5", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_labels" + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 233.7882352941176 }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "value": 113.6941176470588 }, - { - "type": "filter_scale", - "expr": "scale0" + "width": { + "value": 73.41176470588238 }, - { - "type": "lookup", - "from": "4fa2f359-256c-416c-b362-22d0d53c3e24", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["which_max"], - "as": ["which_max"], - "default": null + "height": { + "value": 73.41176470588238 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", - "type": "ordinal", - "domain": ["ch1", "ch2", "ch0"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 252.59055555555548, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_multiscale_labels_15a49996-c5c5-4c83-9e80-a15179db509f" + "scales": [ + { + "name": "X_scale_2", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", - "value": "which_max" - } - ], - "fill": [ - { - "scale": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", - "value": "which_max" + { + "name": "Y_scale_2", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_f08e03c5-045b-4050-ade4-4cc468c29b7f", + "type": "ordinal", + "domain": ["ch0", "ch2", "ch1"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale_2", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_2", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_f08e03c5-045b-4050-ade4-4cc468c29b7f", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 252.59055555555548, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_ad2ee499-e899-4321-bea3-30da867f1ff8" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_f08e03c5-045b-4050-ade4-4cc468c29b7f", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_f08e03c5-045b-4050-ade4-4cc468c29b7f", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 }, - "strokeWidth": { - "value": 3 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_f08e03c5-045b-4050-ade4-4cc468c29b7f", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_9483a2a2-89cf-4ac8-ab40-b790cf5f3ed4", - "field": "which_max" - }, - { - "value": "#d3d3d3ff" - } - ] } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 249.74411764705883 + }, + "y": { + "value": 95.02745098039216 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "ec5e2576-6a31-5cb3-bbfa-9736fdd646d2" + ] } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json b/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json index a242820a..ff9263cb 100644 --- a/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json @@ -1,237 +1,232 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7ad2eda1-7f95-4bc0-9eea-d55b77fc82f6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "10d8a2b0-2219-4c88-adea-dddf10fe68c6", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "a51a8bc8-78f5-4073-a856-aca8a03f2691", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "7ad2eda1-7f95-4bc0-9eea-d55b77fc82f6", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_0942bd06-7b2f-484b-83fa-20862313ab26", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "1e2706f9-e0ca-4c24-9051-481bfdbdddbf", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "7ad2eda1-7f95-4bc0-9eea-d55b77fc82f6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "10d8a2b0-2219-4c88-adea-dddf10fe68c6", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_477df7ab-2898-4552-bdc4-2d4bd2c576f4", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "10d8a2b0-2219-4c88-adea-dddf10fe68c6", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "1e2706f9-e0ca-4c24-9051-481bfdbdddbf", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", - "type": "linear", - "domain": { - "data": "blobs_labels_477df7ab-2898-4552-bdc4-2d4bd2c576f4", - "field": ["channel_0_sum"] + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "a51a8bc8-78f5-4073-a856-aca8a03f2691", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_08e37103-26f9-4924-b982-ffabdeba929c", + "type": "linear", + "domain": { + "data": "blobs_labels_0942bd06-7b2f-484b-83fa-20862313ab26", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.504005030744906, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_477df7ab-2898-4552-bdc4-2d4bd2c576f4" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_08e37103-26f9-4924-b982-ffabdeba929c", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_0942bd06-7b2f-484b-83fa-20862313ab26" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_08e37103-26f9-4924-b982-ffabdeba929c", + "value": "channel_0_sum" } + ], + "fill": [ + { + "scale": "color_08e37103-26f9-4924-b982-ffabdeba929c", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_26027d75-480e-418b-99f6-43f83a6c3e4a", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_08e37103-26f9-4924-b982-ffabdeba929c", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "52d93b1c-87e1-5344-b819-100e28a7259f" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json b/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json index 27175e97..0a09644d 100644 --- a/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json +++ b/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.json @@ -1,240 +1,235 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d25724cd-5a33-4c05-a342-57cf77fdb2b5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "42ef66c8-0f23-423b-b8e1-eeb0ceacd30b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "b217e9fe-3ed9-43fa-b261-4ad1723dfcf8", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "d25724cd-5a33-4c05-a342-57cf77fdb2b5", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_698e66d6-9acd-472f-ab12-f4c77d90f58e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "d1f2f413-ed97-4b73-8e0b-980f7419ffe6", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "d25724cd-5a33-4c05-a342-57cf77fdb2b5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "42ef66c8-0f23-423b-b8e1-eeb0ceacd30b", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_d657eb5c-2fda-4a6f-92b8-3e147b64fccc", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "42ef66c8-0f23-423b-b8e1-eeb0ceacd30b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "d1f2f413-ed97-4b73-8e0b-980f7419ffe6", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - }, - { - "type": "formula", - "expr": "clamp((datum.value - 400.0) / (1000.0 - 400.0), 0, 1)", - "as": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", - "type": "linear", - "domain": { - "data": "blobs_labels_d657eb5c-2fda-4a6f-92b8-3e147b64fccc", - "field": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "b217e9fe-3ed9-43fa-b261-4ad1723dfcf8", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 400.0) / (1000.0 - 400.0), 0, 1)", + "as": "ae0c077f-cdea-4247-a5bf-26e045ab199e" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_fa97b56e-08e0-4a8c-a909-5228dab97f5d", + "type": "linear", + "domain": { + "data": "blobs_labels_698e66d6-9acd-472f-ab12-f4c77d90f58e", + "field": "ae0c077f-cdea-4247-a5bf-26e045ab199e" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.800000000000068, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_d657eb5c-2fda-4a6f-92b8-3e147b64fccc" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", - "value": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" - } - ], - "fill": [ - { - "scale": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", - "value": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_fa97b56e-08e0-4a8c-a909-5228dab97f5d", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.800000000000068, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_698e66d6-9acd-472f-ab12-f4c77d90f58e" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_fa97b56e-08e0-4a8c-a909-5228dab97f5d", + "value": "ae0c077f-cdea-4247-a5bf-26e045ab199e" + } + ], + "fill": [ + { + "scale": "color_fa97b56e-08e0-4a8c-a909-5228dab97f5d", + "value": "ae0c077f-cdea-4247-a5bf-26e045ab199e" } + ], + "fillOpacity": { + "value": 0.4 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_16254b21-1d6c-4e92-97eb-deb66328ca71", - "field": "4e94e692-8cb4-4809-a42a-80aea8e5a99b" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_fa97b56e-08e0-4a8c-a909-5228dab97f5d", + "field": "ae0c077f-cdea-4247-a5bf-26e045ab199e" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "a083a609-d943-5fa6-80f0-5eb601db4d00" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json b/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json index ffd59530..5fe23820 100644 --- a/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json +++ b/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.json @@ -1,240 +1,235 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7e5b4966-863c-4cde-b600-6f5b54d2b5f6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "312c2851-9a2c-4ea1-9c37-7ba0ae9d7721", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "335accca-4316-4fdf-b4b1-af8d2a1870de", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "7e5b4966-863c-4cde-b600-6f5b54d2b5f6", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_c32ccbb2-cda8-4dd7-8318-19dbd48870b5", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "eefe0309-bdb9-4640-a4be-140cbcbde358", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "7e5b4966-863c-4cde-b600-6f5b54d2b5f6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "312c2851-9a2c-4ea1-9c37-7ba0ae9d7721", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_6567dc9a-1381-4032-babc-a24882860474", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "312c2851-9a2c-4ea1-9c37-7ba0ae9d7721", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "eefe0309-bdb9-4640-a4be-140cbcbde358", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - }, - { - "type": "formula", - "expr": "(datum.value - 400.0) / (1000.0 - 400.0)", - "as": "c7ba2f98-d170-435d-86e3-b610da7e882e" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", - "type": "linear", - "domain": { - "data": "blobs_labels_6567dc9a-1381-4032-babc-a24882860474", - "field": "c7ba2f98-d170-435d-86e3-b610da7e882e" + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "335accca-4316-4fdf-b4b1-af8d2a1870de", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 400.0) / (1000.0 - 400.0)", + "as": "1cf6df50-fadf-4472-87fa-ef111a8c376c" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_7c218207-6eb5-47cb-94e3-c2e934ba051d", + "type": "linear", + "domain": { + "data": "blobs_labels_c32ccbb2-cda8-4dd7-8318-19dbd48870b5", + "field": "1cf6df50-fadf-4472-87fa-ef111a8c376c" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.800000000000068, - "zindex": 0 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_6567dc9a-1381-4032-babc-a24882860474" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", - "value": "c7ba2f98-d170-435d-86e3-b610da7e882e" - } - ], - "fill": [ - { - "scale": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", - "value": "c7ba2f98-d170-435d-86e3-b610da7e882e" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_7c218207-6eb5-47cb-94e3-c2e934ba051d", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.800000000000068, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_c32ccbb2-cda8-4dd7-8318-19dbd48870b5" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_7c218207-6eb5-47cb-94e3-c2e934ba051d", + "value": "1cf6df50-fadf-4472-87fa-ef111a8c376c" + } + ], + "fill": [ + { + "scale": "color_7c218207-6eb5-47cb-94e3-c2e934ba051d", + "value": "1cf6df50-fadf-4472-87fa-ef111a8c376c" } + ], + "fillOpacity": { + "value": 0.4 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_4aaf27b6-6835-4b3f-b34f-04b80ae727a2", - "field": "c7ba2f98-d170-435d-86e3-b610da7e882e" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_7c218207-6eb5-47cb-94e3-c2e934ba051d", + "field": "1cf6df50-fadf-4472-87fa-ef111a8c376c" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "e7e32241-4323-5290-91b6-776aaaf10bbb" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_control_label_infill.json b/tests/_figures_viewconfig/Labels_can_control_label_infill.json index aac37f2f..b3c5ad5d 100644 --- a/tests/_figures_viewconfig/Labels_can_control_label_infill.json +++ b/tests/_figures_viewconfig/Labels_can_control_label_infill.json @@ -1,237 +1,232 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "81a6fc5e-c2d2-4cfd-bab8-a0ff16d55179", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "5f50c9dd-dce8-431b-af44-460724119037", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "1a9e3c5e-fbf5-4189-8f92-451c9944307f", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "81a6fc5e-c2d2-4cfd-bab8-a0ff16d55179", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_0d37d4d5-16a0-4e8d-8477-930e29064291", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "ef42acc9-3c35-469c-a667-257569ee76e7", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "81a6fc5e-c2d2-4cfd-bab8-a0ff16d55179", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "5f50c9dd-dce8-431b-af44-460724119037", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_3cf6a48c-63b2-4c26-bdd2-a10e6b395a33", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "5f50c9dd-dce8-431b-af44-460724119037", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "ef42acc9-3c35-469c-a667-257569ee76e7", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", - "type": "linear", - "domain": { - "data": "blobs_labels_3cf6a48c-63b2-4c26-bdd2-a10e6b395a33", - "field": ["channel_0_sum"] + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "1a9e3c5e-fbf5-4189-8f92-451c9944307f", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_2dde8833-baa0-4dad-9991-20c40538c0c0", + "type": "linear", + "domain": { + "data": "blobs_labels_0d37d4d5-16a0-4e8d-8477-930e29064291", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.504005030744906, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_3cf6a48c-63b2-4c26-bdd2-a10e6b395a33" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_2dde8833-baa0-4dad-9991-20c40538c0c0", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_0d37d4d5-16a0-4e8d-8477-930e29064291" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_2dde8833-baa0-4dad-9991-20c40538c0c0", + "value": "channel_0_sum" } + ], + "fill": [ + { + "scale": "color_2dde8833-baa0-4dad-9991-20c40538c0c0", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_f5fb5491-d0ea-4a1c-82bd-553e8b53d862", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_2dde8833-baa0-4dad-9991-20c40538c0c0", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "14302cde-62fc-5181-91f9-84e2f3912c1f" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_control_label_outline.json b/tests/_figures_viewconfig/Labels_can_control_label_outline.json index 10060087..e4a7850a 100644 --- a/tests/_figures_viewconfig/Labels_can_control_label_outline.json +++ b/tests/_figures_viewconfig/Labels_can_control_label_outline.json @@ -1,237 +1,232 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9de77b43-a363-4186-93a0-6078dc218aba", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "e9784389-b68c-4878-ab10-5a52352ef490", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "c974aded-3c13-43fb-9c80-d7a8a8af79fb", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "9de77b43-a363-4186-93a0-6078dc218aba", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_3b489c4d-ea37-4cb1-bbbe-553e0ad074f2", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "91daec16-0a2c-465f-aeba-dfc287137de5", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "9de77b43-a363-4186-93a0-6078dc218aba", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "e9784389-b68c-4878-ab10-5a52352ef490", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_ba1f6f01-08ca-4cf6-a605-5fd786c179e0", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "e9784389-b68c-4878-ab10-5a52352ef490", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "91daec16-0a2c-465f-aeba-dfc287137de5", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", - "type": "linear", - "domain": { - "data": "blobs_labels_ba1f6f01-08ca-4cf6-a605-5fd786c179e0", - "field": ["channel_0_sum"] + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "c974aded-3c13-43fb-9c80-d7a8a8af79fb", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_8fe101e5-e6b5-4e5e-9b5f-115e11b05a7f", + "type": "linear", + "domain": { + "data": "blobs_labels_3b489c4d-ea37-4cb1-bbbe-553e0ad074f2", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.504005030744906, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_ba1f6f01-08ca-4cf6-a605-5fd786c179e0" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.0 - }, - "strokeOpacity": { - "value": 0.4 - }, - "strokeWidth": { - "value": 15 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_8fe101e5-e6b5-4e5e-9b5f-115e11b05a7f", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_3b489c4d-ea37-4cb1-bbbe-553e0ad074f2" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_8fe101e5-e6b5-4e5e-9b5f-115e11b05a7f", + "value": "channel_0_sum" } + ], + "fill": [ + { + "scale": "color_8fe101e5-e6b5-4e5e-9b5f-115e11b05a7f", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.0 + }, + "strokeOpacity": { + "value": 0.4 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_7e8c760b-36ec-431e-a3f4-4b5010ff0983", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 15 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_8fe101e5-e6b5-4e5e-9b5f-115e11b05a7f", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "d056520d-87b8-5acb-a761-b9b9eba72a1f" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_do_rasterization.json b/tests/_figures_viewconfig/Labels_can_do_rasterization.json index 00ece89c..2eec8651 100644 --- a/tests/_figures_viewconfig/Labels_can_do_rasterization.json +++ b/tests/_figures_viewconfig/Labels_can_do_rasterization.json @@ -1,172 +1,167 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9952e569-f365-4965-bb68-70338c8f4e70", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "aabf5af9-109b-44e2-9c5f-a37265475055", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_giant_labels_3fc3d131-9a97-47da-892e-8fe709ad1037", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_giant_labels_c034968f-e957-4462-9e82-1b3efa5faaa6", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "9952e569-f365-4965-bb68-70338c8f4e70", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_labels" }, - "source": "aabf5af9-109b-44e2-9c5f-a37265475055", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_giant_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 3072.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [3072.0, 0.0], - "range": "height" - }, - { - "name": "color_7784118b-ce42-430f-98a0-0e06563fafdc", - "type": "ordinal", - "domain": { - "data": "blobs_giant_labels_c034968f-e957-4462-9e82-1b3efa5faaa6", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": ["random"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 1000, 2000, 3000], - "zindex": 1.5 + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_df7cdfed-fd93-406f-9510-222b32489094", + "type": "ordinal", + "domain": { + "data": "blobs_giant_labels_3fc3d131-9a97-47da-892e-8fe709ad1037", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500, 1000, 1500, 2000, 2500, 3000], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_giant_labels_c034968f-e957-4462-9e82-1b3efa5faaa6" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_7784118b-ce42-430f-98a0-0e06563fafdc", - "value": "value" - } - ], - "fill": [ - { - "scale": "color_7784118b-ce42-430f-98a0-0e06563fafdc", - "value": "value" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_giant_labels_3fc3d131-9a97-47da-892e-8fe709ad1037" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_df7cdfed-fd93-406f-9510-222b32489094", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_df7cdfed-fd93-406f-9510-222b32489094", + "value": "value" } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } } } - ], - "usermeta": { - "axis_uuid": "517c5bb4-5247-539f-9447-632f5c2cf36b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json b/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json index 009481dc..9b7c1148 100644 --- a/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json +++ b/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.json @@ -1,361 +1,356 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f964c795-b1af-4649-93d6-32b69389d1d7", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "67be0932-7dda-4dad-9459-ee60b513ce33", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "3bbd27c6-90c9-4702-9ac3-bce8b22f06a4", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] + "source": "f964c795-b1af-4649-93d6-32b69389d1d7", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_afd155ad-6c1c-41da-8550-e90ad949f214", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_labels_e3602ebc-6ddd-42fa-a15f-1dbf524b09d6", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "f964c795-b1af-4649-93d6-32b69389d1d7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "3bbd27c6-90c9-4702-9ac3-bce8b22f06a4", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - }, - { - "name": "4050e26b-482c-47de-a5bd-e0cac2c014d4", - "format": { - "type": "spatialdata_table", - "version": 0.1 + { + "type": "filter_cs", + "expr": "global" }, - "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", - "transform": [ - { - "type": "filter_element", - "expr": "multi_table" - } - ] - }, - { - "name": "blobs_multiscale_labels_68005dad-a2ff-43e0-a196-d85da7e69473", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_scale", + "expr": "full" }, - "source": "6f14fd7f-1816-4f96-ae16-5d0f173fc7ad", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "4050e26b-482c-47de-a5bd-e0cac2c014d4", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_1_sum"], - "as": ["channel_1_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" + { + "type": "lookup", + "from": "67be0932-7dda-4dad-9459-ee60b513ce33", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + }, + { + "name": "10be70f9-ebf9-4a8c-8eca-db7f9bde009a", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", - "type": "linear", - "domain": { - "data": "blobs_labels_e3602ebc-6ddd-42fa-a15f-1dbf524b09d6", - "field": ["channel_0_sum"] - }, - "range": { - "scheme": "viridis", - "count": 256 + "source": "f964c795-b1af-4649-93d6-32b69389d1d7", + "transform": [ + { + "type": "filter_element", + "expr": "multi_table" } + ] + }, + { + "name": "blobs_multiscale_labels_43390fdb-4b0e-45c4-bb6c-7264a9236c58", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", - "type": "linear", - "domain": { - "data": "blobs_multiscale_labels_68005dad-a2ff-43e0-a196-d85da7e69473", - "field": ["channel_1_sum"] + "source": "f964c795-b1af-4649-93d6-32b69389d1d7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "10be70f9-ebf9-4a8c-8eca-db7f9bde009a", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_1_sum"], + "as": ["channel_1_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_51aaadce-6295-41bc-b469-7c301c1bfe2a", + "type": "linear", + "domain": { + "data": "blobs_labels_afd155ad-6c1c-41da-8550-e90ad949f214", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.504005030744906, - "zindex": 0 + }, + { + "name": "color_7484dba0-c6c4-4571-bde9-333fac8bcb14", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_43390fdb-4b0e-45c4-bb6c-7264a9236c58", + "field": ["channel_1_sum"] }, - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 266.5651200000001, - "legendY": 28.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_e3602ebc-6ddd-42fa-a15f-1dbf524b09d6" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_51aaadce-6295-41bc-b469-7c301c1bfe2a", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + }, + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_7484dba0-c6c4-4571-bde9-333fac8bcb14", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 266.5651200000001, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_afd155ad-6c1c-41da-8550-e90ad949f214" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_51aaadce-6295-41bc-b469-7c301c1bfe2a", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_51aaadce-6295-41bc-b469-7c301c1bfe2a", + "value": "channel_0_sum" } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_c2e0acb4-e54c-420d-bd32-e640bc3f89b8", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 3 } - } - }, - { - "type": "raster_label", - "from": { - "data": "blobs_multiscale_labels_68005dad-a2ff-43e0-a196-d85da7e69473" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", - "value": "channel_1_sum" - } - ], - "fill": [ - { - "scale": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", - "value": "channel_1_sum" - } - ], - "fillOpacity": { - "value": 0.4 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_51aaadce-6295-41bc-b469-7c301c1bfe2a", + "field": "channel_0_sum" }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + { + "value": "#d3d3d3ff" } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_43390fdb-4b0e-45c4-bb6c-7264a9236c58" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_7484dba0-c6c4-4571-bde9-333fac8bcb14", + "value": "channel_1_sum" + } + ], + "fill": [ + { + "scale": "color_7484dba0-c6c4-4571-bde9-333fac8bcb14", + "value": "channel_1_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_0de0ce47-7b7d-416a-88f0-c6ba41c869b7", - "field": "channel_1_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_7484dba0-c6c4-4571-bde9-333fac8bcb14", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "97a70941-9b78-57ec-9ca6-83f70e0465c2" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json b/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json index f141762e..b2bb7053 100644 --- a/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json +++ b/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.json @@ -1,172 +1,167 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "87293909-715a-4292-8d50-38294effca8b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "3e3b8e37-fedc-47fe-8f13-e93c8247e6b8", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multiscale_labels_f4cf783d-0adb-4641-b1f9-7c825b7abad2", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_labels_0c301e96-1f0a-455b-be38-d76a657a309f", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "87293909-715a-4292-8d50-38294effca8b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" }, - "source": "3e3b8e37-fedc-47fe-8f13-e93c8247e6b8", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "scale1" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_c0f722a3-2110-440d-a465-27c39242c840", - "type": "ordinal", - "domain": { - "data": "blobs_multiscale_labels_0c301e96-1f0a-455b-be38-d76a657a309f", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": ["random"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + { + "type": "filter_scale", + "expr": "scale1" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_ba245473-5102-4955-849d-529c412218d8", + "type": "ordinal", + "domain": { + "data": "blobs_multiscale_labels_f4cf783d-0adb-4641-b1f9-7c825b7abad2", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_multiscale_labels_0c301e96-1f0a-455b-be38-d76a657a309f" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_c0f722a3-2110-440d-a465-27c39242c840", - "value": "value" - } - ], - "fill": [ - { - "scale": "color_c0f722a3-2110-440d-a465-27c39242c840", - "value": "value" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_f4cf783d-0adb-4641-b1f9-7c825b7abad2" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_ba245473-5102-4955-849d-529c412218d8", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_ba245473-5102-4955-849d-529c412218d8", + "value": "value" } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } } } - ], - "usermeta": { - "axis_uuid": "0c0b63b4-ff52-5b96-9d67-d3557c3aea38" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_render_labels.json b/tests/_figures_viewconfig/Labels_can_render_labels.json index 06dc4102..cc81c0b4 100644 --- a/tests/_figures_viewconfig/Labels_can_render_labels.json +++ b/tests/_figures_viewconfig/Labels_can_render_labels.json @@ -1,172 +1,167 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "bd8cf430-570b-49ab-9bd9-dca6c51d8ab3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "67ee3129-4474-4b34-a06a-392dc462bd30", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_labels_f1254fbd-a1cf-4a39-af40-08f20e824d1c", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_labels_592a6c8b-a235-4b83-8fcb-25b5dea54aab", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "bd8cf430-570b-49ab-9bd9-dca6c51d8ab3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "67ee3129-4474-4b34-a06a-392dc462bd30", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_3e3c0c81-6ea6-4697-943e-a99d61ac02f0", - "type": "ordinal", - "domain": { - "data": "blobs_labels_592a6c8b-a235-4b83-8fcb-25b5dea54aab", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": ["random"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_e9a1a0d8-c8b6-40b1-a599-49ff6d284185", + "type": "ordinal", + "domain": { + "data": "blobs_labels_f1254fbd-a1cf-4a39-af40-08f20e824d1c", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_592a6c8b-a235-4b83-8fcb-25b5dea54aab" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_3e3c0c81-6ea6-4697-943e-a99d61ac02f0", - "value": "value" - } - ], - "fill": [ - { - "scale": "color_3e3c0c81-6ea6-4697-943e-a99d61ac02f0", - "value": "value" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_f1254fbd-a1cf-4a39-af40-08f20e824d1c" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_e9a1a0d8-c8b6-40b1-a599-49ff6d284185", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_e9a1a0d8-c8b6-40b1-a599-49ff6d284185", + "value": "value" } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } } } - ], - "usermeta": { - "axis_uuid": "a1200cf1-7f34-52b9-86c3-3b264b34a4a6" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json b/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json index 269765e8..1559129b 100644 --- a/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json +++ b/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.json @@ -1,172 +1,167 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d9ba20c7-cad0-4851-9fef-d19fa210506b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "6023d889-bae1-48ee-ab7c-ffbafc6b7f33", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multiscale_labels_96bec926-1efe-4243-a071-8852021e2fc3", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_multiscale_labels_f3e67ce7-5c47-4bdb-86cd-968c1c869d02", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "d9ba20c7-cad0-4851-9fef-d19fa210506b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" }, - "source": "6023d889-bae1-48ee-ab7c-ffbafc6b7f33", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_4231a9cf-aa0d-44c9-b56d-4b41f40841af", - "type": "ordinal", - "domain": { - "data": "blobs_multiscale_labels_f3e67ce7-5c47-4bdb-86cd-968c1c869d02", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": ["random"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_c59852be-fc98-45c4-af85-ceed8c467020", + "type": "ordinal", + "domain": { + "data": "blobs_multiscale_labels_96bec926-1efe-4243-a071-8852021e2fc3", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_multiscale_labels_f3e67ce7-5c47-4bdb-86cd-968c1c869d02" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_4231a9cf-aa0d-44c9-b56d-4b41f40841af", - "value": "value" - } - ], - "fill": [ - { - "scale": "color_4231a9cf-aa0d-44c9-b56d-4b41f40841af", - "value": "value" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_96bec926-1efe-4243-a071-8852021e2fc3" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_c59852be-fc98-45c4-af85-ceed8c467020", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_c59852be-fc98-45c4-af85-ceed8c467020", + "value": "value" } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } } } - ], - "usermeta": { - "axis_uuid": "74a12ec7-4ee6-507f-9476-700bfe05ca9f" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_stack_render_labels.json b/tests/_figures_viewconfig/Labels_can_stack_render_labels.json index 38e61a86..03578b7a 100644 --- a/tests/_figures_viewconfig/Labels_can_stack_render_labels.json +++ b/tests/_figures_viewconfig/Labels_can_stack_render_labels.json @@ -1,213 +1,208 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e21c21c8-5f5b-4fa8-89da-604f68d78c28", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "545ba7f6-b28a-4f22-bf95-7dae8458afca", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_labels_ff2f67ed-d4e9-41e1-9e5d-fc271817989c", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_labels_d67ce142-5870-4b3a-896c-990c3821bfce", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "e21c21c8-5f5b-4fa8-89da-604f68d78c28", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "545ba7f6-b28a-4f22-bf95-7dae8458afca", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - } - ] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "blobs_labels_a6869836-35fc-4cb3-9fff-b23541f65ce1", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_labels_47da63b2-1fdc-498e-ae0e-d41989009806", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "e21c21c8-5f5b-4fa8-89da-604f68d78c28", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" }, - "source": "545ba7f6-b28a-4f22-bf95-7dae8458afca", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_ff2f67ed-d4e9-41e1-9e5d-fc271817989c" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "value": "#ff0000" + } + ], + "fill": [ + { + "value": "#ff0000" + } + ], + "fillOpacity": { + "value": 1 }, - { - "type": "filter_cs", - "expr": "global" + "strokeOpacity": { + "value": 0 }, - { - "type": "filter_scale", - "expr": "full" + "strokeWidth": { + "value": 3 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" + } } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + }, + { + "type": "raster_label", + "from": { + "data": "blobs_labels_a6869836-35fc-4cb3-9fff-b23541f65ce1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_d67ce142-5870-4b3a-896c-990c3821bfce" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "value": "#ff0000" - } - ], - "fill": [ - { - "value": "#ff0000" - } - ], - "fillOpacity": { - "value": 1 - }, - "strokeOpacity": { - "value": 0 - }, - "strokeWidth": { - "value": 3 + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "value": "#0000ff" } - } - } - }, - { - "type": "raster_label", - "from": { - "data": "blobs_labels_47da63b2-1fdc-498e-ae0e-d41989009806" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "value": "#0000ff" - } - ], - "fill": [ - { - "value": "#0000ff" - } - ], - "fillOpacity": { - "value": 0 - }, - "strokeOpacity": { - "value": 1 - }, - "strokeWidth": { - "value": 15 + ], + "fill": [ + { + "value": "#0000ff" } + ], + "fillOpacity": { + "value": 0 + }, + "strokeOpacity": { + "value": 1 + }, + "strokeWidth": { + "value": 15 } } } - ], - "usermeta": { - "axis_uuid": "b9a14944-c16a-50bf-a25f-c5f37ecba3f0" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json b/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json index dd2e77f7..aaf4a41e 100644 --- a/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json +++ b/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.json @@ -1,172 +1,167 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e70c4f52-b2f1-4804-865a-dc9e5e3e33ad", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f704d041-82f5-4071-b649-0bf861d3909e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_giant_labels_10d6b6a2-cadb-4508-a47f-aa29adfec5c1", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_giant_labels_7c4bb325-4d86-496c-91fa-9cb882bda262", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "e70c4f52-b2f1-4804-865a-dc9e5e3e33ad", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_giant_labels" }, - "source": "f704d041-82f5-4071-b649-0bf861d3909e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_giant_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 3072.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [3072.0, 0.0], - "range": "height" - }, - { - "name": "color_47b4272b-5118-4d15-a467-08fbc16ecc7f", - "type": "ordinal", - "domain": { - "data": "blobs_giant_labels_7c4bb325-4d86-496c-91fa-9cb882bda262", - "field": "value" + { + "type": "filter_cs", + "expr": "global" }, - "range": ["random"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 1000, 2000, 3000], - "zindex": 1.5 + { + "type": "filter_scale", + "expr": "full" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 3072.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [3072.0, 0.0], + "range": "height" + }, + { + "name": "color_396f1ebc-dda9-4b51-94cb-7ff14678495f", + "type": "ordinal", + "domain": { + "data": "blobs_giant_labels_10d6b6a2-cadb-4508-a47f-aa29adfec5c1", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500, 1000, 1500, 2000, 2500, 3000], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_giant_labels_7c4bb325-4d86-496c-91fa-9cb882bda262" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_47b4272b-5118-4d15-a467-08fbc16ecc7f", - "value": "value" - } - ], - "fill": [ - { - "scale": "color_47b4272b-5118-4d15-a467-08fbc16ecc7f", - "value": "value" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + "range": ["random"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1000, 2000, 3000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500, 1000, 1500, 2000, 2500, 3000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_giant_labels_10d6b6a2-cadb-4508-a47f-aa29adfec5c1" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_396f1ebc-dda9-4b51-94cb-7ff14678495f", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_396f1ebc-dda9-4b51-94cb-7ff14678495f", + "value": "value" } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } } } - ], - "usermeta": { - "axis_uuid": "751647c0-0c89-5ddd-9886-922ec7d13488" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_label_categorical_color.json b/tests/_figures_viewconfig/Labels_label_categorical_color.json index caaf6e60..ad5fd9f5 100644 --- a/tests/_figures_viewconfig/Labels_label_categorical_color.json +++ b/tests/_figures_viewconfig/Labels_label_categorical_color.json @@ -1,229 +1,224 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2836bed2-7cd2-442e-9809-a3096fdcefb7", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "faeb2a59-fcb1-4446-8e88-a5c57882c7ce", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "d603cde5-12e9-4040-81c4-8eec394af602", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "2836bed2-7cd2-442e-9809-a3096fdcefb7", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" } + ] + }, + { + "name": "blobs_labels_b3a68f9c-848e-45e4-aa79-02d78ee06b7c", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "8e0dc6a8-89aa-43a2-b950-966d21afb30a", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "2836bed2-7cd2-442e-9809-a3096fdcefb7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "faeb2a59-fcb1-4446-8e88-a5c57882c7ce", - "transform": [ - { - "type": "filter_element", - "expr": "other_table" - } - ] - }, - { - "name": "blobs_labels_6460c403-2063-4b03-a0ac-39a096dc2070", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "faeb2a59-fcb1-4446-8e88-a5c57882c7ce", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "d603cde5-12e9-4040-81c4-8eec394af602", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_001be20c-b06b-4329-8a8c-4391e86cae67", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_001be20c-b06b-4329-8a8c-4391e86cae67", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_b3a68f9c-848e-45e4-aa79-02d78ee06b7c" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_001be20c-b06b-4329-8a8c-4391e86cae67", + "value": "category" + } + ], + "fill": [ + { + "scale": "color_001be20c-b06b-4329-8a8c-4391e86cae67", + "value": "category" + } + ], + "fillOpacity": { + "value": 0.4 }, - { - "type": "filter_scale", - "expr": "full" + "strokeOpacity": { + "value": 0.0 }, - { - "type": "lookup", - "from": "8e0dc6a8-89aa-43a2-b950-966d21afb30a", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["category"], - "as": ["category"], - "default": null + "strokeWidth": { + "value": 3 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", - "type": "ordinal", - "domain": ["a", "b", "c"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.8405555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_6460c403-2063-4b03-a0ac-39a096dc2070" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", - "value": "category" - } - ], - "fill": [ - { - "scale": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", - "value": "category" - } - ], - "fillOpacity": { - "value": 0.4 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_001be20c-b06b-4329-8a8c-4391e86cae67", + "field": "category" }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + { + "value": "#d3d3d3ff" } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_6d0e141a-3023-4a5a-a37a-2e4a2444a172", - "field": "category" - }, - { - "value": "#d3d3d3ff" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "1090a0cc-54d6-58e2-8f48-5aadb9619cfb" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json index 0b5abad5..c65bf87a 100644 --- a/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json +++ b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json @@ -1,237 +1,232 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cdcc1f2b-1c58-4ec6-924a-c26ff2275961", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "b048ca4b-c094-4a14-bd37-3a468429eab6", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "f931a0c1-e7dd-4cc9-a85d-3dc59650242f", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "cdcc1f2b-1c58-4ec6-924a-c26ff2275961", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_516e21ed-547c-4d2c-9a1d-5696a083b631", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "ce7e0acd-5d23-4e94-9a67-8361adab7ba1", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "cdcc1f2b-1c58-4ec6-924a-c26ff2275961", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "b048ca4b-c094-4a14-bd37-3a468429eab6", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_c9e0e989-5505-43a3-b229-000156057239", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "b048ca4b-c094-4a14-bd37-3a468429eab6", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "ce7e0acd-5d23-4e94-9a67-8361adab7ba1", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", - "type": "linear", - "domain": { - "data": "blobs_labels_c9e0e989-5505-43a3-b229-000156057239", - "field": ["channel_0_sum"] + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "f931a0c1-e7dd-4cc9-a85d-3dc59650242f", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_f88e66f7-3829-46b0-9c1f-ce82da2c608a", + "type": "linear", + "domain": { + "data": "blobs_labels_516e21ed-547c-4d2c-9a1d-5696a083b631", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.7, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.504005030744906, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_c9e0e989-5505-43a3-b229-000156057239" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.1 - }, - "strokeOpacity": { - "value": 0.7 - }, - "strokeWidth": { - "value": 15 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f88e66f7-3829-46b0-9c1f-ce82da2c608a", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.7, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_516e21ed-547c-4d2c-9a1d-5696a083b631" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_f88e66f7-3829-46b0-9c1f-ce82da2c608a", + "value": "channel_0_sum" } + ], + "fill": [ + { + "scale": "color_f88e66f7-3829-46b0-9c1f-ce82da2c608a", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.1 + }, + "strokeOpacity": { + "value": 0.7 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_5af2d09f-26c0-4308-be45-1bd88b76dd76", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 15 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_f88e66f7-3829-46b0-9c1f-ce82da2c608a", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "0e2750eb-4bb3-502d-9fa2-d1e0b18db946" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json index 86895693..dce1a692 100644 --- a/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json +++ b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json @@ -1,237 +1,232 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "4f93dcc9-ee59-41ae-8964-41b780f6e117", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "6e01eea7-6f7c-4863-aff9-355bd15c00a7", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "f130214b-7200-4c2a-83a6-00db22e8858c", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "4f93dcc9-ee59-41ae-8964-41b780f6e117", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_385c0aa5-39e3-4d0b-b2eb-943eed930aef", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "30362437-de67-491c-a3d6-3909c4e95699", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "4f93dcc9-ee59-41ae-8964-41b780f6e117", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "6e01eea7-6f7c-4863-aff9-355bd15c00a7", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_5312b6b0-e66c-4214-b6b9-c649966b379f", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "6e01eea7-6f7c-4863-aff9-355bd15c00a7", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "30362437-de67-491c-a3d6-3909c4e95699", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", - "type": "linear", - "domain": { - "data": "blobs_labels_5312b6b0-e66c-4214-b6b9-c649966b379f", - "field": ["channel_0_sum"] + { + "type": "filter_scale", + "expr": "full" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "f130214b-7200-4c2a-83a6-00db22e8858c", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_2069823d-fa3b-4467-b40b-e3972d328ac8", + "type": "linear", + "domain": { + "data": "blobs_labels_385c0aa5-39e3-4d0b-b2eb-943eed930aef", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.7, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.504005030744906, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_5312b6b0-e66c-4214-b6b9-c649966b379f" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.7 - }, - "strokeOpacity": { - "value": 0.1 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_2069823d-fa3b-4467-b40b-e3972d328ac8", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.7, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_385c0aa5-39e3-4d0b-b2eb-943eed930aef" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_2069823d-fa3b-4467-b40b-e3972d328ac8", + "value": "channel_0_sum" } + ], + "fill": [ + { + "scale": "color_2069823d-fa3b-4467-b40b-e3972d328ac8", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.7 + }, + "strokeOpacity": { + "value": 0.1 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_c2c68687-b59a-4b5d-bd38-a6d7980ae1d2", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_2069823d-fa3b-4467-b40b-e3972d328ac8", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "ff0ae4cc-4386-507d-9105-36ba1543cf03" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json index 27a30db4..e759241a 100644 --- a/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json +++ b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json @@ -1,456 +1,490 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "data": [ + { + "name": "54dff630-dfce-49e8-aafd-d5e811da81b4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "4a397c93-a896-496d-9c4e-c2af0c6d8781", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "3ac51768-ffba-4509-b9a1-5a3960c00295", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "54dff630-dfce-49e8-aafd-d5e811da81b4", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_c1f1a530-3a9b-4e34-85c6-83fedc69f15e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "829fa5c3-e0d2-48d0-aff4-e8c94b396601", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "54dff630-dfce-49e8-aafd-d5e811da81b4", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "4a397c93-a896-496d-9c4e-c2af0c6d8781", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_ecb33cf0-637e-4472-bb9f-670752e53023", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" }, - "source": "4a397c93-a896-496d-9c4e-c2af0c6d8781", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" + { + "type": "lookup", + "from": "3ac51768-ffba-4509-b9a1-5a3960c00295", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 57.599999999999994 }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "value": 93.67272727272727 }, - { - "type": "filter_scale", - "expr": "full" + "width": { + "value": 113.45454545454545 }, - { - "type": "lookup", - "from": "829fa5c3-e0d2-48d0-aff4-e8c94b396601", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["which_max"], - "as": ["which_max"], - "default": null + "height": { + "value": 113.45454545454545 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", - "type": "ordinal", - "domain": ["channel_0_sum", "channel_1_sum", "channel_2_sum"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 38.820101010101, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_ecb33cf0-637e-4472-bb9f-670752e53023" + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", - "value": "which_max" - } - ], - "fill": [ - { - "scale": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", - "value": "which_max" + { + "name": "Y_scale_0", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_fd7d1678-5de3-45e4-88e7-73b4fd65701e", + "type": "ordinal", + "domain": [ + "channel_0_sum", + "channel_1_sum", + "channel_2_sum" + ], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale_0", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_0", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_fd7d1678-5de3-45e4-88e7-73b4fd65701e", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 38.820101010101, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_c1f1a530-3a9b-4e34-85c6-83fedc69f15e" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_fd7d1678-5de3-45e4-88e7-73b4fd65701e", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_fd7d1678-5de3-45e4-88e7-73b4fd65701e", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 }, - "strokeWidth": { - "value": 3 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_fd7d1678-5de3-45e4-88e7-73b4fd65701e", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_dcbc127a-758b-46e2-80fb-bc7755b2fa35", - "field": "which_max" + } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" }, - { - "value": "#d3d3d3ff" + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 93.57727272727273 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" } - ] - } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "cfd5a5c9-21ec-588a-84f2-05a39c869aa0" - } - }, - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" + ] }, - "data": [ - { - "name": "9c67d25f-01a3-428f-9edc-d33237733d3e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } - }, - { - "name": "7ca34ed6-dce0-418f-a5e8-d57c71edece3", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "9c67d25f-01a3-428f-9edc-d33237733d3e", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_2d514dac-028d-4aef-9f5e-9dc1eada1db9", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "9c67d25f-01a3-428f-9edc-d33237733d3e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "value": 93.67272727272727 }, - { - "type": "filter_scale", - "expr": "full" + "width": { + "value": 113.45454545454544 }, - { - "type": "lookup", - "from": "7ca34ed6-dce0-418f-a5e8-d57c71edece3", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["which_max"], - "as": ["which_max"], - "default": null + "height": { + "value": 113.45454545454544 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", - "type": "ordinal", - "domain": ["channel_0_sum"], - "range": ["#1f77b4"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 174.9655555555555, - "legendY": 35.955555555555634 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_2d514dac-028d-4aef-9f5e-9dc1eada1db9" + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", - "value": "which_max" - } - ], - "fill": [ - { - "scale": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", - "value": "which_max" + { + "name": "Y_scale_1", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_ad66c4d1-b3e4-43e1-8dea-c95a35124ef8", + "type": "ordinal", + "domain": ["channel_0_sum"], + "range": ["#1f77b4"] + } + ], + "axes": [ + { + "scale": "X_scale_1", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_1", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_ad66c4d1-b3e4-43e1-8dea-c95a35124ef8", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 174.9655555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_99715a53-ce5f-4190-bdaa-3564e47a2557" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_ad66c4d1-b3e4-43e1-8dea-c95a35124ef8", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_ad66c4d1-b3e4-43e1-8dea-c95a35124ef8", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 }, - "strokeWidth": { - "value": 3 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_ad66c4d1-b3e4-43e1-8dea-c95a35124ef8", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_0c6c9434-d704-474d-ae5b-e23c3027f235", - "field": "which_max" + } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" }, - { - "value": "#d3d3d3ff" + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 229.72272727272727 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" } - ] - } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "bd1edb42-b2e7-52cb-91e2-47002b2b17c9" + ] } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json index 84f54678..80a98f20 100644 --- a/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json +++ b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json @@ -1,456 +1,490 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "data": [ + { + "name": "93e36e8c-3ac2-43eb-978d-31e7da669877", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "9cc2356b-1b35-4a99-8315-4372e83853f9", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "13607f76-fc53-4ecd-965f-89c170841be2", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "93e36e8c-3ac2-43eb-978d-31e7da669877", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_labels_7742aec7-20c0-445c-829e-04279218c975", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "55143373-85a2-4861-9732-84e56bfff312", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "93e36e8c-3ac2-43eb-978d-31e7da669877", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "9cc2356b-1b35-4a99-8315-4372e83853f9", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_7573816c-501c-47c3-99c7-5b2805575d2b", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" }, - "source": "9cc2356b-1b35-4a99-8315-4372e83853f9", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" + { + "type": "lookup", + "from": "13607f76-fc53-4ecd-965f-89c170841be2", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["which_max"], + "as": ["which_max"], + "default": null + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 57.599999999999994 }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "value": 93.67272727272727 }, - { - "type": "filter_scale", - "expr": "full" + "width": { + "value": 113.45454545454545 }, - { - "type": "lookup", - "from": "55143373-85a2-4861-9732-84e56bfff312", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["which_max"], - "as": ["which_max"], - "default": null + "height": { + "value": 113.45454545454545 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", - "type": "ordinal", - "domain": ["channel_0_sum", "channel_1_sum", "channel_2_sum"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 38.820101010101, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_7573816c-501c-47c3-99c7-5b2805575d2b" + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", - "value": "which_max" - } - ], - "fill": [ - { - "scale": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", - "value": "which_max" + { + "name": "Y_scale_0", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_acdf3dfb-31e4-4066-942f-639ccf89ccdc", + "type": "ordinal", + "domain": [ + "channel_0_sum", + "channel_1_sum", + "channel_2_sum" + ], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale_0", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_0", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_acdf3dfb-31e4-4066-942f-639ccf89ccdc", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 38.820101010101, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_7742aec7-20c0-445c-829e-04279218c975" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_acdf3dfb-31e4-4066-942f-639ccf89ccdc", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_acdf3dfb-31e4-4066-942f-639ccf89ccdc", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 }, - "strokeWidth": { - "value": 3 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_acdf3dfb-31e4-4066-942f-639ccf89ccdc", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_394f2349-073a-4f11-a203-c8a94ee6e1e0", - "field": "which_max" + } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" }, - { - "value": "#d3d3d3ff" + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 93.57727272727273 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" } - ] - } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "22a51972-f1b7-5aa7-a614-e211a5e52771" - } - }, - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" + ] }, - "data": [ - { - "name": "2975824c-ebf2-4471-8fe4-780eb9c5e279", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } - }, - { - "name": "ddc968b4-3316-41fa-a489-180f819266a4", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "2975824c-ebf2-4471-8fe4-780eb9c5e279", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_labels_66d4bf92-c97c-43b8-8fef-f4f77686fd55", - "format": { - "type": "RasterFormatV02", - "version": "0.2" - }, - "source": "2975824c-ebf2-4471-8fe4-780eb9c5e279", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "value": 93.67272727272727 }, - { - "type": "filter_scale", - "expr": "full" + "width": { + "value": 113.45454545454544 }, - { - "type": "lookup", - "from": "ddc968b4-3316-41fa-a489-180f819266a4", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["which_max"], - "as": ["which_max"], - "default": null + "height": { + "value": 113.45454545454544 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" - }, - { - "name": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", - "type": "ordinal", - "domain": ["channel_0_sum"], - "range": ["#ff0000"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 500], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 174.9655555555555, - "legendY": 35.955555555555634 - } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_66d4bf92-c97c-43b8-8fef-f4f77686fd55" + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", - "value": "which_max" - } - ], - "fill": [ - { - "scale": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", - "value": "which_max" + { + "name": "Y_scale_1", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_ab6b42a8-a361-41f4-95b8-81bd8e040c18", + "type": "ordinal", + "domain": ["channel_0_sum"], + "range": ["#ff0000"] + } + ], + "axes": [ + { + "scale": "X_scale_1", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_1", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_ab6b42a8-a361-41f4-95b8-81bd8e040c18", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 174.9655555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_a58d4f3a-c831-44c9-b8ce-9149c3fc1111" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_ab6b42a8-a361-41f4-95b8-81bd8e040c18", + "value": "which_max" + } + ], + "fill": [ + { + "scale": "color_ab6b42a8-a361-41f4-95b8-81bd8e040c18", + "value": "which_max" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 }, - "strokeWidth": { - "value": 3 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_ab6b42a8-a361-41f4-95b8-81bd8e040c18", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] } - }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_74042fff-c5c9-4316-850f-50a10af7b0f3", - "field": "which_max" + } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" }, - { - "value": "#d3d3d3ff" + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 229.72272727272727 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" } - ] - } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "dd335f6c-3ecc-5ca0-a044-e97216115b03" + ] } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json b/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json index bc8b39a0..0c4542c9 100644 --- a/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json +++ b/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.json @@ -1,361 +1,356 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "baseline", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3e9a598d-f682-434a-9513-e49924876bc1", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "6292f1b9-dbbe-41ed-8184-792b31448d28", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "b7065ffe-a034-4fca-9d33-a0f6ce2f6a23", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "5ab91e8a-4567-4a7e-a294-0c5294a15673", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] + "source": "3e9a598d-f682-434a-9513-e49924876bc1", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_f0e0a437-1b06-4537-b99a-5ae30aae1dc9", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "blobs_labels_3438e488-e946-452a-adb9-4bbbf7cb7f53", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + "source": "3e9a598d-f682-434a-9513-e49924876bc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" }, - "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "5ab91e8a-4567-4a7e-a294-0c5294a15673", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_0_sum"], - "as": ["channel_0_sum"], - "default": null - } - ] - }, - { - "name": "9d6b0d7d-e69e-4211-a9af-80254977e5d7", - "format": { - "type": "spatialdata_table", - "version": 0.1 + { + "type": "filter_cs", + "expr": "global" }, - "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", - "transform": [ - { - "type": "filter_element", - "expr": "multi_table" - } - ] - }, - { - "name": "blobs_multiscale_labels_102ae6e3-75ff-4db1-9f71-05dbede9bedf", - "format": { - "type": "RasterFormatV02", - "version": "0.2" + { + "type": "filter_scale", + "expr": "full" }, - "source": "6292f1b9-dbbe-41ed-8184-792b31448d28", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multiscale_labels" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "filter_scale", - "expr": "full" - }, - { - "type": "lookup", - "from": "9d6b0d7d-e69e-4211-a9af-80254977e5d7", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["channel_1_sum"], - "as": ["channel_1_sum"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 512.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [512.0, 0.0], - "range": "height" + { + "type": "lookup", + "from": "b7065ffe-a034-4fca-9d33-a0f6ce2f6a23", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_0_sum"], + "as": ["channel_0_sum"], + "default": null + } + ] + }, + { + "name": "7cc5f031-332b-488d-a0aa-664492897497", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "color_3324069a-8eae-47ca-afc6-8571bef2355c", - "type": "linear", - "domain": { - "data": "blobs_labels_3438e488-e946-452a-adb9-4bbbf7cb7f53", - "field": ["channel_0_sum"] - }, - "range": { - "scheme": "viridis", - "count": 256 + "source": "3e9a598d-f682-434a-9513-e49924876bc1", + "transform": [ + { + "type": "filter_element", + "expr": "multi_table" } + ] + }, + { + "name": "blobs_multiscale_labels_19fc95a8-c587-4fa9-9327-69bbc0f99443", + "format": { + "type": "RasterFormatV02", + "version": "0.2" }, - { - "name": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", - "type": "linear", - "domain": { - "data": "blobs_multiscale_labels_102ae6e3-75ff-4db1-9f71-05dbede9bedf", - "field": ["channel_1_sum"] + "source": "3e9a598d-f682-434a-9513-e49924876bc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "7cc5f031-332b-488d-a0aa-664492897497", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["channel_1_sum"], + "as": ["channel_1_sum"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_bfd54971-c0e2-40d9-8dda-3b4c921ecd56", + "type": "linear", + "domain": { + "data": "blobs_labels_f0e0a437-1b06-4537-b99a-5ae30aae1dc9", + "field": ["channel_0_sum"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 100, 200, 300, 400, 500], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_3324069a-8eae-47ca-afc6-8571bef2355c", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.504005030744906, - "zindex": 0 + }, + { + "name": "color_dce43504-13d9-4fc5-9789-0b22d586ac5e", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_19fc95a8-c587-4fa9-9327-69bbc0f99443", + "field": ["channel_1_sum"] }, - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 0.4, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 266.5651200000001, - "legendY": 28.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "raster_label", - "from": { - "data": "blobs_labels_3438e488-e946-452a-adb9-4bbbf7cb7f53" - }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_3324069a-8eae-47ca-afc6-8571bef2355c", - "value": "channel_0_sum" - } - ], - "fill": [ - { - "scale": "color_3324069a-8eae-47ca-afc6-8571bef2355c", - "value": "channel_0_sum" - } - ], - "fillOpacity": { - "value": 0.4 - }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_bfd54971-c0e2-40d9-8dda-3b4c921ecd56", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 0.0, 250.0, 500.0, 750.0, 1000.0, 1250.0, 1500.0, 1750.0 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.504005030744906, + "zindex": 0 + }, + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_dce43504-13d9-4fc5-9789-0b22d586ac5e", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 0.4, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 266.5651200000001, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_f0e0a437-1b06-4537-b99a-5ae30aae1dc9" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_bfd54971-c0e2-40d9-8dda-3b4c921ecd56", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_bfd54971-c0e2-40d9-8dda-3b4c921ecd56", + "value": "channel_0_sum" } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_3324069a-8eae-47ca-afc6-8571bef2355c", - "field": "channel_0_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 3 } - } - }, - { - "type": "raster_label", - "from": { - "data": "blobs_multiscale_labels_102ae6e3-75ff-4db1-9f71-05dbede9bedf" }, - "zindex": 0, - "encode": { - "enter": { - "stroke": [ - { - "scale": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", - "value": "channel_1_sum" - } - ], - "fill": [ - { - "scale": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", - "value": "channel_1_sum" - } - ], - "fillOpacity": { - "value": 0.4 + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_bfd54971-c0e2-40d9-8dda-3b4c921ecd56", + "field": "channel_0_sum" }, - "strokeOpacity": { - "value": 0.0 - }, - "strokeWidth": { - "value": 3 + { + "value": "#d3d3d3ff" } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "blobs_multiscale_labels_19fc95a8-c587-4fa9-9327-69bbc0f99443" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_dce43504-13d9-4fc5-9789-0b22d586ac5e", + "value": "channel_1_sum" + } + ], + "fill": [ + { + "scale": "color_dce43504-13d9-4fc5-9789-0b22d586ac5e", + "value": "channel_1_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 }, - "update": { - "fill": [ - { - "test": "isValid(datum.value)", - "scale": "color_9ef90235-a9fb-4095-b1fe-07784bc6d6ea", - "field": "channel_1_sum" - }, - { - "value": "#d3d3d3ff" - } - ] + "strokeWidth": { + "value": 3 } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_dce43504-13d9-4fc5-9789-0b22d586ac5e", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] } } - ], - "usermeta": { - "axis_uuid": "fd90b106-e04c-5122-92b3-064155376445" } - } -] + ] +} diff --git a/tests/conftest.py b/tests/conftest.py index 43990fc3..d8024b4d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -442,7 +442,7 @@ def test_viewconfig_output(actual_json_path, expected_json_path): actual_json = json.load(f) with expected_json_path.open() as f: expected_json = json.load(f) - assert compare_json_ignore_uuids(actual_json, expected_json) + assert compare_json_ignore_uuids(actual_json, expected_json[0]) class PlotTesterMeta(ABCMeta): From 35467249f9d69b319dd4083488c7918764dc9098 Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 23 May 2025 19:39:16 +0200 Subject: [PATCH 54/56] update configs --- ...ints_can_annotate_points_with_table_X.json | 431 +++++---- ...annotate_points_with_table_and_groups.json | 419 +++++---- ..._can_annotate_points_with_table_layer.json | 437 +++++----- ...ts_can_annotate_points_with_table_obs.json | 431 +++++---- ...can_filter_with_groups_custom_palette.json | 817 ++++++++++-------- ...an_filter_with_groups_default_palette.json | 817 ++++++++++-------- .../Points_can_render_points.json | 301 ++++--- .../Points_can_stack_render_points.json | 395 +++++---- .../Points_can_use_norm_with_clip.json | 409 +++++---- .../Points_can_use_norm_without_clip.json | 409 +++++---- ...olor_recognises_actual_color_as_color.json | 301 ++++--- .../Points_coloring_with_cmap.json | 379 ++++---- .../Points_coloring_with_palette.json | 379 ++++---- ...ints_datashader_can_color_by_category.json | 399 +++++---- ...oints_datashader_can_transform_points.json | 321 ++++--- ...s_datashader_can_use_any_as_reduction.json | 431 +++++---- ...datashader_can_use_count_as_reduction.json | 431 +++++---- ...s_datashader_can_use_max_as_reduction.json | 431 +++++---- ..._datashader_can_use_mean_as_reduction.json | 431 +++++---- ...s_datashader_can_use_min_as_reduction.json | 431 +++++---- ...nts_datashader_can_use_norm_with_clip.json | 431 +++++---- ..._datashader_can_use_norm_without_clip.json | 431 +++++---- ...s_datashader_can_use_std_as_reduction.json | 431 +++++---- ...can_use_std_as_reduction_not_all_zero.json | 431 +++++---- ...s_datashader_can_use_sum_as_reduction.json | 431 +++++---- ...s_datashader_can_use_var_as_reduction.json | 431 +++++---- .../Points_datashader_continuous_color.json | 431 +++++---- .../Points_datashader_matplotlib_stack.json | 415 +++++---- ...atashader_norm_vmin_eq_vmax_with_clip.json | 431 +++++---- ...shader_norm_vmin_eq_vmax_without_clip.json | 431 +++++---- ...r_point_sizes_agree_after_altered_dpi.json | 415 +++++---- .../Points_points_categorical_color.json | 419 +++++---- ...s_categorical_color_column_datashader.json | 399 +++++---- ...s_categorical_color_column_matplotlib.json | 379 ++++---- ...ts_points_coercable_categorical_color.json | 419 +++++---- ...ts_continuous_color_column_datashader.json | 431 +++++---- ...ts_continuous_color_column_matplotlib.json | 389 ++++----- ...points_transformed_ds_agrees_with_mpl.json | 415 +++++---- ..._can_annotate_shapes_with_table_layer.json | 421 +++++---- .../Shapes_can_color_from_geodataframe.json | 373 ++++---- ...queried_shapes_elements_by_annotation.json | 601 +++++++------ ...lor_two_shapes_elements_by_annotation.json | 601 +++++++------ ...hapes_can_color_with_norm_no_clipping.json | 393 +++++---- .../Shapes_can_do_non_matching_table.json | 415 +++++---- .../Shapes_can_filter_with_groups.json | 785 +++++++++-------- ...h_annotation_despite_random_shuffling.json | 403 +++++---- ...s_can_plot_shapes_after_spatial_query.json | 447 +++++----- ...h_annotation_despite_random_shuffling.json | 403 +++++---- .../Shapes_can_render_circles.json | 287 +++--- ...n_render_circles_with_colored_outline.json | 305 ++++--- ...hapes_can_render_circles_with_outline.json | 305 ++++--- ..._circles_with_specified_outline_width.json | 305 ++++--- .../Shapes_can_render_empty_geometry.json | 447 +++++----- .../Shapes_can_render_multipolygons.json | 415 +++++---- .../Shapes_can_render_polygons.json | 287 +++--- ...apes_can_render_polygons_with_outline.json | 305 ++++--- ...der_polygons_with_rgb_colored_outline.json | 305 ++++--- ...er_polygons_with_rgba_colored_outline.json | 305 ++++--- ...der_polygons_with_str_colored_outline.json | 305 ++++--- .../Shapes_can_scale_shapes.json | 287 +++--- .../Shapes_can_set_clims_clip.json | 435 +++++----- .../Shapes_can_stack_render_shapes.json | 367 ++++---- ...olor_recognises_actual_color_as_color.json | 287 +++--- .../Shapes_colorbar_can_be_normalised.json | 393 +++++---- ...Shapes_colorbar_respects_input_limits.json | 373 ++++---- .../Shapes_coloring_with_palette.json | 363 ++++---- ...apes_datashader_can_color_by_category.json | 413 +++++---- ...tashader_can_color_by_identical_value.json | 405 +++++---- .../Shapes_datashader_can_color_by_value.json | 405 +++++---- ...ader_can_color_with_norm_and_clipping.json | 405 +++++---- ...hader_can_color_with_norm_no_clipping.json | 405 +++++---- ..._datashader_can_render_colored_shapes.json | 481 +++++------ .../Shapes_datashader_can_render_shapes.json | 481 +++++------ ...hader_can_render_with_colored_outline.json | 315 ++++--- ...er_can_render_with_diff_alpha_outline.json | 315 ++++--- ...er_can_render_with_diff_width_outline.json | 315 ++++--- ...hader_can_render_with_different_alpha.json | 481 +++++------ ...es_datashader_can_render_with_outline.json | 315 ++++--- ...r_can_render_with_rgb_colored_outline.json | 315 ++++--- ..._can_render_with_rgba_colored_outline.json | 315 ++++--- ...apes_datashader_can_transform_circles.json | 315 ++++--- ...atashader_can_transform_multipolygons.json | 315 ++++--- ...pes_datashader_can_transform_polygons.json | 315 ++++--- ...atashader_norm_vmin_eq_vmax_with_clip.json | 412 +++++---- ...shader_norm_vmin_eq_vmax_without_clip.json | 412 +++++---- ...es_datashader_shades_with_linear_cmap.json | 405 +++++---- .../Shapes_shapes_categorical_color.json | 403 +++++---- ...es_shapes_coercable_categorical_color.json | 403 +++++---- 88 files changed, 17684 insertions(+), 17940 deletions(-) diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json index e1ef0ea5..0520d1c1 100644 --- a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json @@ -1,231 +1,226 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3f246bc8-d27a-4987-906a-113fdff9b73a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "be39b901-24eb-469a-b339-928b63c9dc2a", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "befc7bf7-f8c6-45e8-9b1d-dba610466075", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "8e37e446-c2ef-48bb-af67-d815400f6f29", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "be39b901-24eb-469a-b339-928b63c9dc2a", - "transform": [ - { - "type": "filter_element", - "expr": "points_table" - } - ] + "source": "3f246bc8-d27a-4987-906a-113fdff9b73a", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" + } + ] + }, + { + "name": "blobs_points_d5e914c0-9e9d-4ec0-b492-c43a7e0f256d", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_0ca1f7d3-34ff-4b36-a00e-b9957a5b205a", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "3f246bc8-d27a-4987-906a-113fdff9b73a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "be39b901-24eb-469a-b339-928b63c9dc2a", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "8e37e446-c2ef-48bb-af67-d815400f6f29", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["feature0"], - "as": ["feature0"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", - "type": "linear", - "domain": { - "data": "blobs_points_0ca1f7d3-34ff-4b36-a00e-b9957a5b205a", - "field": ["feature0"] + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "befc7bf7-f8c6-45e8-9b1d-dba610466075", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["feature0"], + "as": ["feature0"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_f5977572-cbf6-4633-aa21-4d2e96ba2f21", + "type": "linear", + "domain": { + "data": "blobs_points_d5e914c0-9e9d-4ec0-b492-c43a7e0f256d", + "field": ["feature0"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_0ca1f7d3-34ff-4b36-a00e-b9957a5b205a" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", - "value": "feature0" - }, - "fill": { - "scale": "color_8b1546a7-c663-414a-8c13-bda8c44f56ff", - "value": "feature0" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f5977572-cbf6-4633-aa21-4d2e96ba2f21", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_d5e914c0-9e9d-4ec0-b492-c43a7e0f256d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_f5977572-cbf6-4633-aa21-4d2e96ba2f21", + "value": "feature0" + }, + "fill": { + "scale": "color_f5977572-cbf6-4633-aa21-4d2e96ba2f21", + "value": "feature0" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.feature0)", - "value": "#d3d3d3" - } - ] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "5b3a3eab-d256-5a25-bc75-ca83f255117c" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json index 4eb4d159..8b837454 100644 --- a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json @@ -1,225 +1,220 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f1c997f1-0282-4235-8c21-8520830b4d81", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "a00b5c40-3b37-48fc-9b49-e3a02d11a76a", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "d1621d9d-8bde-4b39-955d-2de0c5cc717b", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "f1c997f1-0282-4235-8c21-8520830b4d81", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" } + ] + }, + { + "name": "blobs_points_09dbc7cc-ab53-4315-a9c8-c634b88413b9", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "4107814a-544f-4186-9616-cf3ef40a11fd", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "f1c997f1-0282-4235-8c21-8520830b4d81", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "a00b5c40-3b37-48fc-9b49-e3a02d11a76a", - "transform": [ - { - "type": "filter_element", - "expr": "points_table" - } - ] - }, - { - "name": "blobs_points_5ded845f-6951-46bd-be0b-f1921ce917c9", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + { + "type": "filter_cs", + "expr": "global" }, - "source": "a00b5c40-3b37-48fc-9b49-e3a02d11a76a", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "lookup", + "from": "d1621d9d-8bde-4b39-955d-2de0c5cc717b", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["extra_feature_cat"], + "as": ["extra_feature_cat"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_8e6292bc-8dbd-4805-b45a-fe3b9ad2d41f", + "type": "ordinal", + "domain": ["two"], + "range": ["#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_8e6292bc-8dbd-4805-b45a-fe3b9ad2d41f", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 253.59055555555548, + "legendY": 239.39555555555555 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_09dbc7cc-ab53-4315-a9c8-c634b88413b9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_8e6292bc-8dbd-4805-b45a-fe3b9ad2d41f", + "field": "extra_feature_cat" + }, + "fill": { + "scale": "color_8e6292bc-8dbd-4805-b45a-fe3b9ad2d41f", + "field": "extra_feature_cat" }, - { - "type": "filter_cs", - "expr": "global" + "fillOpacity": { + "value": 1.0 }, - { - "type": "lookup", - "from": "4107814a-544f-4186-9616-cf3ef40a11fd", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["extra_feature_cat"], - "as": ["extra_feature_cat"], - "default": null + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", - "type": "ordinal", - "domain": ["two"], - "range": ["#ff7f0e"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 253.59055555555548, - "legendY": 239.39555555555555 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_5ded845f-6951-46bd-be0b-f1921ce917c9" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", - "field": "extra_feature_cat" - }, - "fill": { - "scale": "color_ba262afd-c10c-4b56-a4af-e62641e52bd2", - "field": "extra_feature_cat" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.extra_feature_cat)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.extra_feature_cat)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "2c539bdf-7947-5742-9fa3-7efea6df4524" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json index ee85b206..0a5af779 100644 --- a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json @@ -1,235 +1,230 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "99002bc0-cf06-4295-bc99-ca9bd71afe2e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "edcb867d-2eb5-4945-95ae-10850ca6efca", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "a47c9e4b-cd9c-4994-9377-ec4b84301ff4", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "9af66692-ce55-4fb3-a3ba-514c3a8c1f1a", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "99002bc0-cf06-4295-bc99-ca9bd71afe2e", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" }, - "source": "edcb867d-2eb5-4945-95ae-10850ca6efca", - "transform": [ - { - "type": "filter_element", - "expr": "points_table" - }, - { - "type": "filter_layer", - "expr": "normalized" - } - ] + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_points_5a7eabd3-fa6a-4a8b-bf45-e8b271619a55", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_456654bd-137e-4588-9dc5-c00f2b95e673", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "99002bc0-cf06-4295-bc99-ca9bd71afe2e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "edcb867d-2eb5-4945-95ae-10850ca6efca", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "9af66692-ce55-4fb3-a3ba-514c3a8c1f1a", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["feature0"], - "as": ["feature0"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", - "type": "linear", - "domain": { - "data": "blobs_points_456654bd-137e-4588-9dc5-c00f2b95e673", - "field": ["feature0"] + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "a47c9e4b-cd9c-4994-9377-ec4b84301ff4", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["feature0"], + "as": ["feature0"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_ad93d6a2-e5bf-438b-8414-39d77febe5ed", + "type": "linear", + "domain": { + "data": "blobs_points_5a7eabd3-fa6a-4a8b-bf45-e8b271619a55", + "field": ["feature0"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_456654bd-137e-4588-9dc5-c00f2b95e673" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", - "value": "feature0" - }, - "fill": { - "scale": "color_68bf9617-a3ba-41cd-9a14-de7980c50ea0", - "value": "feature0" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_ad93d6a2-e5bf-438b-8414-39d77febe5ed", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_5a7eabd3-fa6a-4a8b-bf45-e8b271619a55" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_ad93d6a2-e5bf-438b-8414-39d77febe5ed", + "value": "feature0" + }, + "fill": { + "scale": "color_ad93d6a2-e5bf-438b-8414-39d77febe5ed", + "value": "feature0" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.feature0)", - "value": "#d3d3d3" - } - ] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "5c53e2fb-56ab-5bf5-9112-6f3f427e15a6" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json index 647bcd04..afb88f71 100644 --- a/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json @@ -1,231 +1,226 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3d941238-ef1f-418a-ac2d-326512b5a3f1", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1ee8be21-3878-482d-a65c-63f7d05354e6", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "1ff46703-be53-4b80-95df-f6995a1e9ba5", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "955a1874-5c47-4c9d-8e83-20090a682260", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "1ee8be21-3878-482d-a65c-63f7d05354e6", - "transform": [ - { - "type": "filter_element", - "expr": "points_table" - } - ] + "source": "3d941238-ef1f-418a-ac2d-326512b5a3f1", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" + } + ] + }, + { + "name": "blobs_points_46d740f2-95d8-481c-b0d9-1109b1514765", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_5bf4fe35-5fbf-4ed8-a9d3-a0205864d3b1", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "3d941238-ef1f-418a-ac2d-326512b5a3f1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "1ee8be21-3878-482d-a65c-63f7d05354e6", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "955a1874-5c47-4c9d-8e83-20090a682260", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["extra_feature"], - "as": ["extra_feature"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", - "type": "linear", - "domain": { - "data": "blobs_points_5bf4fe35-5fbf-4ed8-a9d3-a0205864d3b1", - "field": ["extra_feature"] + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "1ff46703-be53-4b80-95df-f6995a1e9ba5", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["extra_feature"], + "as": ["extra_feature"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_5b8d274a-67ce-47ae-bd71-39ad784ce0bc", + "type": "linear", + "domain": { + "data": "blobs_points_46d740f2-95d8-481c-b0d9-1109b1514765", + "field": ["extra_feature"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_5bf4fe35-5fbf-4ed8-a9d3-a0205864d3b1" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", - "value": "extra_feature" - }, - "fill": { - "scale": "color_cf4dbfae-3ecc-4a27-830c-db03d22fa089", - "value": "extra_feature" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_5b8d274a-67ce-47ae-bd71-39ad784ce0bc", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_46d740f2-95d8-481c-b0d9-1109b1514765" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_5b8d274a-67ce-47ae-bd71-39ad784ce0bc", + "value": "extra_feature" + }, + "fill": { + "scale": "color_5b8d274a-67ce-47ae-bd71-39ad784ce0bc", + "value": "extra_feature" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.extra_feature)", - "value": "#d3d3d3" - } - ] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.extra_feature)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "99254edd-1775-56de-94ad-27bda952001b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json b/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json index 72c21737..ef69d5ad 100644 --- a/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json +++ b/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json @@ -1,402 +1,459 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "data": [ + { + "name": "be571835-0411-46c4-821e-b5203f52b7ba", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f7c98e12-e91a-47ad-ba47-9fbccb8c7541", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_6927a15f-d822-44e1-9372-1e588ac2bf9d", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_3d3883e7-95e6-4bc7-8391-42302e0331cb", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "be571835-0411-46c4-821e-b5203f52b7ba", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "f7c98e12-e91a-47ad-ba47-9fbccb8c7541", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 57.599999999999994 + }, + "y": { + "value": 94.0090549766439 }, - { - "type": "filter_cs", - "expr": "global" + "width": { + "value": 113.45454545454545 + }, + "height": { + "value": 112.78189004671219 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", - "type": "ordinal", - "domain": ["gene_a", "gene_b"], - "range": ["#1f77b4", "#ff7f0e"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [250, 500], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 64.75555555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_3d3883e7-95e6-4bc7-8391-42302e0331cb" + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", - "field": "genes" - }, - "fill": { - "scale": "color_0c73c30d-47cb-46cc-9232-00fda1253e87", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + { + "name": "Y_scale_0", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_c4c04e95-02a8-49e1-ab2a-e6dc46580d0b", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale_0", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_0", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_c4c04e95-02a8-49e1-ab2a-e6dc46580d0b", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 64.75555555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_6927a15f-d822-44e1-9372-1e588ac2bf9d" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_c4c04e95-02a8-49e1-ab2a-e6dc46580d0b", + "field": "genes" + }, + "fill": { + "scale": "color_c4c04e95-02a8-49e1-ab2a-e6dc46580d0b", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } - ] + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 93.57727272727273 + }, + "y": { + "value": 75.3423883099772 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "ecb0286a-0f48-5226-9c23-bd1425f8dea7" - } - }, - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 + ] }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "a9e0f64c-66fe-4d54-bc68-115c1235d54e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 94.0090549766439 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 112.78189004671218 + } } }, - { - "name": "blobs_points_3bef6fc7-14cc-45b7-b5b1-5860cf747f6a", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale_1", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" }, - "source": "a9e0f64c-66fe-4d54-bc68-115c1235d54e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "name": "color_ad30a10d-86cb-4e83-ba96-ddd36a5e2b96", + "type": "ordinal", + "domain": ["gene_b"], + "range": ["#ff0000"] + } + ], + "axes": [ + { + "scale": "X_scale_1", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_1", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_ad30a10d-86cb-4e83-ba96-ddd36a5e2b96", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 239.25493055555555 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_36368c15-17b5-4b7a-b090-177c65b93de6" }, - { - "type": "filter_cs", - "expr": "global" + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_ad30a10d-86cb-4e83-ba96-ddd36a5e2b96", + "field": "genes" + }, + "fill": { + "scale": "color_ad30a10d-86cb-4e83-ba96-ddd36a5e2b96", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", - "type": "ordinal", - "domain": ["gene_b"], - "range": ["#ff0000"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [250, 500], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 228.2155555555555, - "legendY": 239.25493055555555 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_3bef6fc7-14cc-45b7-b5b1-5860cf747f6a" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", - "field": "genes" - }, - "fill": { - "scale": "color_b76430ca-1e52-4fe2-b379-d0e309082c1e", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 229.72272727272727 + }, + "y": { + "value": 75.3423883099772 + }, + "linebreak": { + "value": "\n" + } } }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" - } - ] - } + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "c98c320d-229b-5b77-87a3-0cdf8396a0ac" + ] } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json b/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json index 9ac4c56c..092f9da0 100644 --- a/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json +++ b/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json @@ -1,402 +1,459 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "data": [ + { + "name": "aa47f50c-0a7d-420a-9b21-0c24df85042f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1f00c11b-4746-44e8-a411-96fd9edcff4f", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_f3bf5183-daaf-445e-b965-28888359c8dd", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_e8bd78b8-9f2a-4f8a-a996-7d3848cb5197", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "aa47f50c-0a7d-420a-9b21-0c24df85042f", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "1f00c11b-4746-44e8-a411-96fd9edcff4f", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 57.599999999999994 + }, + "y": { + "value": 94.0090549766439 }, - { - "type": "filter_cs", - "expr": "global" + "width": { + "value": 113.45454545454545 + }, + "height": { + "value": 112.78189004671219 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", - "type": "ordinal", - "domain": ["gene_a", "gene_b"], - "range": ["#1f77b4", "#ff7f0e"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [250, 500], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 64.75555555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_e8bd78b8-9f2a-4f8a-a996-7d3848cb5197" + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", - "field": "genes" - }, - "fill": { - "scale": "color_857b0e80-4db8-45af-bdd1-a09337a02cff", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + { + "name": "Y_scale_0", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_ee6a37e1-018d-4781-a069-33deb193d829", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale_0", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_0", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_ee6a37e1-018d-4781-a069-33deb193d829", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 64.75555555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_f3bf5183-daaf-445e-b965-28888359c8dd" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_ee6a37e1-018d-4781-a069-33deb193d829", + "field": "genes" + }, + "fill": { + "scale": "color_ee6a37e1-018d-4781-a069-33deb193d829", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } - ] + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 93.57727272727273 + }, + "y": { + "value": 75.3423883099772 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "76de073a-f5b7-53aa-bd3a-baad40bc0bd8" - } - }, - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 + ] }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "4a500245-da71-4a64-bf7b-fc2473f3c84b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 94.0090549766439 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 112.78189004671218 + } } }, - { - "name": "blobs_points_0d6aa88e-245c-42f2-916b-18988c161e08", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale_1", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" }, - "source": "4a500245-da71-4a64-bf7b-fc2473f3c84b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "name": "color_158499d3-3e8a-4f14-abc3-5365e00dd833", + "type": "ordinal", + "domain": ["gene_b"], + "range": ["#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale_1", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [250, 500], + "zindex": 1.5 + }, + { + "scale": "Y_scale_1", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_158499d3-3e8a-4f14-abc3-5365e00dd833", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 239.25493055555555 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_ca943207-4b4c-48d0-a494-e175ed6aad40" }, - { - "type": "filter_cs", - "expr": "global" + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_158499d3-3e8a-4f14-abc3-5365e00dd833", + "field": "genes" + }, + "fill": { + "scale": "color_158499d3-3e8a-4f14-abc3-5365e00dd833", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_2428a622-3592-409e-811c-942e23d57a16", - "type": "ordinal", - "domain": ["gene_b"], - "range": ["#ff7f0e"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [250, 500], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_2428a622-3592-409e-811c-942e23d57a16", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 228.2155555555555, - "legendY": 239.25493055555555 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_0d6aa88e-245c-42f2-916b-18988c161e08" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_2428a622-3592-409e-811c-942e23d57a16", - "field": "genes" - }, - "fill": { - "scale": "color_2428a622-3592-409e-811c-942e23d57a16", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 229.72272727272727 + }, + "y": { + "value": 75.3423883099772 + }, + "linebreak": { + "value": "\n" + } } }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" - } - ] - } + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "87f0752f-860a-5611-a0cf-80803dd0f5de" + ] } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_render_points.json b/tests/_figures_viewconfig/Points_can_render_points.json index 99e8947e..52b87aed 100644 --- a/tests/_figures_viewconfig/Points_can_render_points.json +++ b/tests/_figures_viewconfig/Points_can_render_points.json @@ -1,161 +1,156 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "16a3d04e-4014-4fcf-9320-f201516f7866", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "800e478c-fe58-4a19-9c73-8d4a794ea1aa", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_068027f8-b0ff-47de-834a-6dc306f1674f", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_29bec1ca-a707-438c-a110-a7724821887a", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "16a3d04e-4014-4fcf-9320-f201516f7866", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "800e478c-fe58-4a19-9c73-8d4a794ea1aa", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_068027f8-b0ff-47de-834a-6dc306f1674f" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_29bec1ca-a707-438c-a110-a7724821887a" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#d3d3d3" - }, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#d3d3d3" + }, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } } } - ], - "usermeta": { - "axis_uuid": "e0d9ea92-0131-5f68-9a44-bb4d370f0f5c" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_stack_render_points.json b/tests/_figures_viewconfig/Points_can_stack_render_points.json index 48a34346..6fd863b5 100644 --- a/tests/_figures_viewconfig/Points_can_stack_render_points.json +++ b/tests/_figures_viewconfig/Points_can_stack_render_points.json @@ -1,213 +1,208 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "322e8e79-82b9-40f3-a65d-013d13a92692", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "2988b30f-e534-4d36-bfef-7f4380e85dc1", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_de2155f4-c647-473b-bf40-dbdb7784be5b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_d191a846-afca-4003-a386-1f0be215a11c", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "322e8e79-82b9-40f3-a65d-013d13a92692", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "2988b30f-e534-4d36-bfef-7f4380e85dc1", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_points_4d57b93c-6c4d-4766-907b-dedfc800e048", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_0092eba3-a066-43be-8ebe-c7dd7dd19460", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "322e8e79-82b9-40f3-a65d-013d13a92692", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "2988b30f-e534-4d36-bfef-7f4380e85dc1", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_de2155f4-c647-473b-bf40-dbdb7784be5b" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_d191a846-afca-4003-a386-1f0be215a11c" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#ff0000" - }, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 30 - }, - "shape": { - "value": "circle" - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ff0000" + }, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 30 + }, + "shape": { + "value": "circle" } } + } + }, + { + "type": "symbol", + "from": { + "data": "blobs_points_4d57b93c-6c4d-4766-907b-dedfc800e048" }, - { - "type": "symbol", - "from": { - "data": "blobs_points_0092eba3-a066-43be-8ebe-c7dd7dd19460" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#0000ff" - }, - "fill": { - "value": "#0000ff" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#0000ff" + }, + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } } } - ], - "usermeta": { - "axis_uuid": "d31d154a-118b-5e6b-bab3-5bd254d8cc8a" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json b/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json index c08a4827..58cc3510 100644 --- a/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json +++ b/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json @@ -1,221 +1,216 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "83135f09-a388-4622-8cf9-de7306cab9ad", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "c9f144c2-a482-49ca-bb25-005db55e4612", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_abae57c5-0a4c-4f0d-97a3-3cafcfd1ce26", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_7e3f8310-dc2a-428a-b57c-f861e8d42213", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "83135f09-a388-4622-8cf9-de7306cab9ad", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "c9f144c2-a482-49ca-bb25-005db55e4612", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "formula", - "expr": "clamp((datum.value - 3.0) / (7.0 - 3.0), 0, 1)", - "as": "92dab238-d55c-4601-8445-c43758de4ba9" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", - "type": "linear", - "domain": { - "data": "blobs_points_7e3f8310-dc2a-428a-b57c-f861e8d42213", - "field": "92dab238-d55c-4601-8445-c43758de4ba9" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 3.0) / (7.0 - 3.0), 0, 1)", + "as": "72384dc8-4c10-4402-88a9-0761e73a8555" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_fc3ba8f9-bee3-4164-b1fa-b82144ecb7ec", + "type": "linear", + "domain": { + "data": "blobs_points_abae57c5-0a4c-4f0d-97a3-3cafcfd1ce26", + "field": "72384dc8-4c10-4402-88a9-0761e73a8555" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [3.0, 4.0, 5.0, 6.0, 7.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_7e3f8310-dc2a-428a-b57c-f861e8d42213" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_fc3ba8f9-bee3-4164-b1fa-b82144ecb7ec", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_abae57c5-0a4c-4f0d-97a3-3cafcfd1ce26" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_fc3ba8f9-bee3-4164-b1fa-b82144ecb7ec", + "value": "72384dc8-4c10-4402-88a9-0761e73a8555" + }, + "fill": { + "scale": "color_fc3ba8f9-bee3-4164-b1fa-b82144ecb7ec", + "value": "72384dc8-4c10-4402-88a9-0761e73a8555" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", - "value": "92dab238-d55c-4601-8445-c43758de4ba9" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_4f10978f-2cce-416d-b8c7-c5783bf861b7", - "value": "92dab238-d55c-4601-8445-c43758de4ba9" + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 3.0", - "value": "#000000" - }, - { - "test": "datum.instance_id) > 7.0", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "bc41c6ab-c0a9-5d6a-a629-4edc12d8a1fb" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json b/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json index ef47124f..39824162 100644 --- a/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json +++ b/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json @@ -1,221 +1,216 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fba62948-61fb-4b42-9ede-7e38dab8a46e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "b991e0a5-bbfd-4561-8bcd-84eab170dd74", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_9e4f57d8-7506-438f-af2b-cb6c07403a4b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_39d8691f-4b0c-4974-8e54-86d9be6f3217", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "fba62948-61fb-4b42-9ede-7e38dab8a46e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "b991e0a5-bbfd-4561-8bcd-84eab170dd74", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "formula", - "expr": "(datum.value - 3.0) / (7.0 - 3.0)", - "as": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", - "type": "linear", - "domain": { - "data": "blobs_points_39d8691f-4b0c-4974-8e54-86d9be6f3217", - "field": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 3.0) / (7.0 - 3.0)", + "as": "d2cc8577-63fd-4327-9594-e8e9a7a98fcd" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_0b3b941a-b8a7-4c99-af39-2e76102dfa8b", + "type": "linear", + "domain": { + "data": "blobs_points_9e4f57d8-7506-438f-af2b-cb6c07403a4b", + "field": "d2cc8577-63fd-4327-9594-e8e9a7a98fcd" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [3.0, 4.0, 5.0, 6.0, 7.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_39d8691f-4b0c-4974-8e54-86d9be6f3217" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_0b3b941a-b8a7-4c99-af39-2e76102dfa8b", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_9e4f57d8-7506-438f-af2b-cb6c07403a4b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_0b3b941a-b8a7-4c99-af39-2e76102dfa8b", + "value": "d2cc8577-63fd-4327-9594-e8e9a7a98fcd" + }, + "fill": { + "scale": "color_0b3b941a-b8a7-4c99-af39-2e76102dfa8b", + "value": "d2cc8577-63fd-4327-9594-e8e9a7a98fcd" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", - "value": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_96c410a6-43e5-4e6a-a929-f2b14dc57666", - "value": "04d277d1-cfca-4f1a-b3ee-3b6b465cd63a" + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 3.0", - "value": "#000000" - }, - { - "test": "datum.instance_id) > 7.0", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "a8d2103d-77f2-54cf-840e-dbd86e030b70" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json b/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json index a0dad7bc..5c67b4eb 100644 --- a/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json +++ b/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json @@ -1,161 +1,156 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "42b205fa-d6e0-44a8-85a3-25acbf52aa9e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "2e33b710-1336-43e8-a894-76615b6d159b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_593211b0-ae6e-41d9-8b26-bbe9c6c46580", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_2c8944e0-d58c-4821-b226-7c1bf0391248", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "42b205fa-d6e0-44a8-85a3-25acbf52aa9e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "2e33b710-1336-43e8-a894-76615b6d159b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_593211b0-ae6e-41d9-8b26-bbe9c6c46580" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_2c8944e0-d58c-4821-b226-7c1bf0391248" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#ff0000" - }, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ff0000" + }, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } } } - ], - "usermeta": { - "axis_uuid": "092a9afa-d843-5295-be01-487eecc277ed" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_coloring_with_cmap.json b/tests/_figures_viewconfig/Points_coloring_with_cmap.json index e81458b8..f533cd8f 100644 --- a/tests/_figures_viewconfig/Points_coloring_with_cmap.json +++ b/tests/_figures_viewconfig/Points_coloring_with_cmap.json @@ -1,202 +1,197 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "75b59781-1162-4506-bd17-98b42267e110", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "bb48e2f0-f0e5-4a00-936d-717d4cfc34e0", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_0931a066-1c38-453c-a1e1-80dbea88b4c0", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_30e12d8e-0316-4b1d-be8a-deef59ecc26d", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "75b59781-1162-4506-bd17-98b42267e110", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "bb48e2f0-f0e5-4a00-936d-717d4cfc34e0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_b48dc294-3e50-47f3-b3cd-c2462fd66b51", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#8000ff", "#ff0000"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_b48dc294-3e50-47f3-b3cd-c2462fd66b51", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 217.95875 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_0931a066-1c38-453c-a1e1-80dbea88b4c0" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "filter_cs", - "expr": "global" + "stroke": { + "scale": "color_b48dc294-3e50-47f3-b3cd-c2462fd66b51", + "field": "genes" + }, + "fill": { + "scale": "color_b48dc294-3e50-47f3-b3cd-c2462fd66b51", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", - "type": "ordinal", - "domain": ["gene_a", "gene_b"], - "range": ["#8000ff", "#ff0000"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 228.2155555555555, - "legendY": 217.95875 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_30e12d8e-0316-4b1d-be8a-deef59ecc26d" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", - "field": "genes" - }, - "fill": { - "scale": "color_1a9abef0-d3b1-4b35-8e2a-3ebee601d1e6", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "e42c5ca4-6b5e-5541-abb2-1c2df673c824" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_coloring_with_palette.json b/tests/_figures_viewconfig/Points_coloring_with_palette.json index 0362f006..b552ed8f 100644 --- a/tests/_figures_viewconfig/Points_coloring_with_palette.json +++ b/tests/_figures_viewconfig/Points_coloring_with_palette.json @@ -1,202 +1,197 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7f7bba57-d695-4be7-abbb-7c35c6749d96", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "13388e27-1782-4b87-8281-c0ddb14aae1b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_041bdafa-2c77-4fa9-9ace-34ef4c3f856c", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_52fb5fc0-9afc-4a57-a869-c39571a5ffbc", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "7f7bba57-d695-4be7-abbb-7c35c6749d96", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "13388e27-1782-4b87-8281-c0ddb14aae1b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_2ef2dae0-98d4-456f-a139-ffbf7a7ed66b", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#90ee90", "#00008b"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_2ef2dae0-98d4-456f-a139-ffbf7a7ed66b", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 217.95875 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_041bdafa-2c77-4fa9-9ace-34ef4c3f856c" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "filter_cs", - "expr": "global" + "stroke": { + "scale": "color_2ef2dae0-98d4-456f-a139-ffbf7a7ed66b", + "field": "genes" + }, + "fill": { + "scale": "color_2ef2dae0-98d4-456f-a139-ffbf7a7ed66b", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_8b794912-322f-4224-b94a-d46d9cf07caa", - "type": "ordinal", - "domain": ["gene_a", "gene_b"], - "range": ["#90ee90", "#00008b"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_8b794912-322f-4224-b94a-d46d9cf07caa", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 228.2155555555555, - "legendY": 217.95875 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_52fb5fc0-9afc-4a57-a869-c39571a5ffbc" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_8b794912-322f-4224-b94a-d46d9cf07caa", - "field": "genes" - }, - "fill": { - "scale": "color_8b794912-322f-4224-b94a-d46d9cf07caa", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "56c80743-91e0-53d6-b998-e32915e55eac" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json b/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json index be28e53c..8a2dc1fd 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json +++ b/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json @@ -1,214 +1,209 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "39c3e105-9059-4e61-8e84-f248c21a9b4c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "e960e36b-8d16-4105-b7be-fb3f6f948b39", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_97f7724d-b13b-4239-a028-9f60474b7103", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_db7b1313-a14c-4c36-a92b-67ea2fae974b", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "39c3e105-9059-4e61-8e84-f248c21a9b4c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" }, - "source": "e960e36b-8d16-4105-b7be-fb3f6f948b39", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "aggregate", + "field": ["genes"], + "ops": ["count"], + "as": ["genes"] + }, + { + "type": "spread", + "field": ["genes"], + "px": 4, + "as": ["genes"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_9dd2a41a-8a3f-4085-9340-096ca9ec56cb", + "type": "ordinal", + "domain": ["gene_b"], + "range": ["#90ee90"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_9dd2a41a-8a3f-4085-9340-096ca9ec56cb", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_97f7724d-b13b-4239-a028-9f60474b7103" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_9dd2a41a-8a3f-4085-9340-096ca9ec56cb", + "field": "genes" + }, + "fill": { + "scale": "color_9dd2a41a-8a3f-4085-9340-096ca9ec56cb", + "field": "genes" }, - { - "type": "filter_cs", - "expr": "global" + "fillOpacity": { + "value": 1.0 }, - { - "type": "aggregate", - "field": ["genes"], - "ops": ["count"], - "as": ["genes"] + "size": { + "value": 20 }, - { - "type": "spread", - "field": ["genes"], - "px": 4, - "as": ["genes"] + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", - "type": "ordinal", - "domain": ["gene_b"], - "range": ["#90ee90"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 228.2155555555555, - "legendY": 35.955555555555634 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_db7b1313-a14c-4c36-a92b-67ea2fae974b" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", - "field": "genes" - }, - "fill": { - "scale": "color_d1418d65-2d63-41ab-afff-e52b3dae1f16", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 20 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "9e021ca3-a6a0-5755-90c1-d4c752f6ec7d" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_transform_points.json b/tests/_figures_viewconfig/Points_datashader_can_transform_points.json index 74b196f3..f614c025 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_transform_points.json +++ b/tests/_figures_viewconfig/Points_datashader_can_transform_points.json @@ -1,173 +1,168 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "391aff9d-0c22-4df0-bfb3-1fb464031f39", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "470bfbb0-19c8-4386-9cca-62940b06c8ca", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_a51f2137-2eee-43cb-b5cb-58ed1bf4e42d", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_677ad7a8-dfd0-4522-9679-442a0dab40b6", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "391aff9d-0c22-4df0-bfb3-1fb464031f39", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "470bfbb0-19c8-4386-9cca-62940b06c8ca", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + }, + { + "type": "spread", + "field": ["count"], + "px": 2, + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-775.2755253544179, 221.90573056245066], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-33.48962122763029, -840.7483983512892], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-600, -400, -200, 0, 200], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-800, -600, -400, -200], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_a51f2137-2eee-43cb-b5cb-58ed1bf4e42d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] + "stroke": { + "value": "#000000" }, - { - "type": "spread", - "field": ["count"], - "px": 2, - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [-775.2755253544179, 221.90573056245066], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [-33.48962122763029, -840.7483983512892], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-600, -400, -200, 0, 200], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-800, -600, -400, -200], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_677ad7a8-dfd0-4522-9679-442a0dab40b6" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#000000" - }, - "fill": { - "value": "#000000" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 5 - }, - "shape": { - "value": "circle" - } + "fill": { + "value": "#000000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 5 + }, + "shape": { + "value": "circle" } } } - ], - "usermeta": { - "axis_uuid": "38a61546-4c9f-5ba6-bb81-53bdab597e34" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json index 18acadf1..e5739ef2 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7622c398-0b66-400e-9b66-a67a7e7ca416", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "e36f96f9-57ec-4cc2-95cc-f5cfebfb4ac0", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_72899df1-8d1f-46ed-92d3-de89569a6dc6", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_5f1df256-43e3-436b-949c-48b3af79677a", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "7622c398-0b66-400e-9b66-a67a7e7ca416", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["any"], + "as": ["instance_id"] }, - "source": "e36f96f9-57ec-4cc2-95cc-f5cfebfb4ac0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 1.0) / (2.0 - 1.0)", + "as": "fbce1b09-0dbc-4eb6-ad66-fcdcde7f7f3a" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_08e89279-7627-4b17-99b2-4ba6ce3f5db9", + "type": "linear", + "domain": { + "data": "blobs_points_72899df1-8d1f-46ed-92d3-de89569a6dc6", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_08e89279-7627-4b17-99b2-4ba6ce3f5db9", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_72899df1-8d1f-46ed-92d3-de89569a6dc6" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["any"], - "as": ["instance_id"] + "stroke": { + "scale": "color_08e89279-7627-4b17-99b2-4ba6ce3f5db9", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 1.0) / (2.0 - 1.0)", - "as": "fcfba37c-e0e6-48a7-9745-2d19a076b1d8" + "fill": { + "scale": "color_08e89279-7627-4b17-99b2-4ba6ce3f5db9", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", - "type": "linear", - "domain": { - "data": "blobs_points_5f1df256-43e3-436b-949c-48b3af79677a", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_5f1df256-43e3-436b-949c-48b3af79677a" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_8a9f6933-7822-4641-927a-56ce5989a1b3", - "value": "instance_id" + { + "test": "datum.instance_id) < 1.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 2.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 1.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 2.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "687645d2-ed9d-5f2d-a26d-1261069cad7a" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json index 4c4eb426..0408dd47 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cdb9d2a3-d822-43b7-aaf7-b430a06ef57b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "63e0d1c4-ee8a-48bd-a201-58b57be9ee3d", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_0e72a2ad-b47b-49b9-924b-33912c46dd26", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_174854c6-5322-48cd-8218-be7f8636f3c9", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "cdb9d2a3-d822-43b7-aaf7-b430a06ef57b", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["count"], + "as": ["instance_id"] }, - "source": "63e0d1c4-ee8a-48bd-a201-58b57be9ee3d", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0) / (4 - 0)", + "as": "f40aece7-eb8c-4421-9029-c32fa8cf382a" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_9b5890e1-98c2-49e7-acbe-5f71c7194e50", + "type": "linear", + "domain": { + "data": "blobs_points_0e72a2ad-b47b-49b9-924b-33912c46dd26", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_9b5890e1-98c2-49e7-acbe-5f71c7194e50", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 1.0, 2.0, 3.0, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_0e72a2ad-b47b-49b9-924b-33912c46dd26" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["count"], - "as": ["instance_id"] + "stroke": { + "scale": "color_9b5890e1-98c2-49e7-acbe-5f71c7194e50", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0) / (4 - 0)", - "as": "03131f92-2148-43d8-aa35-082dca416e1c" + "fill": { + "scale": "color_9b5890e1-98c2-49e7-acbe-5f71c7194e50", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", - "type": "linear", - "domain": { - "data": "blobs_points_174854c6-5322-48cd-8218-be7f8636f3c9", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 1.0, 2.0, 3.0, 4.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_174854c6-5322-48cd-8218-be7f8636f3c9" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_1bb047cb-32c5-482e-81cc-514ebfaa223a", - "value": "instance_id" + { + "test": "datum.instance_id) < 0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 4", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 4", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "4cf9436a-d0fa-5616-9a0c-d199405948ac" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json index d2aa5d50..c5fc2dec 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "45709ce9-5f65-4597-9948-3e04f7a4fbf9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "581a9a51-b23b-4e3e-9661-bae3df8a8401", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_79d47228-ce3d-494c-b4a3-5921042c4a78", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_19dcb55a-628b-42a1-a780-3646bcf77ed0", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "45709ce9-5f65-4597-9948-3e04f7a4fbf9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] }, - "source": "581a9a51-b23b-4e3e-9661-bae3df8a8401", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", + "as": "f3315585-7e01-4e53-9b01-1624f91cade6" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_4a15eeb1-67a6-4e6f-9e98-cca461d6145f", + "type": "linear", + "domain": { + "data": "blobs_points_79d47228-ce3d-494c-b4a3-5921042c4a78", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_4a15eeb1-67a6-4e6f-9e98-cca461d6145f", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_79d47228-ce3d-494c-b4a3-5921042c4a78" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["max"], - "as": ["instance_id"] + "stroke": { + "scale": "color_4a15eeb1-67a6-4e6f-9e98-cca461d6145f", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", - "as": "574c3a0e-9fcf-42d3-8d3c-cde901f15962" + "fill": { + "scale": "color_4a15eeb1-67a6-4e6f-9e98-cca461d6145f", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_e0adcb61-4468-4309-b011-19edb4b01312", - "type": "linear", - "domain": { - "data": "blobs_points_19dcb55a-628b-42a1-a780-3646bcf77ed0", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_e0adcb61-4468-4309-b011-19edb4b01312", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_19dcb55a-628b-42a1-a780-3646bcf77ed0" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_e0adcb61-4468-4309-b011-19edb4b01312", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_e0adcb61-4468-4309-b011-19edb4b01312", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 9.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 9.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "c149e50d-ae74-5f87-86a3-84b651810298" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json index 33496927..12954ab2 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9dd35f19-a1b0-4dce-b59d-7f3514202d06", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "9b74f0ec-208d-497e-82ec-0c357cc54c20", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_d5dbde4c-0908-4d4e-b664-71b63d826eda", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_c948e4b9-7a31-4893-bc51-ba6a2224ab40", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "9dd35f19-a1b0-4dce-b59d-7f3514202d06", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["mean"], + "as": ["instance_id"] }, - "source": "9b74f0ec-208d-497e-82ec-0c357cc54c20", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", + "as": "05b233c1-668d-4235-ad6e-48943b96c83a" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_af1e1a93-61be-4075-824e-1b1db514fedc", + "type": "linear", + "domain": { + "data": "blobs_points_d5dbde4c-0908-4d4e-b664-71b63d826eda", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_af1e1a93-61be-4075-824e-1b1db514fedc", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_d5dbde4c-0908-4d4e-b664-71b63d826eda" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["mean"], - "as": ["instance_id"] + "stroke": { + "scale": "color_af1e1a93-61be-4075-824e-1b1db514fedc", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", - "as": "86222174-3e7a-4908-af4f-6ca944fbc7cf" + "fill": { + "scale": "color_af1e1a93-61be-4075-824e-1b1db514fedc", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_53b2358d-76f1-49bc-b33b-472688998b4e", - "type": "linear", - "domain": { - "data": "blobs_points_c948e4b9-7a31-4893-bc51-ba6a2224ab40", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_53b2358d-76f1-49bc-b33b-472688998b4e", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_c948e4b9-7a31-4893-bc51-ba6a2224ab40" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_53b2358d-76f1-49bc-b33b-472688998b4e", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_53b2358d-76f1-49bc-b33b-472688998b4e", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 9.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 9.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "f42c88af-1f73-563a-9aa0-4992496c7d3e" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json index 093b91a7..d17017bd 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "992a0776-2b16-4b67-a01d-b46cda4dfd4e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "889cd38f-e8cc-4828-a0a4-8cc51115b0f7", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_f08a9f2d-4d95-4f6d-8b9e-9205a90c33d4", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_dfa8f4e6-1a36-461d-81c2-dbb1b63461f1", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "992a0776-2b16-4b67-a01d-b46cda4dfd4e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["min"], + "as": ["instance_id"] }, - "source": "889cd38f-e8cc-4828-a0a4-8cc51115b0f7", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", + "as": "328cf4ad-992a-4499-8e76-eaa986c9fa16" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_d9594b35-beb3-4e9d-b089-f781823af0f0", + "type": "linear", + "domain": { + "data": "blobs_points_f08a9f2d-4d95-4f6d-8b9e-9205a90c33d4", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_d9594b35-beb3-4e9d-b089-f781823af0f0", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_f08a9f2d-4d95-4f6d-8b9e-9205a90c33d4" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["min"], - "as": ["instance_id"] + "stroke": { + "scale": "color_d9594b35-beb3-4e9d-b089-f781823af0f0", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (9.0 - 0.0)", - "as": "140f5670-c979-47ca-a3bf-e63e1a32943b" + "fill": { + "scale": "color_d9594b35-beb3-4e9d-b089-f781823af0f0", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", - "type": "linear", - "domain": { - "data": "blobs_points_dfa8f4e6-1a36-461d-81c2-dbb1b63461f1", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_dfa8f4e6-1a36-461d-81c2-dbb1b63461f1" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_e518e05b-0b89-4b8f-8c50-d03cbfebf550", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 9.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 9.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "9f71f68b-70aa-5651-b627-17f540348227" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json b/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json index fa23e8dc..d093cb5e 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "86ad4487-2a5a-4417-b94c-de63ce8b9ba2", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "07967b1f-36b9-4707-bf27-ac9297461efa", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_caa80dcf-c5a8-48b1-9b62-df5d2a8fd045", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_2923e506-957b-4f46-9c71-eb769881481c", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "86ad4487-2a5a-4417-b94c-de63ce8b9ba2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] }, - "source": "07967b1f-36b9-4707-bf27-ac9297461efa", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "clamp((datum.instance_id - 3.0) / (7.0 - 3.0), 0, 1)", + "as": "3b09bc1d-04c7-49e7-948e-9c4fd80a7e9c" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_8c41861f-9c05-4631-8986-30e531f70ef7", + "type": "linear", + "domain": { + "data": "blobs_points_caa80dcf-c5a8-48b1-9b62-df5d2a8fd045", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_8c41861f-9c05-4631-8986-30e531f70ef7", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_caa80dcf-c5a8-48b1-9b62-df5d2a8fd045" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["max"], - "as": ["instance_id"] + "stroke": { + "scale": "color_8c41861f-9c05-4631-8986-30e531f70ef7", + "value": "instance_id" }, - { - "type": "formula", - "expr": "clamp((datum.instance_id - 3.0) / (7.0 - 3.0), 0, 1)", - "as": "5318f013-808a-4d38-8c4c-81eea0177c17" + "fill": { + "scale": "color_8c41861f-9c05-4631-8986-30e531f70ef7", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_6ca0b889-2c50-477d-bd15-51263c921740", - "type": "linear", - "domain": { - "data": "blobs_points_2923e506-957b-4f46-9c71-eb769881481c", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_6ca0b889-2c50-477d-bd15-51263c921740", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [3.0, 4.0, 5.0, 6.0, 7.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_2923e506-957b-4f46-9c71-eb769881481c" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_6ca0b889-2c50-477d-bd15-51263c921740", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_6ca0b889-2c50-477d-bd15-51263c921740", - "value": "instance_id" + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 3.0", - "value": "#000000" - }, - { - "test": "datum.instance_id) > 7.0", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "219ad93c-19f2-5e11-8985-e263a6c1104b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json b/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json index ec0e92d5..d2283551 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2c06bec6-b203-4633-a33e-7653b4a26440", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "a8114eb6-540c-49e0-9f7a-b2a4cd8eec4a", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_eb0858ef-d6c9-4eb9-9bd3-608738c6605b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_eb43c523-343b-49d9-9a22-dcfa8322cd3b", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "2c06bec6-b203-4633-a33e-7653b4a26440", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] }, - "source": "a8114eb6-540c-49e0-9f7a-b2a4cd8eec4a", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 3.0) / (7.0 - 3.0)", + "as": "99b15c9a-111e-4a07-91f0-e2b3080b506c" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_b45a82ef-6e7e-4dec-b140-1a4042f3f254", + "type": "linear", + "domain": { + "data": "blobs_points_eb0858ef-d6c9-4eb9-9bd3-608738c6605b", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_b45a82ef-6e7e-4dec-b140-1a4042f3f254", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [3.0, 4.0, 5.0, 6.0, 7.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_eb0858ef-d6c9-4eb9-9bd3-608738c6605b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["max"], - "as": ["instance_id"] + "stroke": { + "scale": "color_b45a82ef-6e7e-4dec-b140-1a4042f3f254", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 3.0) / (7.0 - 3.0)", - "as": "00b44404-8c4d-44f9-b3af-e8823b97f6e4" + "fill": { + "scale": "color_b45a82ef-6e7e-4dec-b140-1a4042f3f254", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_2bc131ec-f456-486d-9c4c-d6731049b157", - "type": "linear", - "domain": { - "data": "blobs_points_eb43c523-343b-49d9-9a22-dcfa8322cd3b", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_2bc131ec-f456-486d-9c4c-d6731049b157", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [3.0, 4.0, 5.0, 6.0, 7.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_eb43c523-343b-49d9-9a22-dcfa8322cd3b" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_2bc131ec-f456-486d-9c4c-d6731049b157", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_2bc131ec-f456-486d-9c4c-d6731049b157", - "value": "instance_id" + { + "test": "datum.instance_id) < 3.0", + "value": "#000000" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 7.0", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 3.0", - "value": "#000000" - }, - { - "test": "datum.instance_id) > 7.0", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "abc9ca0e-7d42-56fb-bf14-4cff0cfac071" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json index 096319b3..96e3c2ee 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3d9fb55d-1924-454b-ab46-82914e20905e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "fdf4bcf4-ade7-4c9e-90ae-4ca5a11c4eea", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_b59d28b9-5a05-4fb7-b4f5-9af8f671b296", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_e3245574-274f-4e36-909f-94bb09851dbc", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "3d9fb55d-1924-454b-ab46-82914e20905e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["stdev"], + "as": ["instance_id"] }, - "source": "fdf4bcf4-ade7-4c9e-90ae-4ca5a11c4eea", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (1.0 - 0.0)", + "as": "582ba3d0-d97f-46f3-bea3-164f7eb7385e" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_715a81ad-2dae-45de-85e1-bb885e8c054d", + "type": "linear", + "domain": { + "data": "blobs_points_b59d28b9-5a05-4fb7-b4f5-9af8f671b296", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_715a81ad-2dae-45de-85e1-bb885e8c054d", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_b59d28b9-5a05-4fb7-b4f5-9af8f671b296" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["stdev"], - "as": ["instance_id"] + "stroke": { + "scale": "color_715a81ad-2dae-45de-85e1-bb885e8c054d", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (1.0 - 0.0)", - "as": "cb2266b2-db15-409a-9888-9c054efc7f15" + "fill": { + "scale": "color_715a81ad-2dae-45de-85e1-bb885e8c054d", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", - "type": "linear", - "domain": { - "data": "blobs_points_e3245574-274f-4e36-909f-94bb09851dbc", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_e3245574-274f-4e36-909f-94bb09851dbc" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_5a447fca-452f-4650-8e61-bbc4bedfccf6", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 1.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 1.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "6cea5bd5-3f67-50dc-8ead-a4fdf8149c2f" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json index 97b6fef8..8e8d7159 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "221ff181-269f-46f3-94f3-4d162f0cc220", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "c12539db-53a2-43ff-8a06-1d3cc7055e0c", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_8bda3e59-c139-4d6c-8786-2bf109593561", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_df542ec0-fb65-4419-9a71-ce3f2f7cdcf8", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "221ff181-269f-46f3-94f3-4d162f0cc220", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["stdev"], + "as": ["instance_id"] }, - "source": "c12539db-53a2-43ff-8a06-1d3cc7055e0c", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (3.5 - 0.0)", + "as": "f5e26f77-d9c2-4f8d-b794-76005be2f4f3" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_abb335ce-a709-40a3-bc6a-baf71fe2fc1c", + "type": "linear", + "domain": { + "data": "blobs_points_8bda3e59-c139-4d6c-8786-2bf109593561", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_abb335ce-a709-40a3-bc6a-baf71fe2fc1c", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_8bda3e59-c139-4d6c-8786-2bf109593561" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["stdev"], - "as": ["instance_id"] + "stroke": { + "scale": "color_abb335ce-a709-40a3-bc6a-baf71fe2fc1c", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (3.5 - 0.0)", - "as": "a69970fe-2058-41a2-9b91-730b92461a47" + "fill": { + "scale": "color_abb335ce-a709-40a3-bc6a-baf71fe2fc1c", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", - "type": "linear", - "domain": { - "data": "blobs_points_df542ec0-fb65-4419-9a71-ce3f2f7cdcf8", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_df542ec0-fb65-4419-9a71-ce3f2f7cdcf8" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_4dae2da9-23f3-4b20-9f86-a5213cc9e26b", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 3.5", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 3.5", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "fd2c678d-7d6e-5208-93c9-2be49387c1a9" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json index 78ed28ba..51298710 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cc8c7dac-a4a4-4843-b687-a31823d6d869", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "06591540-f5a3-474b-abc8-805ded9aebb5", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_e423810c-57f3-44c0-a114-e6726f586e8a", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_5f0edb3e-239b-4b89-b998-aa5ff3c2bf43", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "cc8c7dac-a4a4-4843-b687-a31823d6d869", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["sum"], + "as": ["instance_id"] }, - "source": "06591540-f5a3-474b-abc8-805ded9aebb5", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (23.0 - 0.0)", + "as": "6bd60a69-d8dc-44b8-87fc-62efc8bf46ee" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_4d90dfe4-5b0f-48af-9fd8-c3b1d7ee67ea", + "type": "linear", + "domain": { + "data": "blobs_points_e423810c-57f3-44c0-a114-e6726f586e8a", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_4d90dfe4-5b0f-48af-9fd8-c3b1d7ee67ea", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0, 25.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_e423810c-57f3-44c0-a114-e6726f586e8a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["sum"], - "as": ["instance_id"] + "stroke": { + "scale": "color_4d90dfe4-5b0f-48af-9fd8-c3b1d7ee67ea", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (23.0 - 0.0)", - "as": "cd5a7563-6768-4091-9fa9-945049362c84" + "fill": { + "scale": "color_4d90dfe4-5b0f-48af-9fd8-c3b1d7ee67ea", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", - "type": "linear", - "domain": { - "data": "blobs_points_5f0edb3e-239b-4b89-b998-aa5ff3c2bf43", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 5.0, 10.0, 15.0, 20.0, 25.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_5f0edb3e-239b-4b89-b998-aa5ff3c2bf43" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_63465eb7-a372-4d37-b3d2-6dc8c5098210", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 23.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 23.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "1292d576-8d89-5104-aff7-4a491c68cc79" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json b/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json index d7bc1f94..eca702a2 100644 --- a/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json +++ b/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "362bd067-7a88-492c-8a70-4815bbb55e12", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "3924ef3f-5bad-4078-a20b-b83cc95e46e0", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_b04a7fec-6777-494a-94af-e53eaa5d1fd9", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_37b90668-23fe-41da-8cb6-10e89182ea71", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "362bd067-7a88-492c-8a70-4815bbb55e12", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["variance"], + "as": ["instance_id"] }, - "source": "3924ef3f-5bad-4078-a20b-b83cc95e46e0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (1.0 - 0.0)", + "as": "c8d73f6f-74e2-40d6-b446-27795d689afb" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_9f365982-e562-466d-b5af-974151f3a43f", + "type": "linear", + "domain": { + "data": "blobs_points_b04a7fec-6777-494a-94af-e53eaa5d1fd9", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_9f365982-e562-466d-b5af-974151f3a43f", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_b04a7fec-6777-494a-94af-e53eaa5d1fd9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["variance"], - "as": ["instance_id"] + "stroke": { + "scale": "color_9f365982-e562-466d-b5af-974151f3a43f", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (1.0 - 0.0)", - "as": "c88af9ef-d40a-4705-9db8-f44268c34b5a" + "fill": { + "scale": "color_9f365982-e562-466d-b5af-974151f3a43f", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", - "type": "linear", - "domain": { - "data": "blobs_points_37b90668-23fe-41da-8cb6-10e89182ea71", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_37b90668-23fe-41da-8cb6-10e89182ea71" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_554ce9d3-82b1-49cd-a8ef-9c288db6c7ee", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 1.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 1.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "fc5e6ff7-e126-5c8e-8cd5-e21daf081820" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_continuous_color.json b/tests/_figures_viewconfig/Points_datashader_continuous_color.json index 6390dc7d..791ee699 100644 --- a/tests/_figures_viewconfig/Points_datashader_continuous_color.json +++ b/tests/_figures_viewconfig/Points_datashader_continuous_color.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5b94a77e-c055-4d25-bb7d-bea538f379cd", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "e95022f5-d7da-4bce-9839-f14773a8ccd3", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_327cfd41-64ea-418c-880c-cc8955f3d012", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_7e8b8c3c-a81c-42c9-aa8d-270e63c58e25", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "5b94a77e-c055-4d25-bb7d-bea538f379cd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["sum"], + "as": ["instance_id"] }, - "source": "e95022f5-d7da-4bce-9839-f14773a8ccd3", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (23.0 - 0.0)", + "as": "fa716c5b-1afa-415c-a565-9ae3cdbd835a" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_a1e5e814-22be-45ad-96f1-dc7aa92405b1", + "type": "linear", + "domain": { + "data": "blobs_points_327cfd41-64ea-418c-880c-cc8955f3d012", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_a1e5e814-22be-45ad-96f1-dc7aa92405b1", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0, 25.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_327cfd41-64ea-418c-880c-cc8955f3d012" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["sum"], - "as": ["instance_id"] + "stroke": { + "scale": "color_a1e5e814-22be-45ad-96f1-dc7aa92405b1", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (23.0 - 0.0)", - "as": "d908fd8c-3c3a-4937-a7db-6ec401c68228" + "fill": { + "scale": "color_a1e5e814-22be-45ad-96f1-dc7aa92405b1", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 0.6 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", - "type": "linear", - "domain": { - "data": "blobs_points_7e8b8c3c-a81c-42c9-aa8d-270e63c58e25", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 5.0, 10.0, 15.0, 20.0, 25.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_7e8b8c3c-a81c-42c9-aa8d-270e63c58e25" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_d58ffe32-88ff-4acb-83cf-7f6d4b045959", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 0.6 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 23.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 23.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "d0c328cd-5345-585f-9c5a-00ed4a7e241a" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json b/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json index 9f96e0cd..979856e7 100644 --- a/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json +++ b/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json @@ -1,225 +1,220 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0c4d7f4f-d8a5-4e1e-9fd6-7e03653c4734", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "aba23509-b6bd-48f4-abf3-a8ddceb4c7f0", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "blobs_points_08b7846f-abb0-4306-bcd4-15b794c67af5", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "0c4d7f4f-d8a5-4e1e-9fd6-7e03653c4734", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + }, + { + "type": "spread", + "field": ["count"], + "px": 5, + "as": ["count"] } + ] + }, + { + "name": "blobs_points_067ee6b1-fcaa-4293-8a0b-968ad5d1973b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_d7fb57eb-530c-4119-9838-b21d0eae50b1", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "0c4d7f4f-d8a5-4e1e-9fd6-7e03653c4734", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "aba23509-b6bd-48f4-abf3-a8ddceb4c7f0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_08b7846f-abb0-4306-bcd4-15b794c67af5" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] + "stroke": { + "value": "#ff0000" }, - { - "type": "spread", - "field": ["count"], - "px": 5, - "as": ["count"] - } - ] - }, - { - "name": "blobs_points_8f0a0af2-cd57-427e-bb90-e5e2456f9840", - "format": { - "type": "PointsFormatV01", - "version": "0.1" - }, - "source": "aba23509-b6bd-48f4-abf3-a8ddceb4c7f0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + "fill": { + "value": "#ff0000" }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_d7fb57eb-530c-4119-9838-b21d0eae50b1" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#ff0000" - }, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" - } + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } } + } + }, + { + "type": "symbol", + "from": { + "data": "blobs_points_067ee6b1-fcaa-4293-8a0b-968ad5d1973b" }, - { - "type": "symbol", - "from": { - "data": "blobs_points_8f0a0af2-cd57-427e-bb90-e5e2456f9840" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#0000ff" - }, - "fill": { - "value": "#0000ff" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#0000ff" + }, + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } } } - ], - "usermeta": { - "axis_uuid": "ccd77351-c8fe-50a0-8b81-7fcdb1b0b9a9" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json index c883544c..f2632200 100644 --- a/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json +++ b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "8bb5f067-49ac-4c90-9b53-e85f5e0b7724", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "8c43cf0b-670b-4847-8eb5-5d5baf46bd5e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_12113b8a-3a83-456f-b868-6449fefa3968", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_8a2764bd-6e6e-418b-a980-8102fce2af6d", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "8bb5f067-49ac-4c90-9b53-e85f5e0b7724", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] }, - "source": "8c43cf0b-670b-4847-8eb5-5d5baf46bd5e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "clamp((datum.instance_id - 4.5) / (5.5 - 4.5), 0, 1)", + "as": "f8b89ac4-fe41-4141-a81e-02aff6582c79" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_f973207b-2ebc-4c48-a350-823e431c1cf7", + "type": "linear", + "domain": { + "data": "blobs_points_12113b8a-3a83-456f-b868-6449fefa3968", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f973207b-2ebc-4c48-a350-823e431c1cf7", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_12113b8a-3a83-456f-b868-6449fefa3968" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["max"], - "as": ["instance_id"] + "stroke": { + "scale": "color_f973207b-2ebc-4c48-a350-823e431c1cf7", + "value": "instance_id" }, - { - "type": "formula", - "expr": "clamp((datum.instance_id - 4.5) / (5.5 - 4.5), 0, 1)", - "as": "37038b90-124c-455a-8a0d-881ef89217c2" + "fill": { + "scale": "color_f973207b-2ebc-4c48-a350-823e431c1cf7", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_870841cb-9849-486a-9718-b7dc2b9a8696", - "type": "linear", - "domain": { - "data": "blobs_points_8a2764bd-6e6e-418b-a980-8102fce2af6d", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_870841cb-9849-486a-9718-b7dc2b9a8696", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_8a2764bd-6e6e-418b-a980-8102fce2af6d" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_870841cb-9849-486a-9718-b7dc2b9a8696", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_870841cb-9849-486a-9718-b7dc2b9a8696", - "value": "instance_id" + { + "test": "datum.instance_id) < 4.5", + "value": "#000000" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 5.5", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 4.5", - "value": "#000000" - }, - { - "test": "datum.instance_id) > 5.5", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "2da4b197-d884-5d88-9b7f-f0938e46d5fc" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json index 7c1cbd2a..b10947ff 100644 --- a/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json +++ b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d8f2aa71-acde-41f4-ae10-1f7c465ee553", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "3805b8ab-5acb-4e9d-8832-13692baa5717", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_7bb6e31a-168c-4322-964e-9ccb5e8db60c", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_b8d9acdc-6fe9-4f4c-af19-939db0848fa0", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "d8f2aa71-acde-41f4-ae10-1f7c465ee553", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["max"], + "as": ["instance_id"] }, - "source": "3805b8ab-5acb-4e9d-8832-13692baa5717", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 4.5) / (5.5 - 4.5)", + "as": "682c310a-4a2c-4643-81cb-1d9d5e42f7b0" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 5, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_f2455f8a-9f44-4086-9e7a-e6c82613d3a9", + "type": "linear", + "domain": { + "data": "blobs_points_7bb6e31a-168c-4322-964e-9ccb5e8db60c", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_f2455f8a-9f44-4086-9e7a-e6c82613d3a9", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_7bb6e31a-168c-4322-964e-9ccb5e8db60c" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["max"], - "as": ["instance_id"] + "stroke": { + "scale": "color_f2455f8a-9f44-4086-9e7a-e6c82613d3a9", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 4.5) / (5.5 - 4.5)", - "as": "379b6b6e-8a98-4a19-909c-5b279b1ad6ca" + "fill": { + "scale": "color_f2455f8a-9f44-4086-9e7a-e6c82613d3a9", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 5, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 40 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", - "type": "linear", - "domain": { - "data": "blobs_points_b8d9acdc-6fe9-4f4c-af19-939db0848fa0", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_b8d9acdc-6fe9-4f4c-af19-939db0848fa0" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_2aa506c2-0320-4b23-b31d-4fef521bc043", - "value": "instance_id" + { + "test": "datum.instance_id) < 4.5", + "value": "#000000" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 40 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 5.5", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 4.5", - "value": "#000000" - }, - { - "test": "datum.instance_id) > 5.5", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "0bd97ed6-96c9-5b21-aaf5-61df80e48236" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json b/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json index 93a2a053..89f1c1c7 100644 --- a/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json +++ b/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json @@ -1,225 +1,220 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 800.0, - "width": 800.0, - "padding": { - "left": 144.0, - "top": 71.99999999999997, - "right": 32.00000000000003, - "bottom": 120.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 38.888888888888886, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 800.0, + "width": 800.0, + "padding": { + "left": 144.0, + "top": 71.99999999999997, + "right": 32.00000000000003, + "bottom": 120.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 38.888888888888886, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c7e50577-ac41-4f0f-8c55-6595f68feec5", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "fe73f6c8-17d5-473a-84c5-6c8327b3a63d", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_ba437bf3-0521-4f38-b9dd-1d1514662548", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_58755652-81c2-4b5a-8179-fa7918be1be9", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "c7e50577-ac41-4f0f-8c55-6595f68feec5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "fe73f6c8-17d5-473a-84c5-6c8327b3a63d", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_points_faa8c9bf-7905-408d-ac52-c2bb3499a36f", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_91042950-96b5-4636-942e-8775f1c9ca76", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "c7e50577-ac41-4f0f-8c55-6595f68feec5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] }, - "source": "fe73f6c8-17d5-473a-84c5-6c8327b3a63d", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "spread", + "field": ["count"], + "px": 40, + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 2.2222222222222223, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 2.7777777777777777, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 38.888888888888886, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 4.166666666666667, + "tickSize": 9.722222222222221, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 2.2222222222222223, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 2.7777777777777777, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 38.888888888888886, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 4.166666666666667, + "tickSize": 9.722222222222221, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_ba437bf3-0521-4f38-b9dd-1d1514662548" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] + "stroke": { + "value": "#0000ff" }, - { - "type": "spread", - "field": ["count"], - "px": 40, - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 2.2222222222222223, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 2.7777777777777777, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 38.888888888888886, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 4.166666666666667, - "tickSize": 9.722222222222221, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 2.2222222222222223, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 2.7777777777777777, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 38.888888888888886, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 4.166666666666667, - "tickSize": 9.722222222222221, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_58755652-81c2-4b5a-8179-fa7918be1be9" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#0000ff" - }, - "fill": { - "value": "#0000ff" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 400 - }, - "shape": { - "value": "circle" - } + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 400 + }, + "shape": { + "value": "circle" } } + } + }, + { + "type": "symbol", + "from": { + "data": "blobs_points_faa8c9bf-7905-408d-ac52-c2bb3499a36f" }, - { - "type": "symbol", - "from": { - "data": "blobs_points_91042950-96b5-4636-942e-8775f1c9ca76" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#ffff00" - }, - "fill": { - "value": "#ffff00" - }, - "fillOpacity": { - "value": 0.8 - }, - "size": { - "value": 400 - }, - "shape": { - "value": "circle" - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ffff00" + }, + "fill": { + "value": "#ffff00" + }, + "fillOpacity": { + "value": 0.8 + }, + "size": { + "value": 400 + }, + "shape": { + "value": "circle" } } } - ], - "usermeta": { - "axis_uuid": "43a1ea63-34d1-5be9-973f-a7e1f6ffbb87" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_points_categorical_color.json b/tests/_figures_viewconfig/Points_points_categorical_color.json index 7638f681..bbef138d 100644 --- a/tests/_figures_viewconfig/Points_points_categorical_color.json +++ b/tests/_figures_viewconfig/Points_points_categorical_color.json @@ -1,225 +1,220 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "91878c28-e876-4094-8fcc-8f017ff357d2", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "76d1df00-edd3-46c8-9035-01a7670977d5", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "5913cd7d-cb5c-40ff-b352-72b71a87f19b", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "91878c28-e876-4094-8fcc-8f017ff357d2", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" } + ] + }, + { + "name": "blobs_points_1f32f9a5-4f5b-48f3-ae02-4be525741c26", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "2c9ee04c-603f-4ed8-b8a1-a30bf739968c", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "91878c28-e876-4094-8fcc-8f017ff357d2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "76d1df00-edd3-46c8-9035-01a7670977d5", - "transform": [ - { - "type": "filter_element", - "expr": "other_table" - } - ] - }, - { - "name": "blobs_points_239dff7b-58c0-4ae2-b12b-a819153d99fc", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + { + "type": "filter_cs", + "expr": "global" }, - "source": "76d1df00-edd3-46c8-9035-01a7670977d5", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "lookup", + "from": "5913cd7d-cb5c-40ff-b352-72b71a87f19b", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_19cccbff-1b9a-4172-aeb8-4201df8d786b", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_19cccbff-1b9a-4172-aeb8-4201df8d786b", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 197.08444444444444 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_1f32f9a5-4f5b-48f3-ae02-4be525741c26" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_19cccbff-1b9a-4172-aeb8-4201df8d786b", + "field": "category" + }, + "fill": { + "scale": "color_19cccbff-1b9a-4172-aeb8-4201df8d786b", + "field": "category" }, - { - "type": "filter_cs", - "expr": "global" + "fillOpacity": { + "value": 1.0 }, - { - "type": "lookup", - "from": "2c9ee04c-603f-4ed8-b8a1-a30bf739968c", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["category"], - "as": ["category"], - "default": null + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", - "type": "ordinal", - "domain": ["a", "b", "c"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.8405555555555, - "legendY": 197.08444444444444 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_239dff7b-58c0-4ae2-b12b-a819153d99fc" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", - "field": "category" - }, - "fill": { - "scale": "color_c9c08d34-4ffc-4d93-9dcf-c856840a63ed", - "field": "category" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.category)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "b277432b-3009-5416-9d63-189fcb81800b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json b/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json index 51045a53..e2f102b1 100644 --- a/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json +++ b/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json @@ -1,214 +1,209 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c45d84d6-45de-4d8a-906e-fb15f30e849c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "9fe7d2fe-1bba-461d-bcf8-f9ba438019fd", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_598650b0-9873-41ef-9ffc-5e5bcd961b1e", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_2ddb998f-e6e5-4809-b6b9-6dbe30556cbb", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "c45d84d6-45de-4d8a-906e-fb15f30e849c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" }, - "source": "9fe7d2fe-1bba-461d-bcf8-f9ba438019fd", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "aggregate", + "field": ["genes"], + "ops": ["count"], + "as": ["genes"] + }, + { + "type": "spread", + "field": ["genes"], + "px": 1, + "as": ["genes"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_eb0dbacf-185d-4a3c-9dc9-d8dfd904be66", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_eb0dbacf-185d-4a3c-9dc9-d8dfd904be66", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_598650b0-9873-41ef-9ffc-5e5bcd961b1e" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_eb0dbacf-185d-4a3c-9dc9-d8dfd904be66", + "field": "genes" + }, + "fill": { + "scale": "color_eb0dbacf-185d-4a3c-9dc9-d8dfd904be66", + "field": "genes" }, - { - "type": "filter_cs", - "expr": "global" + "fillOpacity": { + "value": 1.0 }, - { - "type": "aggregate", - "field": ["genes"], - "ops": ["count"], - "as": ["genes"] + "size": { + "value": 1.0 }, - { - "type": "spread", - "field": ["genes"], - "px": 1, - "as": ["genes"] + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", - "type": "ordinal", - "domain": ["gene_a", "gene_b"], - "range": ["#1f77b4", "#ff7f0e"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 228.2155555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_2ddb998f-e6e5-4809-b6b9-6dbe30556cbb" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", - "field": "genes" - }, - "fill": { - "scale": "color_6c81e9ce-c408-4fab-ae69-3b4928212514", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "96ba6439-6a3a-51ba-a922-976f6f3f3c4a" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json b/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json index 391c01b6..697b9349 100644 --- a/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json +++ b/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json @@ -1,202 +1,197 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "10988ceb-98e9-4f84-bfaf-f6f8b6c850d3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "3bdb2a3f-2e0b-4765-b173-22ae708330e3", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_36c064a2-e752-4ea2-aa45-1257b9719153", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_bb5e6626-0600-40e2-987f-f78a1520fb50", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "10988ceb-98e9-4f84-bfaf-f6f8b6c850d3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "3bdb2a3f-2e0b-4765-b173-22ae708330e3", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_61d22926-8179-47eb-945e-c246ad7d810d", + "type": "ordinal", + "domain": ["gene_a", "gene_b"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_61d22926-8179-47eb-945e-c246ad7d810d", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 228.2155555555555, + "legendY": 217.95875 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_36c064a2-e752-4ea2-aa45-1257b9719153" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "filter_cs", - "expr": "global" + "stroke": { + "scale": "color_61d22926-8179-47eb-945e-c246ad7d810d", + "field": "genes" + }, + "fill": { + "scale": "color_61d22926-8179-47eb-945e-c246ad7d810d", + "field": "genes" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", - "type": "ordinal", - "domain": ["gene_a", "gene_b"], - "range": ["#1f77b4", "#ff7f0e"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 228.2155555555555, - "legendY": 217.95875 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_bb5e6626-0600-40e2-987f-f78a1520fb50" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", - "field": "genes" - }, - "fill": { - "scale": "color_b60cf777-0797-473d-9dbb-4fccf4be0df9", - "field": "genes" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.genes)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "9b84b104-c451-573c-97c0-d851f9cf1250" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json b/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json index 4a921688..dc8ef6ab 100644 --- a/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json +++ b/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json @@ -1,225 +1,220 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d101f387-af84-4b81-99ce-a3badc823f1a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "e1552ed7-ed9a-49f7-bbb6-846bde9e0bc1", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "5170b494-49c9-4056-bb08-c985e3b2e2e1", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "d101f387-af84-4b81-99ce-a3badc823f1a", + "transform": [ + { + "type": "filter_element", + "expr": "other_table" } + ] + }, + { + "name": "blobs_points_9ea39e4b-3942-4ae7-a1d8-1471ea118296", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "8e439704-35af-40bc-942e-a10979271074", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "d101f387-af84-4b81-99ce-a3badc823f1a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "source": "e1552ed7-ed9a-49f7-bbb6-846bde9e0bc1", - "transform": [ - { - "type": "filter_element", - "expr": "other_table" - } - ] - }, - { - "name": "blobs_points_600ab3ba-a578-411e-ac75-109eecf3882d", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + { + "type": "filter_cs", + "expr": "global" }, - "source": "e1552ed7-ed9a-49f7-bbb6-846bde9e0bc1", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "lookup", + "from": "5170b494-49c9-4056-bb08-c985e3b2e2e1", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_95c97f3a-2fb9-408b-a0fa-8c5b8b2ca9d7", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_95c97f3a-2fb9-408b-a0fa-8c5b8b2ca9d7", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 197.08444444444444 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_9ea39e4b-3942-4ae7-a1d8-1471ea118296" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_95c97f3a-2fb9-408b-a0fa-8c5b8b2ca9d7", + "field": "category" + }, + "fill": { + "scale": "color_95c97f3a-2fb9-408b-a0fa-8c5b8b2ca9d7", + "field": "category" }, - { - "type": "filter_cs", - "expr": "global" + "fillOpacity": { + "value": 1.0 }, - { - "type": "lookup", - "from": "8e439704-35af-40bc-942e-a10979271074", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["category"], - "as": ["category"], - "default": null + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", - "type": "ordinal", - "domain": ["a", "b", "c"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.8405555555555, - "legendY": 197.08444444444444 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_600ab3ba-a578-411e-ac75-109eecf3882d" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", - "field": "category" - }, - "fill": { - "scale": "color_82b5b1f7-8786-4ce3-ae17-e97dfd74c5f1", - "field": "category" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.category)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "a2b14124-7ccb-55cc-a9f8-531a8cefaf74" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json b/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json index 310eb18b..d72a27c1 100644 --- a/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json +++ b/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json @@ -1,233 +1,228 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "68daa5ee-8c53-4c34-8d8a-e4fc0c4ee1e9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "882207e6-e04a-47d1-9bf6-68a1c6e59817", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_points_018564f6-057f-46a8-a52b-9086e75d9284", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "blobs_points_75d73c23-3eea-4a4f-87cb-a35740cfe77e", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "68daa5ee-8c53-4c34-8d8a-e4fc0c4ee1e9", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["instance_id"], + "ops": ["sum"], + "as": ["instance_id"] }, - "source": "882207e6-e04a-47d1-9bf6-68a1c6e59817", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" + { + "type": "formula", + "expr": "(datum.instance_id - 0.0) / (14.0 - 0.0)", + "as": "212f4d4f-c637-4100-a3e8-43eba4f1c878" + }, + { + "type": "spread", + "field": ["instance_id"], + "px": 1, + "as": ["instance_id"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_d48ef410-fc8a-43c6-8999-d4a6e8da5b00", + "type": "linear", + "domain": { + "data": "blobs_points_018564f6-057f-46a8-a52b-9086e75d9284", + "field": ["instance_id"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_d48ef410-fc8a-43c6-8999-d4a6e8da5b00", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_018564f6-057f-46a8-a52b-9086e75d9284" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["instance_id"], - "ops": ["sum"], - "as": ["instance_id"] + "stroke": { + "scale": "color_d48ef410-fc8a-43c6-8999-d4a6e8da5b00", + "value": "instance_id" }, - { - "type": "formula", - "expr": "(datum.instance_id - 0.0) / (14.0 - 0.0)", - "as": "adafac37-bc91-4982-8f59-5e7e1df18c02" + "fill": { + "scale": "color_d48ef410-fc8a-43c6-8999-d4a6e8da5b00", + "value": "instance_id" }, - { - "type": "spread", - "field": ["instance_id"], - "px": 1, - "as": ["instance_id"] + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" - }, - { - "name": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", - "type": "linear", - "domain": { - "data": "blobs_points_75d73c23-3eea-4a4f-87cb-a35740cfe77e", - "field": ["instance_id"] }, - "range": { - "scheme": "viridis", - "count": 256 - } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_75d73c23-3eea-4a4f-87cb-a35740cfe77e" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", - "value": "instance_id" + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" }, - "fill": { - "scale": "color_3ed5be73-46b3-4f72-ba9e-b553c236313e", - "value": "instance_id" + { + "test": "datum.instance_id) < 0.0", + "value": "#440154" }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" + { + "test": "datum.instance_id) > 14.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - }, - { - "test": "datum.instance_id) < 0.0", - "value": "#440154" - }, - { - "test": "datum.instance_id) > 14.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "2f5d2cc1-0d47-5802-8fe5-7495f8ec1c22" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json b/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json index 13c8a32f..3c17c1a3 100644 --- a/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json +++ b/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json @@ -1,208 +1,203 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "8e280044-564f-4375-840f-9848716f7b85", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } - }, - { - "name": "blobs_points_c5148b36-51c9-42c4-bfde-56eea4c4172e", - "format": { - "type": "PointsFormatV01", - "version": "0.1" - }, - "source": "8e280044-564f-4375-840f-9848716f7b85", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_points" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "08b1b9cb-2915-4321-85c9-b38344623c08", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [3.0, 509.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [507.0, 4.0], - "range": "height" + }, + { + "name": "blobs_points_d0a641ed-3f0e-441f-8f2c-a96622ff28e8", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "color_c398a8bd-be9a-4337-8599-01bdda452f63", - "type": "linear", - "domain": { - "data": "blobs_points_c5148b36-51c9-42c4-bfde-56eea4c4172e", - "field": "instance_id" + "source": "08b1b9cb-2915-4321-85c9-b38344623c08", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_cs", + "expr": "global" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [507.0, 4.0], + "range": "height" + }, + { + "name": "color_72541271-1cee-4f59-903a-2aa0e38bfe96", + "type": "linear", + "domain": { + "data": "blobs_points_d0a641ed-3f0e-441f-8f2c-a96622ff28e8", + "field": "instance_id" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400, 500], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_c398a8bd-be9a-4337-8599-01bdda452f63", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "blobs_points_c5148b36-51c9-42c4-bfde-56eea4c4172e" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "scale": "color_c398a8bd-be9a-4337-8599-01bdda452f63", - "value": "instance_id" - }, - "fill": { - "scale": "color_c398a8bd-be9a-4337-8599-01bdda452f63", - "value": "instance_id" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 1.0 - }, - "shape": { - "value": "circle" - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400, 500], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_72541271-1cee-4f59-903a-2aa0e38bfe96", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 2.0, 4.0, 6.0, 8.0, 10.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "blobs_points_d0a641ed-3f0e-441f-8f2c-a96622ff28e8" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - } - ] + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_72541271-1cee-4f59-903a-2aa0e38bfe96", + "value": "instance_id" + }, + "fill": { + "scale": "color_72541271-1cee-4f59-903a-2aa0e38bfe96", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "9ef92755-d335-544c-8deb-63c63776e574" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json b/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json index d4700daa..b9aa77db 100644 --- a/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json +++ b/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json @@ -1,225 +1,220 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cd447067-24c2-4f8a-8eb3-3c88e8442c58", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1726166b-d3f2-4d72-99da-5002a67ff362", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "points1_2355f2a3-ebeb-476b-a52a-ae94b43ae962", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "points1_a3aaddcc-5548-4b3b-aab8-85bd9fc8655c", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "cd447067-24c2-4f8a-8eb3-3c88e8442c58", + "transform": [ + { + "type": "filter_element", + "expr": "points1" }, - "source": "1726166b-d3f2-4d72-99da-5002a67ff362", - "transform": [ - { - "type": "filter_element", - "expr": "points1" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "points1_e2f780ff-20e8-4e3e-be7f-abc949020e14", + "format": { + "type": "PointsFormatV01", + "version": "0.1" }, - { - "name": "points1_5135bd5c-be45-475d-acdb-ba94c1d91548", - "format": { - "type": "PointsFormatV01", - "version": "0.1" + "source": "cd447067-24c2-4f8a-8eb3-3c88e8442c58", + "transform": [ + { + "type": "filter_element", + "expr": "points1" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] }, - "source": "1726166b-d3f2-4d72-99da-5002a67ff362", - "transform": [ - { - "type": "filter_element", - "expr": "points1" + { + "type": "spread", + "field": ["count"], + "px": 3, + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 20.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [20.0, 0.0], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 5, 10, 15, 20], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 5, 10, 15, 20], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "points1_2355f2a3-ebeb-476b-a52a-ae94b43ae962" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] + "stroke": { + "value": "#d3d3d3" }, - { - "type": "spread", - "field": ["count"], - "px": 3, - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 20.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [20.0, 0.0], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 5, 10, 15, 20], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 5, 10, 15, 20], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "symbol", - "from": { - "data": "points1_a3aaddcc-5548-4b3b-aab8-85bd9fc8655c" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#d3d3d3" - }, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 50 - }, - "shape": { - "value": "circle" - } + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 50 + }, + "shape": { + "value": "circle" } } + } + }, + { + "type": "symbol", + "from": { + "data": "points1_e2f780ff-20e8-4e3e-be7f-abc949020e14" }, - { - "type": "symbol", - "from": { - "data": "points1_5135bd5c-be45-475d-acdb-ba94c1d91548" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "stroke": { - "value": "#ff0000" - }, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - }, - "size": { - "value": 10 - }, - "shape": { - "value": "circle" - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#ff0000" + }, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" } } } - ], - "usermeta": { - "axis_uuid": "ec28cecf-b4ae-5607-b2e6-16c709515234" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json b/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json index 27f36f04..bc20fe6c 100644 --- a/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json +++ b/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json @@ -1,227 +1,222 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "4fa14607-0505-4772-bfc0-7711dece0336", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "64e6de4c-0932-40bf-9d1c-1a2c6e98f849", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "e503ab70-9515-42d3-846f-4c480f066903", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "5bc16ac0-aa5b-4e59-a7bb-1537955277cb", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "4fa14607-0505-4772-bfc0-7711dece0336", + "transform": [ + { + "type": "filter_element", + "expr": "circle_table" }, - "source": "64e6de4c-0932-40bf-9d1c-1a2c6e98f849", - "transform": [ - { - "type": "filter_element", - "expr": "circle_table" - }, - { - "type": "filter_layer", - "expr": "normalized" - } - ] + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_circles_3abbf654-22fc-4fc6-9ae7-cd3f4e4f5c37", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_38e2c2a8-4313-436b-bb2c-552c6d436637", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "4fa14607-0505-4772-bfc0-7711dece0336", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "64e6de4c-0932-40bf-9d1c-1a2c6e98f849", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "5bc16ac0-aa5b-4e59-a7bb-1537955277cb", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["feature0"], - "as": ["feature0"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - }, - { - "name": "color_1e9988a3-db33-4210-9f58-f16cb35e4dcd", - "type": "linear", - "domain": { - "data": "blobs_circles_38e2c2a8-4313-436b-bb2c-552c6d436637", - "field": ["feature0"] + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "e503ab70-9515-42d3-846f-4c480f066903", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["feature0"], + "as": ["feature0"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_cd9b06e5-cab1-400e-9c14-6b4ff91b60b8", + "type": "linear", + "domain": { + "data": "blobs_circles_3abbf654-22fc-4fc6-9ae7-cd3f4e4f5c37", + "field": ["feature0"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_1e9988a3-db33-4210-9f58-f16cb35e4dcd", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_38e2c2a8-4313-436b-bb2c-552c6d436637" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_1e9988a3-db33-4210-9f58-f16cb35e4dcd", - "value": "feature0" - }, - "fillOpacity": { - "value": 1.0 - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_cd9b06e5-cab1-400e-9c14-6b4ff91b60b8", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_3abbf654-22fc-4fc6-9ae7-cd3f4e4f5c37" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.feature0)", - "value": "#d3d3d3" - } - ] + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_cd9b06e5-cab1-400e-9c14-6b4ff91b60b8", + "value": "feature0" + }, + "fillOpacity": { + "value": 1.0 } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "a3813fed-be51-538f-83dd-06a512830bc3" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json b/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json index 36bbfa9e..c33e62cd 100644 --- a/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json +++ b/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.json @@ -1,200 +1,195 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "591c3ffd-494f-4ea3-acfd-f38660ede142", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } - }, - { - "name": "blobs_polygons_7d720f83-4fe2-45e6-a7b5-2d1d7e185a25", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" - }, - "source": "591c3ffd-494f-4ea3-acfd-f38660ede142", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7184d547-7537-424f-95e7-68fd7eadd421", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" + }, + { + "name": "blobs_polygons_0dd8ebf1-45df-48e7-ab67-50e27324c1b9", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "color_e565b379-e9cb-4460-978e-0caef33fb0ec", - "type": "linear", - "domain": { - "data": "blobs_polygons_7d720f83-4fe2-45e6-a7b5-2d1d7e185a25", - "field": "value" + "source": "7184d547-7537-424f-95e7-68fd7eadd421", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_cs", + "expr": "global" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_d4fdda4d-9f6e-4cfc-9213-0d7bb37d7e0a", + "type": "linear", + "domain": { + "data": "blobs_polygons_0dd8ebf1-45df-48e7-ab67-50e27324c1b9", + "field": "value" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_e565b379-e9cb-4460-978e-0caef33fb0ec", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 5.0, 10.0, 15.0, 20.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_7d720f83-4fe2-45e6-a7b5-2d1d7e185a25" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_e565b379-e9cb-4460-978e-0caef33fb0ec", - "value": "value" - }, - "fillOpacity": { - "value": 1.0 - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_d4fdda4d-9f6e-4cfc-9213-0d7bb37d7e0a", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_0dd8ebf1-45df-48e7-ab67-50e27324c1b9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - } - ] + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_d4fdda4d-9f6e-4cfc-9213-0d7bb37d7e0a", + "value": "value" + }, + "fillOpacity": { + "value": 1.0 } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "805fba9f-d0ad-55ca-b00a-7abaee39455a" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json b/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json index 96c82233..fe9aab26 100644 --- a/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json +++ b/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json @@ -1,323 +1,318 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "860c9c99-e548-4cb8-a0f6-5f63dcce1297", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "b8455f5c-77ed-4379-ad7e-aca7a3e8b006", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "860c9c99-e548-4cb8-a0f6-5f63dcce1297", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_circles_2daf31a9-af43-4ace-be6c-bd49d5e759aa", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "59b535a5-8e62-4580-8093-16b150eea0de", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "860c9c99-e548-4cb8-a0f6-5f63dcce1297", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_circles_82866839-6674-4690-a31e-9e634d196ead", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "59b535a5-8e62-4580-8093-16b150eea0de", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["annotation"], - "as": ["annotation"], - "default": null - } - ] + { + "type": "lookup", + "from": "b8455f5c-77ed-4379-ad7e-aca7a3e8b006", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + }, + { + "name": "af321d05-b837-44b1-848c-ba2351b211c2", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "97557ea4-57dd-484c-8b88-e2ba1b8fec7e", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] + "source": "860c9c99-e548-4cb8-a0f6-5f63dcce1297", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_4cda9c5b-0d06-4923-acef-af217cd59ccd", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_35e112d2-38d6-4ca3-9197-6743d961e925", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "860c9c99-e548-4cb8-a0f6-5f63dcce1297", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "bd0108a3-fb77-49a9-8e4a-1533fde4e945", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "af321d05-b837-44b1-848c-ba2351b211c2", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 342.0621919542923], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [281.69401339357205, 137.62348968860152], + "range": "height" + }, + { + "name": "color_debcc46b-57ad-4123-8e2a-932bcb288e74", + "type": "ordinal", + "domain": ["a", "c", "d"], + "range": ["#1f77b4", "#279e68", "#d62728"] + }, + { + "name": "color_86338ada-68fe-477a-b0ca-35103a125c1c", + "type": "ordinal", + "domain": ["v", "x", "y"], + "range": ["#8c564b", "#b5bd61", "#17becf"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 150, 200, 250, 300], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 175, 200, 225, 250, 275], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_debcc46b-57ad-4123-8e2a-932bcb288e74", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.95555555555558 + }, + { + "type": "discrete", + "direction": "vertical", + "fill": "color_86338ada-68fe-477a-b0ca-35103a125c1c", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_2daf31a9-af43-4ace-be6c-bd49d5e759aa" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "lookup", - "from": "97557ea4-57dd-484c-8b88-e2ba1b8fec7e", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["annotation"], - "as": ["annotation"], - "default": null + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_debcc46b-57ad-4123-8e2a-932bcb288e74", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 342.0621919542923], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [281.69401339357205, 137.62348968860152], - "range": "height" - }, - { - "name": "color_5dc90b1b-cb98-486f-bcbb-b2a533998a36", - "type": "ordinal", - "domain": ["a", "c", "d"], - "range": ["#1f77b4", "#279e68", "#d62728"] - }, - { - "name": "color_31c17caa-10b5-4221-ba4e-5d88017dc127", - "type": "ordinal", - "domain": ["v", "x", "y"], - "range": ["#8c564b", "#b5bd61", "#17becf"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 150, 200, 250, 300], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 175, 200, 225, 250, 275], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_5dc90b1b-cb98-486f-bcbb-b2a533998a36", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.7155555555555, - "legendY": 35.95555555555558 - }, - { - "type": "discrete", - "direction": "vertical", - "fill": "color_31c17caa-10b5-4221-ba4e-5d88017dc127", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.7155555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_82866839-6674-4690-a31e-9e634d196ead" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_5dc90b1b-cb98-486f-bcbb-b2a533998a36", - "field": "annotation" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.annotation)", - "value": "#d3d3d3" - } - ] - } + ] } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_4cda9c5b-0d06-4923-acef-af217cd59ccd" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_35e112d2-38d6-4ca3-9197-6743d961e925" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_31c17caa-10b5-4221-ba4e-5d88017dc127", - "field": "annotation" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_86338ada-68fe-477a-b0ca-35103a125c1c", + "field": "annotation" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.annotation)", - "value": "#d3d3d3" - } - ] + "fillOpacity": { + "value": 1.0 } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "e9fc6a54-acac-5dd0-b91d-f99aaf858a94" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json b/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json index a571261f..be3d33af 100644 --- a/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json +++ b/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json @@ -1,323 +1,318 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "823e8f26-12b1-41d3-90f0-2eeb58eebe60", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "f7a30746-daf4-463c-82c2-48455da46487", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "823e8f26-12b1-41d3-90f0-2eeb58eebe60", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_circles_c92c20c3-0fd6-4b08-b746-55a03abea5fe", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "cf52abb3-f6ef-45ee-ae46-6dd3bffa50a1", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "823e8f26-12b1-41d3-90f0-2eeb58eebe60", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_circles_30877445-9767-47e3-9b6c-af54f2ce56df", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "cf52abb3-f6ef-45ee-ae46-6dd3bffa50a1", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["annotation"], - "as": ["annotation"], - "default": null - } - ] + { + "type": "lookup", + "from": "f7a30746-daf4-463c-82c2-48455da46487", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + }, + { + "name": "2f463b46-e621-48cc-90cd-f6b5eb53d8fc", + "format": { + "type": "spatialdata_table", + "version": 0.1 }, - { - "name": "57457ccb-a2b1-4413-9a24-c84c4c9075e5", - "format": { - "type": "spatialdata_table", - "version": 0.1 - }, - "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] + "source": "823e8f26-12b1-41d3-90f0-2eeb58eebe60", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_a8aa5f0f-90d6-4c6d-afd9-f28b6e1a0e58", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_a46e1ec7-77ea-465e-bf00-898e90df608d", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "823e8f26-12b1-41d3-90f0-2eeb58eebe60", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "d9611ff9-68f2-4e1d-8e38-d2a55538b898", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "2f463b46-e621-48cc-90cd-f6b5eb53d8fc", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + }, + { + "name": "color_1daa0749-14b3-4cf2-aaa4-2278ce43b9c4", + "type": "ordinal", + "domain": ["a", "b", "c", "d", "e"], + "range": ["#1f77b4", "#ff7f0e", "#279e68", "#d62728", "#aa40fc"] + }, + { + "name": "color_b5030bf1-11de-4ef3-8b47-3f0a92cf8822", + "type": "ordinal", + "domain": ["v", "w", "x", "y", "z"], + "range": ["#8c564b", "#e377c2", "#b5bd61", "#17becf", "#aec7e8"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_1daa0749-14b3-4cf2-aaa4-2278ce43b9c4", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 265.4655555555555, + "legendY": 35.95555555555558 + }, + { + "type": "discrete", + "direction": "vertical", + "fill": "color_b5030bf1-11de-4ef3-8b47-3f0a92cf8822", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 265.4655555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_c92c20c3-0fd6-4b08-b746-55a03abea5fe" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "lookup", - "from": "57457ccb-a2b1-4413-9a24-c84c4c9075e5", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["annotation"], - "as": ["annotation"], - "default": null + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_1daa0749-14b3-4cf2-aaa4-2278ce43b9c4", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 137.62348968860152], - "range": "height" - }, - { - "name": "color_5fd8851a-efc5-47c9-992d-30e7ff5f940a", - "type": "ordinal", - "domain": ["a", "b", "c", "d", "e"], - "range": ["#1f77b4", "#ff7f0e", "#279e68", "#d62728", "#aa40fc"] - }, - { - "name": "color_0374d4e6-cb3b-4ff0-8695-39af6558d2b9", - "type": "ordinal", - "domain": ["v", "w", "x", "y", "z"], - "range": ["#8c564b", "#e377c2", "#b5bd61", "#17becf", "#aec7e8"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_5fd8851a-efc5-47c9-992d-30e7ff5f940a", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 265.4655555555555, - "legendY": 35.95555555555558 - }, - { - "type": "discrete", - "direction": "vertical", - "fill": "color_0374d4e6-cb3b-4ff0-8695-39af6558d2b9", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 265.4655555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_30877445-9767-47e3-9b6c-af54f2ce56df" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_5fd8851a-efc5-47c9-992d-30e7ff5f940a", - "field": "annotation" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.annotation)", - "value": "#d3d3d3" - } - ] - } + ] } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_a8aa5f0f-90d6-4c6d-afd9-f28b6e1a0e58" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_a46e1ec7-77ea-465e-bf00-898e90df608d" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_0374d4e6-cb3b-4ff0-8695-39af6558d2b9", - "field": "annotation" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_b5030bf1-11de-4ef3-8b47-3f0a92cf8822", + "field": "annotation" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.annotation)", - "value": "#d3d3d3" - } - ] + "fillOpacity": { + "value": 1.0 } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "67d9a1b4-f46c-549a-968a-a356534a99c4" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json b/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json index ff796d5c..b4808455 100644 --- a/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json +++ b/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.json @@ -1,213 +1,208 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2a3cb7b1-ae0f-4435-b36a-4c5b7e1e2579", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "fdc9e739-d725-4bb7-8a8b-6bfb36e90090", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_f0419e07-6c30-4ef1-99d3-289cfc3b2ecf", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_b0b960ee-9fb6-4214-81d5-c36a06ecfa06", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "2a3cb7b1-ae0f-4435-b36a-4c5b7e1e2579", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "fdc9e739-d725-4bb7-8a8b-6bfb36e90090", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "formula", - "expr": "(datum.value - 2.0) / (4.0 - 2.0)", - "as": "7ad8430a-6e1a-4bc8-87e8-50b6d3b0bc8f" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_00540be8-3804-4816-ab6e-ab1987ae9f96", - "type": "linear", - "domain": { - "data": "blobs_polygons_b0b960ee-9fb6-4214-81d5-c36a06ecfa06", - "field": "7ad8430a-6e1a-4bc8-87e8-50b6d3b0bc8f" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 2.0) / (4.0 - 2.0)", + "as": "e39f14f1-78f5-4c84-9bf0-4d7796f84ecd" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_ea1449a7-9d4b-4a28-b3f3-972db58afc69", + "type": "linear", + "domain": { + "data": "blobs_polygons_f0419e07-6c30-4ef1-99d3-289cfc3b2ecf", + "field": "e39f14f1-78f5-4c84-9bf0-4d7796f84ecd" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_00540be8-3804-4816-ab6e-ab1987ae9f96", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [2.0, 2.5, 3.0, 3.5, 4.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_b0b960ee-9fb6-4214-81d5-c36a06ecfa06" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_ea1449a7-9d4b-4a28-b3f3-972db58afc69", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [2.0, 2.5, 3.0, 3.5, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_f0419e07-6c30-4ef1-99d3-289cfc3b2ecf" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_ea1449a7-9d4b-4a28-b3f3-972db58afc69", + "value": "e39f14f1-78f5-4c84-9bf0-4d7796f84ecd" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 2.0", + "value": "#000000" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_00540be8-3804-4816-ab6e-ab1987ae9f96", - "value": "7ad8430a-6e1a-4bc8-87e8-50b6d3b0bc8f" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 4.0", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 2.0", - "value": "#000000" - }, - { - "test": "datum.value) > 4.0", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "dbedcdce-a0b3-548e-a168-a371ada06535" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json b/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json index ebd7da2c..6994d8a9 100644 --- a/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json +++ b/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json @@ -1,223 +1,218 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f7e084fd-3650-4f18-9cab-ec5634ac6fe2", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "290054c4-54ff-482b-b30e-cc8dc4ffcfac", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "fc701dbc-28d3-4673-bec9-35a86f476cbf", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "f7e084fd-3650-4f18-9cab-ec5634ac6fe2", + "transform": [ + { + "type": "filter_element", + "expr": "new_table" } + ] + }, + { + "name": "blobs_circles_4293ab8e-4a91-43ef-978f-1bcb19b179a1", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "6ae783b7-6802-4f4d-bfea-9813d1399bf5", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "f7e084fd-3650-4f18-9cab-ec5634ac6fe2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "290054c4-54ff-482b-b30e-cc8dc4ffcfac", - "transform": [ - { - "type": "filter_element", - "expr": "new_table" - } - ] - }, - { - "name": "blobs_circles_9d96233c-29c2-4e5c-ae9f-5f3a766310da", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "290054c4-54ff-482b-b30e-cc8dc4ffcfac", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "6ae783b7-6802-4f4d-bfea-9813d1399bf5", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["instance_id"], - "as": ["instance_id"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - }, - { - "name": "color_f1abb57c-2d57-440d-b5c2-c524717cd27b", - "type": "linear", - "domain": { - "data": "blobs_circles_9d96233c-29c2-4e5c-ae9f-5f3a766310da", - "field": ["instance_id"] - }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "fc701dbc-28d3-4673-bec9-35a86f476cbf", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["instance_id"], + "as": ["instance_id"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_e9d0949f-f688-487a-b122-cb6d631417fa", + "type": "linear", + "domain": { + "data": "blobs_circles_4293ab8e-4a91-43ef-978f-1bcb19b179a1", + "field": ["instance_id"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_f1abb57c-2d57-440d-b5c2-c524717cd27b", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.5, 1.0, 1.5, 2.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_9d96233c-29c2-4e5c-ae9f-5f3a766310da" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_f1abb57c-2d57-440d-b5c2-c524717cd27b", - "value": "instance_id" - }, - "fillOpacity": { - "value": 1.0 - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_e9d0949f-f688-487a-b122-cb6d631417fa", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.5, 1.0, 1.5, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_4293ab8e-4a91-43ef-978f-1bcb19b179a1" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.instance_id)", - "value": "#d3d3d3" - } - ] + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_e9d0949f-f688-487a-b122-cb6d631417fa", + "value": "instance_id" + }, + "fillOpacity": { + "value": 1.0 } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.instance_id)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "f452cde1-5802-5377-90f6-bdc661f7d26d" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json b/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json index c1235dce..6bf19885 100644 --- a/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json +++ b/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json @@ -1,386 +1,443 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "data": [ + { + "name": "72fc6b78-316c-4cd4-9ae2-5e4dc9b07979", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1d0d7f10-6461-445e-ab6c-2107803df834", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_1bf3cf77-f166-4c49-86c4-ddd0a7293f84", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_f52052f0-cd48-4a12-8a30-4e3236e02437", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "72fc6b78-316c-4cd4-9ae2-5e4dc9b07979", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "1d0d7f10-6461-445e-ab6c-2107803df834", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 57.599999999999994 + }, + "y": { + "value": 98.17377685689848 + }, + "width": { + "value": 113.45454545454545 }, - { - "type": "filter_cs", - "expr": "global" + "height": { + "value": 104.45244628620298 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_f78d5830-3306-41e7-bd3c-2453e91fda69", - "type": "ordinal", - "domain": ["c1", "c2"], - "range": ["#1f77b4", "#ff7f0e"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 + } }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_f78d5830-3306-41e7-bd3c-2453e91fda69", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 124.570101010101, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_f52052f0-cd48-4a12-8a30-4e3236e02437" + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_f78d5830-3306-41e7-bd3c-2453e91fda69", - "field": "cluster" - }, - "fillOpacity": { - "value": 1.0 - } + { + "name": "Y_scale_0", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_64f68c02-9502-4a2d-8537-4f2fd2675ba2", + "type": "ordinal", + "domain": ["c1", "c2"], + "range": ["#1f77b4", "#ff7f0e"] + } + ], + "axes": [ + { + "scale": "X_scale_0", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale_0", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_64f68c02-9502-4a2d-8537-4f2fd2675ba2", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 124.570101010101, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_1bf3cf77-f166-4c49-86c4-ddd0a7293f84" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.cluster)", - "value": "#d3d3d3" + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_64f68c02-9502-4a2d-8537-4f2fd2675ba2", + "field": "cluster" + }, + "fillOpacity": { + "value": 1.0 } - ] + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] + } } + }, + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 93.57727272727273 + }, + "y": { + "value": 79.5071101902318 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "0f35db70-f56e-5b2e-a4fe-ae54aebf0843" - } - }, - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" + ] }, - "data": [ - { - "name": "d8f26641-4f98-4242-b6ca-13c06caf2a59", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 98.17377685689851 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 104.45244628620294 + } } }, - { - "name": "blobs_polygons_10e30c77-7940-4f72-b58d-4ac776605c70", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" }, - "source": "d8f26641-4f98-4242-b6ca-13c06caf2a59", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "name": "Y_scale_1", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_c9f26546-3f87-4a73-bb91-39ce51366295", + "type": "ordinal", + "domain": ["c1"], + "range": ["#1f77b4"] + } + ], + "axes": [ + { + "scale": "X_scale_1", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale_1", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_c9f26546-3f87-4a73-bb91-39ce51366295", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 260.7155555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_5e3c149f-5497-4628-8d98-d0881dff35ea" }, - { - "type": "filter_cs", - "expr": "global" + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_c9f26546-3f87-4a73-bb91-39ce51366295", + "field": "cluster" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] + } } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_d2fdfda6-37b0-447a-9a8a-83a344a5d56c", - "type": "ordinal", - "domain": ["c1"], - "range": ["#1f77b4"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_d2fdfda6-37b0-447a-9a8a-83a344a5d56c", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 260.7155555555555, - "legendY": 35.955555555555634 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_10e30c77-7940-4f72-b58d-4ac776605c70" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_d2fdfda6-37b0-447a-9a8a-83a344a5d56c", - "field": "cluster" - }, - "fillOpacity": { - "value": 1.0 + { + "type": "text", + "encode": { + "enter": { + "text": { + "value": "global" + }, + "baseline": { + "value": "alphabetic" + }, + "color": { + "value": "black" + }, + "font": { + "value": "Arial" + }, + "fontSize": { + "value": 15.555555555555555 + }, + "fontStyle": { + "value": "normal" + }, + "fontWeight": { + "value": "normal" + }, + "align": { + "value": { + "value": "center" + } + }, + "x": { + "value": 229.72272727272727 + }, + "y": { + "value": 79.50711019023186 + }, + "linebreak": { + "value": "\n" + } } }, - "update": { - "fill": [ - { - "test": "!isValid(datum.cluster)", - "value": "#d3d3d3" - } - ] - } + "zindex": 3 } - } - ], - "usermeta": { - "axis_uuid": "1ab64093-d7dc-5249-ac86-63281b62455a" + ] } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json b/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json index ad85d904..00072bf1 100644 --- a/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json +++ b/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json @@ -1,217 +1,212 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "94f41227-c5d8-490f-9afe-9650280ab6cd", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f99b4087-de4e-494e-9e8e-0e9bef02a71b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "2ca53cc5-bfd1-467d-b900-7933b2b6c956", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "94f41227-c5d8-490f-9afe-9650280ab6cd", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_circles_781a3df2-6e5a-41c5-a6b4-e972e43d13d3", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "9d227767-95c8-4380-a736-e9dba8590053", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "94f41227-c5d8-490f-9afe-9650280ab6cd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "f99b4087-de4e-494e-9e8e-0e9bef02a71b", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_circles_0296f164-f43f-4e9c-be20-4c794ffad328", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "f99b4087-de4e-494e-9e8e-0e9bef02a71b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" + { + "type": "lookup", + "from": "2ca53cc5-bfd1-467d-b900-7933b2b6c956", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 342.0621919542923], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [255.41373271401557, 137.62348968860152], + "range": "height" + }, + { + "name": "color_7e7b1875-9e01-45bd-8579-6fc3330e79e7", + "type": "ordinal", + "domain": ["a", "c", "d"], + "range": ["#1f77b4", "#279e68", "#d62728"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 150, 200, 250, 300], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [140, 160, 180, 200, 220, 240], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_7e7b1875-9e01-45bd-8579-6fc3330e79e7", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_781a3df2-6e5a-41c5-a6b4-e972e43d13d3" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "filter_cs", - "expr": "global" + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_7e7b1875-9e01-45bd-8579-6fc3330e79e7", + "field": "annotation" }, - { - "type": "lookup", - "from": "9d227767-95c8-4380-a736-e9dba8590053", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["annotation"], - "as": ["annotation"], - "default": null + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 342.0621919542923], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [255.41373271401557, 137.62348968860152], - "range": "height" - }, - { - "name": "color_f93e5a7f-0258-4db4-9a3a-3a2258daf35e", - "type": "ordinal", - "domain": ["a", "c", "d"], - "range": ["#1f77b4", "#279e68", "#d62728"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 150, 200, 250, 300], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [140, 160, 180, 200, 220, 240], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_f93e5a7f-0258-4db4-9a3a-3a2258daf35e", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.7155555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_0296f164-f43f-4e9c-be20-4c794ffad328" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_f93e5a7f-0258-4db4-9a3a-3a2258daf35e", - "field": "annotation" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.annotation)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "ac76fdef-61c7-5887-9715-552cfa435b5a" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json b/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json index 08972deb..4efdca57 100644 --- a/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json +++ b/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.json @@ -1,244 +1,239 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5652de7d-1817-482e-8b8b-721289caa0de", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_621900c2-f2e6-448a-8529-4f92b797c3d1", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_8b65a870-2dce-4b7e-ad2c-d920e78dfd61", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "5652de7d-1817-482e-8b8b-721289caa0de", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_ceef1ab4-13ee-4ab0-b99d-a3b92cb03de8", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_multipolygons_4aacc8a0-1638-4f61-aded-73b9edb526f0", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "5652de7d-1817-482e-8b8b-721289caa0de", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" }, - "source": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multipolygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_e4e76c97-9ecb-4a43-9a85-dc00daf0bc01", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_76ccf0b8-ea7b-49a6-9ff3-0374a3d64689", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "5652de7d-1817-482e-8b8b-721289caa0de", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "36aa5b03-30d6-458a-8a74-7bc090c3a4f2", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 389.33194389674156], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [319.36204268927, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 389.33194389674156], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [319.36204268927, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_621900c2-f2e6-448a-8529-4f92b797c3d1" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_8b65a870-2dce-4b7e-ad2c-d920e78dfd61" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_ceef1ab4-13ee-4ab0-b99d-a3b92cb03de8" }, - { - "type": "path", - "from": { - "data": "blobs_multipolygons_4aacc8a0-1638-4f61-aded-73b9edb526f0" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_e4e76c97-9ecb-4a43-9a85-dc00daf0bc01" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_76ccf0b8-ea7b-49a6-9ff3-0374a3d64689" - }, - "zindex": 2, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "c1c63ddd-2cdb-5369-bed1-93c94497960d" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json b/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json index af6c00ff..7128f2b7 100644 --- a/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json +++ b/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json @@ -1,217 +1,212 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d5fc7e04-2c9b-4313-a09d-e9ada3250913", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "b8895a18-f11d-405f-8e68-117c6198543b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "6e7b96aa-ba19-4369-8d38-b322bdd1bcdb", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "d5fc7e04-2c9b-4313-a09d-e9ada3250913", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_circles_6545e1c4-783d-426e-a80c-722f17b0e43c", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "635b7492-b0bb-4e58-b9a3-ebe8432deaa6", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "d5fc7e04-2c9b-4313-a09d-e9ada3250913", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "b8895a18-f11d-405f-8e68-117c6198543b", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_circles_86a0cb7a-b9c9-4d98-8eee-70f59114f653", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "b8895a18-f11d-405f-8e68-117c6198543b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" + { + "type": "lookup", + "from": "6e7b96aa-ba19-4369-8d38-b322bdd1bcdb", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["annotation"], + "as": ["annotation"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_0c7645fe-1040-44a2-b3f7-dce2e5d92dc8", + "type": "ordinal", + "domain": ["a", "b", "c", "d", "e"], + "range": ["#1f77b4", "#ff7f0e", "#279e68", "#d62728", "#aa40fc"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_0c7645fe-1040-44a2-b3f7-dce2e5d92dc8", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.7155555555555, + "legendY": 35.955555555555634 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_6545e1c4-783d-426e-a80c-722f17b0e43c" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "filter_cs", - "expr": "global" + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_0c7645fe-1040-44a2-b3f7-dce2e5d92dc8", + "field": "annotation" }, - { - "type": "lookup", - "from": "635b7492-b0bb-4e58-b9a3-ebe8432deaa6", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["annotation"], - "as": ["annotation"], - "default": null + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - }, - { - "name": "color_f2371eeb-084d-4473-adc7-39564f0335e8", - "type": "ordinal", - "domain": ["a", "b", "c", "d", "e"], - "range": ["#1f77b4", "#ff7f0e", "#279e68", "#d62728", "#aa40fc"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_f2371eeb-084d-4473-adc7-39564f0335e8", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.7155555555555, - "legendY": 35.955555555555634 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_86a0cb7a-b9c9-4d98-8eee-70f59114f653" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_f2371eeb-084d-4473-adc7-39564f0335e8", - "field": "annotation" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.annotation)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "69501ca0-64e0-550e-af86-570cdd5c0e85" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles.json b/tests/_figures_viewconfig/Shapes_can_render_circles.json index fb0c70c9..7e9160b8 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_circles.json +++ b/tests/_figures_viewconfig/Shapes_can_render_circles.json @@ -1,154 +1,149 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "64392ed5-5d6f-4324-b478-c5b8a42f06bd", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1e2c12ff-e82f-41a5-b134-90d96e305ae5", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_0a1d45c9-9c20-4284-ae4f-62f60350d438", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_34e75260-06d3-44ab-816c-71493bff2d50", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "64392ed5-5d6f-4324-b478-c5b8a42f06bd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "1e2c12ff-e82f-41a5-b134-90d96e305ae5", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_0a1d45c9-9c20-4284-ae4f-62f60350d438" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_34e75260-06d3-44ab-816c-71493bff2d50" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "c0d9a0dd-55ac-5523-bb7c-ef156eb58089" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json index 807d7d98..c5db4cf5 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json @@ -1,163 +1,158 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f931a23b-9b22-4742-b057-e21ebaa371cb", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "27be6871-7160-418b-865f-dbbb92311e21", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_453d6097-05e4-434d-9e4d-29814ac41c99", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_6adead9b-e64a-47c7-8f4b-9e007681b270", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "f931a23b-9b22-4742-b057-e21ebaa371cb", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "27be6871-7160-418b-865f-dbbb92311e21", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_453d6097-05e4-434d-9e4d-29814ac41c99" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_6adead9b-e64a-47c7-8f4b-9e007681b270" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#ff0000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#ff0000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "9410d435-d084-5315-a60b-d28b962e0633" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json b/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json index edd269b7..7c355e9b 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json @@ -1,163 +1,158 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f9232b10-c4b7-4aba-b42c-2c7bf71c071e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "a5b53667-3a01-4efc-a46a-be07ec8e09b9", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_6911550f-81a9-4062-88b8-2f9fd5d64cc7", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_9dd00b7c-6f92-4147-aed4-7dffa24327d2", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "f9232b10-c4b7-4aba-b42c-2c7bf71c071e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "a5b53667-3a01-4efc-a46a-be07ec8e09b9", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_6911550f-81a9-4062-88b8-2f9fd5d64cc7" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_9dd00b7c-6f92-4147-aed4-7dffa24327d2" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "b2c4c534-07b7-52ad-88b9-b3790b721a4d" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json b/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json index cbe335b5..b7c77247 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json @@ -1,163 +1,158 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "495ddb74-da1d-4880-8055-416758e5f733", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "4a6fd48c-74a8-4b8f-a331-3169a7efc16f", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_09e9d7df-9d6c-4d4f-9624-2761c6ef591a", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_27372d34-f2cd-4d2b-8244-f5169027166f", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "495ddb74-da1d-4880-8055-416758e5f733", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "4a6fd48c-74a8-4b8f-a331-3169a7efc16f", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_09e9d7df-9d6c-4d4f-9624-2761c6ef591a" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_27372d34-f2cd-4d2b-8244-f5169027166f" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 3.0 - }, - "strokeOpacity": { - "value": 1 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 3.0 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "1cdc0b18-b0e5-5d62-9e10-185036328b0b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json b/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json index b98a1612..dd562740 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json +++ b/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.json @@ -1,244 +1,239 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d33d4957-9736-4833-b989-cf8b7fc4d1af", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "8be5fec3-9041-4dcb-a151-36eee5b59329", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_21310b5b-0829-42e6-83cc-d1e04cc1ea45", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_4db9df4c-afe2-4ec3-adc7-ba23029695bf", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "d33d4957-9736-4833-b989-cf8b7fc4d1af", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "8be5fec3-9041-4dcb-a151-36eee5b59329", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_f2753726-8480-48a2-8128-2a033914cf21", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_c7b061fa-deec-4f7d-bc41-fa2774f43445", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "d33d4957-9736-4833-b989-cf8b7fc4d1af", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "8be5fec3-9041-4dcb-a151-36eee5b59329", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_7b6cbd3f-a715-421d-88f7-5f2771ece230", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_multipolygons_06a1b477-0139-4eaf-9c56-7c63310ae38d", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "d33d4957-9736-4833-b989-cf8b7fc4d1af", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" }, - "source": "8be5fec3-9041-4dcb-a151-36eee5b59329", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multipolygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_21310b5b-0829-42e6-83cc-d1e04cc1ea45" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_4db9df4c-afe2-4ec3-adc7-ba23029695bf" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_f2753726-8480-48a2-8128-2a033914cf21" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_c7b061fa-deec-4f7d-bc41-fa2774f43445" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_7b6cbd3f-a715-421d-88f7-5f2771ece230" }, - { - "type": "path", - "from": { - "data": "blobs_multipolygons_06a1b477-0139-4eaf-9c56-7c63310ae38d" - }, - "zindex": 2, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "8fe7bd47-b5f7-5bc9-915e-4df6ad03b3ec" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json b/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json index 2d1c4bbc..582c95e1 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json +++ b/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json @@ -1,223 +1,218 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0103c8fb-7e5b-4bf6-bdc9-52bad05bb6bf", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "cc2f0451-ee50-4d68-9bdf-c711b64e16cf", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "2d3f5016-5406-446f-84ea-6d35e7cd4245", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "0103c8fb-7e5b-4bf6-bdc9-52bad05bb6bf", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "p_7bd3b270-04bb-403f-8994-1cc67128287f", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "eed76153-df16-491b-bfbf-de61eebd25f9", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "0103c8fb-7e5b-4bf6-bdc9-52bad05bb6bf", + "transform": [ + { + "type": "filter_element", + "expr": "p" }, - "source": "cc2f0451-ee50-4d68-9bdf-c711b64e16cf", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "p_88b7854d-7bb4-4c9b-9d72-132554cd3765", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "cc2f0451-ee50-4d68-9bdf-c711b64e16cf", - "transform": [ - { - "type": "filter_element", - "expr": "p" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "eed76153-df16-491b-bfbf-de61eebd25f9", - "key": "val", - "fields": ["instance_ids"], - "values": ["val"], - "as": ["val"], - "default": null - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [0.0, 6.0], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [1.0, 0.0], - "range": "height" - }, - { - "name": "color_640d8695-1303-43fe-844a-35acb08513a5", - "type": "linear", - "domain": { - "data": "p_88b7854d-7bb4-4c9b-9d72-132554cd3765", - "field": ["val"] - }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "lookup", + "from": "2d3f5016-5406-446f-84ea-6d35e7cd4245", + "key": "val", + "fields": ["instance_ids"], + "values": ["val"], + "as": ["val"], + "default": null } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 2, 4, 6], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 6.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [1.0, 0.0], + "range": "height" + }, + { + "name": "color_c9fea7cc-7948-413f-a149-aac91d283e6a", + "type": "linear", + "domain": { + "data": "p_7bd3b270-04bb-403f-8994-1cc67128287f", + "field": ["val"] }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [0, 1], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_640d8695-1303-43fe-844a-35acb08513a5", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "p_88b7854d-7bb4-4c9b-9d72-132554cd3765" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_640d8695-1303-43fe-844a-35acb08513a5", - "value": "val" - }, - "fillOpacity": { - "value": 0.3 - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 2, 4, 6], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 1], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c9fea7cc-7948-413f-a149-aac91d283e6a", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "p_7bd3b270-04bb-403f-8994-1cc67128287f" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.val)", - "value": "#d3d3d3" - } - ] + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_c9fea7cc-7948-413f-a149-aac91d283e6a", + "value": "val" + }, + "fillOpacity": { + "value": 0.3 } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.val)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "95ef9fa5-0963-527b-b705-bafa68e6d8e9" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons.json b/tests/_figures_viewconfig/Shapes_can_render_polygons.json index d9ea1cda..d9c3f318 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_polygons.json +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons.json @@ -1,154 +1,149 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "b1520c0b-20fd-48f7-9378-6ab07e8aa69d", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "582320bd-bb01-4d2a-9295-4e6935164963", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_a5612389-e389-42fa-8027-99408c1baa93", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_7ea96831-b6ae-4114-8227-d30df9363d6a", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "b1520c0b-20fd-48f7-9378-6ab07e8aa69d", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "582320bd-bb01-4d2a-9295-4e6935164963", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_a5612389-e389-42fa-8027-99408c1baa93" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_7ea96831-b6ae-4114-8227-d30df9363d6a" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "70175a6c-f1a9-528f-b779-3d58fa786939" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json index 6e1f5fcf..858dc31a 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json @@ -1,163 +1,158 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a261c3b4-1242-4a11-9a74-fc4899ff5390", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "431396c7-6a65-421e-93fe-829b9a296176", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_272da12d-ed18-431a-857a-9a565983c174", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_abb7a36b-0076-4762-96ab-e965d9bf9fd0", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "a261c3b4-1242-4a11-9a74-fc4899ff5390", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "431396c7-6a65-421e-93fe-829b9a296176", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_272da12d-ed18-431a-857a-9a565983c174" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_abb7a36b-0076-4762-96ab-e965d9bf9fd0" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "ff5a6897-2997-5f11-86dd-7ab5af324065" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json index 165c08a1..e9ea3bd3 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json @@ -1,163 +1,158 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "56b1c3d9-a463-46ae-87bf-0b11e89ac29c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "49db8c4f-d285-47cc-965b-3ed46f8de32d", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_46b084f1-186b-4dd6-bf7d-1cceaf4d291f", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_76373f25-e023-4fc7-905a-7e3df1c5e7f8", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "56b1c3d9-a463-46ae-87bf-0b11e89ac29c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "49db8c4f-d285-47cc-965b-3ed46f8de32d", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_46b084f1-186b-4dd6-bf7d-1cceaf4d291f" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_76373f25-e023-4fc7-905a-7e3df1c5e7f8" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#0000ff" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#0000ff" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "c9ea0f63-15b7-5e8a-8dca-1acadf21482e" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json index 6eedad53..ae466acd 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json @@ -1,163 +1,158 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a5d6e82e-04c0-4ca9-94c9-2870e2ac79cd", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "92834385-85c3-4dc3-85c8-87c377c019d5", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_f6c3addd-f7a6-484d-8811-0bcfb4a1c62e", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_0a3d48d9-adaf-4e1e-aaf0-daa174a170bd", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "a5d6e82e-04c0-4ca9-94c9-2870e2ac79cd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "92834385-85c3-4dc3-85c8-87c377c019d5", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_f6c3addd-f7a6-484d-8811-0bcfb4a1c62e" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_0a3d48d9-adaf-4e1e-aaf0-daa174a170bd" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#00ff00" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#00ff00" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "583b7282-bf50-5748-ad32-b24bad278544" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json index 9b2159d4..a7da3f95 100644 --- a/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json @@ -1,163 +1,158 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e9179e58-af36-4f2c-89ad-c357091a1177", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "05f78781-8b35-4f0f-be2d-5b181fdead45", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_0b1c99e5-289c-4a78-8c45-4e212f029a6d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_4cd8ae3a-284b-4d34-b511-77b416b7c9de", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "e9179e58-af36-4f2c-89ad-c357091a1177", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "05f78781-8b35-4f0f-be2d-5b181fdead45", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_0b1c99e5-289c-4a78-8c45-4e212f029a6d" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_4cd8ae3a-284b-4d34-b511-77b416b7c9de" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#ff0000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#ff0000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "ba88967e-a86e-53d0-af08-cabdabbd1a1b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_scale_shapes.json b/tests/_figures_viewconfig/Shapes_can_scale_shapes.json index 3750bb9d..43d3a365 100644 --- a/tests/_figures_viewconfig/Shapes_can_scale_shapes.json +++ b/tests/_figures_viewconfig/Shapes_can_scale_shapes.json @@ -1,154 +1,149 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "35e0e259-17c2-4dab-8ec5-20f88163f8ea", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "67e0f819-729b-4ec9-bb9b-481f8f3a2985", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_79a03ead-8a1e-4d45-8484-30c11bd22619", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_14992c4d-1468-42e2-8582-2f323898bf2b", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "35e0e259-17c2-4dab-8ec5-20f88163f8ea", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "67e0f819-729b-4ec9-bb9b-481f8f3a2985", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_79a03ead-8a1e-4d45-8484-30c11bd22619" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_14992c4d-1468-42e2-8582-2f323898bf2b" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 0.5, - "scaleY": 0.5, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 0.5, + "scaleY": 0.5, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "c0cfccdd-a654-5e35-a07e-d13ea6bfbd44" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_set_clims_clip.json b/tests/_figures_viewconfig/Shapes_can_set_clims_clip.json index c0b3e584..efc3f72a 100644 --- a/tests/_figures_viewconfig/Shapes_can_set_clims_clip.json +++ b/tests/_figures_viewconfig/Shapes_can_set_clims_clip.json @@ -1,236 +1,231 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a8952bdc-8218-4963-ac7e-eb937aeae08e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f662f079-28e1-4a39-b4d5-fc3580734d2e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "e23dad2a-8aa1-4ca2-b638-6685a17e3de6", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "a8952bdc-8218-4963-ac7e-eb937aeae08e", + "transform": [ + { + "type": "filter_element", + "expr": "new_table" } + ] + }, + { + "name": "blobs_circles_44f938a0-54c5-48c1-9f1d-4d6ca2c92aab", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "6b521bc3-8c5d-4241-9e72-7456da5c6d7f", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "a8952bdc-8218-4963-ac7e-eb937aeae08e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "f662f079-28e1-4a39-b4d5-fc3580734d2e", - "transform": [ - { - "type": "filter_element", - "expr": "new_table" - } - ] - }, - { - "name": "blobs_circles_169f7a20-801a-49a5-a91a-17583ed1e77f", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "f662f079-28e1-4a39-b4d5-fc3580734d2e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "lookup", - "from": "6b521bc3-8c5d-4241-9e72-7456da5c6d7f", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["dummy_gene_expression"], - "as": ["dummy_gene_expression"], - "default": null - }, - { - "type": "formula", - "expr": "clamp((datum.value - 20.0) / (40.0 - 20.0), 0, 1)", - "as": "755d5782-45ab-4779-9772-14b1a83202cd" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - }, - { - "name": "color_f754374e-a114-4d13-a07b-c0eb86407b75", - "type": "linear", - "domain": { - "data": "blobs_circles_169f7a20-801a-49a5-a91a-17583ed1e77f", - "field": "755d5782-45ab-4779-9772-14b1a83202cd" + { + "type": "lookup", + "from": "e23dad2a-8aa1-4ca2-b638-6685a17e3de6", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["dummy_gene_expression"], + "as": ["dummy_gene_expression"], + "default": null }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 20.0) / (40.0 - 20.0), 0, 1)", + "as": "98aca771-4e43-46cd-b8c0-2d9ff6e7d2a0" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + }, + { + "name": "color_d0d34d52-9c94-4490-8a5f-fa58de4a1ba8", + "type": "linear", + "domain": { + "data": "blobs_circles_44f938a0-54c5-48c1-9f1d-4d6ca2c92aab", + "field": "98aca771-4e43-46cd-b8c0-2d9ff6e7d2a0" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_f754374e-a114-4d13-a07b-c0eb86407b75", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [20.0, 25.0, 30.0, 35.0, 40.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_169f7a20-801a-49a5-a91a-17583ed1e77f" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_d0d34d52-9c94-4490-8a5f-fa58de4a1ba8", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [20.0, 25.0, 30.0, 35.0, 40.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_44f938a0-54c5-48c1-9f1d-4d6ca2c92aab" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_d0d34d52-9c94-4490-8a5f-fa58de4a1ba8", + "value": "98aca771-4e43-46cd-b8c0-2d9ff6e7d2a0" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.dummy_gene_expression)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.dummy_gene_expression) < 20.0", + "value": "#440154" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_f754374e-a114-4d13-a07b-c0eb86407b75", - "value": "755d5782-45ab-4779-9772-14b1a83202cd" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.dummy_gene_expression) > 40.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.dummy_gene_expression)", - "value": "#d3d3d3" - }, - { - "test": "datum.dummy_gene_expression) < 20.0", - "value": "#440154" - }, - { - "test": "datum.dummy_gene_expression) > 40.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "7421b78b-6b82-5a10-843e-0d5cac78b3d4" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json b/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json index b04033c1..184329cc 100644 --- a/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json +++ b/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.json @@ -1,199 +1,194 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "900f1cad-eef1-47c9-adca-4fc4be218e12", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1b094ecf-b5f9-409f-a5b0-05231c273f99", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_1c2fe0a4-d0c6-4510-9eed-1e6e06a32b1a", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_8bb8596d-074d-4ec7-81dd-2d1559ac346f", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "900f1cad-eef1-47c9-adca-4fc4be218e12", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "1b094ecf-b5f9-409f-a5b0-05231c273f99", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_2f0f2b50-42bc-4950-b5ca-f888eb8c78dd", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_382204a7-2eda-41ba-9789-7bb6e18732af", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "900f1cad-eef1-47c9-adca-4fc4be218e12", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "1b094ecf-b5f9-409f-a5b0-05231c273f99", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_1c2fe0a4-d0c6-4510-9eed-1e6e06a32b1a" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_8bb8596d-074d-4ec7-81dd-2d1559ac346f" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 0.5 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 0.5 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_2f0f2b50-42bc-4950-b5ca-f888eb8c78dd" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_382204a7-2eda-41ba-9789-7bb6e18732af" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#0000ff" - }, - "fillOpacity": { - "value": 0.5 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#0000ff" + }, + "fillOpacity": { + "value": 0.5 } } } - ], - "usermeta": { - "axis_uuid": "3a92b839-c72d-598c-b9da-1115576566d9" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json b/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json index d2cf2864..4e74d8a8 100644 --- a/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json +++ b/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json @@ -1,154 +1,149 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3429e0b0-4fa0-4f29-8adc-a99ffbcb5ea2", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "1da193e0-56bc-4aa7-9160-81767ffac519", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_c7572120-628f-4af1-b136-5d279ed38a66", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_b63d35d9-5470-412f-853f-d2f3af28f458", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "3429e0b0-4fa0-4f29-8adc-a99ffbcb5ea2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "1da193e0-56bc-4aa7-9160-81767ffac519", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 420.4223630265261], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [422.3187062594394, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 420.4223630265261], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [422.3187062594394, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_c7572120-628f-4af1-b136-5d279ed38a66" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_b63d35d9-5470-412f-853f-d2f3af28f458" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "962e7c05-5553-5fef-8a06-80433149b302" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json b/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json index 374b1b5f..8506bf88 100644 --- a/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json +++ b/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.json @@ -1,213 +1,208 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "9772359c-da78-4e4b-9cae-d07777fc2a94", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "8bd301eb-998c-4eef-92c1-ba3f1025d451", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_3b322654-ac56-4a9b-aa42-b6c053e92ffa", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_2ce35219-7787-425b-9718-7292e48cf327", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "9772359c-da78-4e4b-9cae-d07777fc2a94", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "8bd301eb-998c-4eef-92c1-ba3f1025d451", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "formula", - "expr": "clamp((datum.value - 0.0) / (5.0 - 0.0), 0, 1)", - "as": "82c58aab-eef4-4008-999b-c4dd11b6cd37" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_c3f1a7f3-ee2f-453b-8a84-c6980d62cbb2", - "type": "linear", - "domain": { - "data": "blobs_polygons_2ce35219-7787-425b-9718-7292e48cf327", - "field": "82c58aab-eef4-4008-999b-c4dd11b6cd37" + { + "type": "filter_cs", + "expr": "global" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 0.0) / (5.0 - 0.0), 0, 1)", + "as": "c8a78527-1eb6-4635-aeb5-bbb34dcb9c82" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_57205346-40b1-479e-818d-81d1b963d047", + "type": "linear", + "domain": { + "data": "blobs_polygons_3b322654-ac56-4a9b-aa42-b6c053e92ffa", + "field": "c8a78527-1eb6-4635-aeb5-bbb34dcb9c82" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_c3f1a7f3-ee2f-453b-8a84-c6980d62cbb2", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [1.0, 2.0, 3.0, 4.0, 5.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_2ce35219-7787-425b-9718-7292e48cf327" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_57205346-40b1-479e-818d-81d1b963d047", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 2.0, 3.0, 4.0, 5.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_3b322654-ac56-4a9b-aa42-b6c053e92ffa" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_57205346-40b1-479e-818d-81d1b963d047", + "value": "c8a78527-1eb6-4635-aeb5-bbb34dcb9c82" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.cluster) < 0.0", + "value": "#440154" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_c3f1a7f3-ee2f-453b-8a84-c6980d62cbb2", - "value": "82c58aab-eef4-4008-999b-c4dd11b6cd37" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.cluster) > 5.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.cluster)", - "value": "#d3d3d3" - }, - { - "test": "datum.cluster) < 0.0", - "value": "#440154" - }, - { - "test": "datum.cluster) > 5.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "108d6796-fa19-5d41-8b3f-77aa6baf6f29" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json b/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json index 0f32102e..bc5bfe33 100644 --- a/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json +++ b/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.json @@ -1,200 +1,195 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" - }, - "data": [ - { - "name": "3e737133-5ffa-456c-9096-3d907307ebe3", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } - }, - { - "name": "blobs_polygons_80272402-f751-45e3-818f-d60c6afc48f3", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" - }, - "source": "3e737133-5ffa-456c-9096-3d907307ebe3", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - } - ] +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7485b09d-5666-4d7b-b609-784b46695851", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" + }, + { + "name": "blobs_polygons_62db3c7f-ae8d-4b81-97be-20a14c8bdcf6", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "color_abaf73b0-b8cb-499d-82e6-dd9498d848e7", - "type": "linear", - "domain": { - "data": "blobs_polygons_80272402-f751-45e3-818f-d60c6afc48f3", - "field": "cluster" + "source": "7485b09d-5666-4d7b-b609-784b46695851", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "filter_cs", + "expr": "global" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_462d560f-14d0-461d-8adb-b0277b62a4d5", + "type": "linear", + "domain": { + "data": "blobs_polygons_62db3c7f-ae8d-4b81-97be-20a14c8bdcf6", + "field": "cluster" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_abaf73b0-b8cb-499d-82e6-dd9498d848e7", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": null, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 5.0, 10.0, 15.0, 20.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_80272402-f751-45e3-818f-d60c6afc48f3" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_abaf73b0-b8cb-499d-82e6-dd9498d848e7", - "value": "cluster" - }, - "fillOpacity": { - "value": 1.0 - } + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_462d560f-14d0-461d-8adb-b0277b62a4d5", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_62db3c7f-ae8d-4b81-97be-20a14c8bdcf6" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - "update": { - "fill": [ - { - "test": "!isValid(datum.cluster)", - "value": "#d3d3d3" - } - ] + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_462d560f-14d0-461d-8adb-b0277b62a4d5", + "value": "cluster" + }, + "fillOpacity": { + "value": 1.0 } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] } } - ], - "usermeta": { - "axis_uuid": "f8f95fb2-d404-58e5-9ab0-fdd44b67a0dc" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_coloring_with_palette.json b/tests/_figures_viewconfig/Shapes_coloring_with_palette.json index 5e5e593f..a898040c 100644 --- a/tests/_figures_viewconfig/Shapes_coloring_with_palette.json +++ b/tests/_figures_viewconfig/Shapes_coloring_with_palette.json @@ -1,194 +1,189 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "94577357-79ca-4d5f-b39d-7cf089e3bbfd", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f43838f7-345e-4a47-9567-85f186602bc1", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_b236717e-2714-41d2-80f0-b17569413cd2", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_8820ce63-6f54-47de-b29c-a73561a1627a", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "94577357-79ca-4d5f-b39d-7cf089e3bbfd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "f43838f7-345e-4a47-9567-85f186602bc1", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_93b8e42b-e091-4e0d-a705-0272d339535c", + "type": "ordinal", + "domain": ["c2", "c1"], + "range": ["#008000", "#ffff00"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_93b8e42b-e091-4e0d-a705-0272d339535c", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 260.7155555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_b236717e-2714-41d2-80f0-b17569413cd2" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_93b8e42b-e091-4e0d-a705-0272d339535c", + "field": "cluster" + }, + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_9923049f-a36c-4456-8c18-5ceff4ce733e", - "type": "ordinal", - "domain": ["c2", "c1"], - "range": ["#008000", "#ffff00"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_9923049f-a36c-4456-8c18-5ceff4ce733e", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 260.7155555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_8820ce63-6f54-47de-b29c-a73561a1627a" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_9923049f-a36c-4456-8c18-5ceff4ce733e", - "field": "cluster" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.cluster)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "33e65d2a-b503-57b1-bb52-96d1b066eebe" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json index 31d62b81..9455aa7d 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json @@ -1,223 +1,218 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "57a6cef5-6009-45ad-a7b2-4bbed96b9864", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "3b930536-afb0-428a-a840-5c734a0ba2c2", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "4ffc892c-077c-4f77-91fa-b7d6ffff04c3", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "57a6cef5-6009-45ad-a7b2-4bbed96b9864", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_polygons_f6a2d014-f9bb-42a9-8271-e70dbdacba4e", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "ca6f742f-8b45-4061-a972-d3350ff3d16b", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "57a6cef5-6009-45ad-a7b2-4bbed96b9864", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "3b930536-afb0-428a-a840-5c734a0ba2c2", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_polygons_962691cc-8618-4e51-b774-dad8ce8fbf0e", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "4ffc892c-077c-4f77-91fa-b7d6ffff04c3", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null }, - "source": "3b930536-afb0-428a-a840-5c734a0ba2c2", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "aggregate", + "field": ["category"], + "ops": ["count"], + "as": ["category"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_7b17704a-9fef-4baf-8a30-dd89df0af53a", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_7b17704a-9fef-4baf-8a30-dd89df0af53a", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_f6a2d014-f9bb-42a9-8271-e70dbdacba4e" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "lookup", - "from": "ca6f742f-8b45-4061-a972-d3350ff3d16b", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["category"], - "as": ["category"], - "default": null + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_7b17704a-9fef-4baf-8a30-dd89df0af53a", + "field": "category" }, - { - "type": "aggregate", - "field": ["category"], - "ops": ["count"], - "as": ["category"] + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_d12adf9f-cb82-4faa-851e-1206ef55b9d0", - "type": "ordinal", - "domain": ["a", "b", "c"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_d12adf9f-cb82-4faa-851e-1206ef55b9d0", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.8405555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_962691cc-8618-4e51-b774-dad8ce8fbf0e" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_d12adf9f-cb82-4faa-851e-1206ef55b9d0", - "field": "category" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.category)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "4564f80e-7fef-5c92-8f32-bb2421df1de9" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json index 58d94d14..ca9213d8 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.json @@ -1,219 +1,214 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "40acabdf-b0d8-4ac3-ba9e-2a69537353e4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "2c184418-2e73-4ff7-8fd8-2ff5dd30af13", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_c180760c-7703-4f54-b1c1-a28d6d227529", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_635d30b9-e4dc-43a1-b098-1e7be9026bcc", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "40acabdf-b0d8-4ac3-ba9e-2a69537353e4", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "2c184418-2e73-4ff7-8fd8-2ff5dd30af13", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["value"], - "ops": ["sum"], - "as": ["value"] - }, - { - "type": "formula", - "expr": "(datum.value - 1.0) / (2.0 - 1.0)", - "as": "da72bf32-2360-4381-a926-da2be34efbb4" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_f6e724e5-2877-41a7-b4fb-7bcc6bdad9f3", - "type": "linear", - "domain": { - "data": "blobs_polygons_635d30b9-e4dc-43a1-b098-1e7be9026bcc", - "field": "da72bf32-2360-4381-a926-da2be34efbb4" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["sum"], + "as": ["value"] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 1.0) / (2.0 - 1.0)", + "as": "cb0e2809-2118-420b-8d4c-38d3b55cdbb3" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_82d22807-f55f-452e-a978-adf1535c07a3", + "type": "linear", + "domain": { + "data": "blobs_polygons_c180760c-7703-4f54-b1c1-a28d6d227529", + "field": "cb0e2809-2118-420b-8d4c-38d3b55cdbb3" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_f6e724e5-2877-41a7-b4fb-7bcc6bdad9f3", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_635d30b9-e4dc-43a1-b098-1e7be9026bcc" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_82d22807-f55f-452e-a978-adf1535c07a3", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_c180760c-7703-4f54-b1c1-a28d6d227529" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_82d22807-f55f-452e-a978-adf1535c07a3", + "value": "cb0e2809-2118-420b-8d4c-38d3b55cdbb3" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 1.0", + "value": "#440154" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_f6e724e5-2877-41a7-b4fb-7bcc6bdad9f3", - "value": "da72bf32-2360-4381-a926-da2be34efbb4" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 2.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 1.0", - "value": "#440154" - }, - { - "test": "datum.value) > 2.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "67955123-93da-509d-bb41-8823df32760c" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json index c734974e..6a0dd3d5 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.json @@ -1,219 +1,214 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "ad369602-1798-4d89-8eaf-83efdc7bab96", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "cd742906-bd05-4493-b826-a826f48660b8", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_5f133ca9-46c2-448b-92b0-0b554e60f8c6", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_b23b0e7f-f8e5-4ca2-886b-5212eff7134d", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "ad369602-1798-4d89-8eaf-83efdc7bab96", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "cd742906-bd05-4493-b826-a826f48660b8", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["value"], - "ops": ["sum"], - "as": ["value"] - }, - { - "type": "formula", - "expr": "(datum.value - 1.0) / (20.0 - 1.0)", - "as": "d5439005-ed2c-4f77-be9b-18e825b83a41" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_d33e08b1-6007-4f5e-b270-bd04dd237c01", - "type": "linear", - "domain": { - "data": "blobs_polygons_b23b0e7f-f8e5-4ca2-886b-5212eff7134d", - "field": "d5439005-ed2c-4f77-be9b-18e825b83a41" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["sum"], + "as": ["value"] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 1.0) / (20.0 - 1.0)", + "as": "63de657e-10ad-41fe-995b-acd5495468a4" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_87831148-15bd-43c9-b48e-7186e55e2a56", + "type": "linear", + "domain": { + "data": "blobs_polygons_5f133ca9-46c2-448b-92b0-0b554e60f8c6", + "field": "63de657e-10ad-41fe-995b-acd5495468a4" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_d33e08b1-6007-4f5e-b270-bd04dd237c01", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 5.0, 10.0, 15.0, 20.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_b23b0e7f-f8e5-4ca2-886b-5212eff7134d" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_87831148-15bd-43c9-b48e-7186e55e2a56", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_5f133ca9-46c2-448b-92b0-0b554e60f8c6" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_87831148-15bd-43c9-b48e-7186e55e2a56", + "value": "63de657e-10ad-41fe-995b-acd5495468a4" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 1.0", + "value": "#440154" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_d33e08b1-6007-4f5e-b270-bd04dd237c01", - "value": "d5439005-ed2c-4f77-be9b-18e825b83a41" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 20.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 1.0", - "value": "#440154" - }, - { - "test": "datum.value) > 20.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "cca606e1-2622-5fd8-bde3-8ea997c9e79e" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json index 367a53d8..dfc0450e 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.json @@ -1,219 +1,214 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e45341af-3063-4847-b0ab-26727292d9a0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f24e68c6-200c-4441-8c20-37dcb9758c5b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_5619ef43-5833-4ebf-9cac-cd068b339722", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_9a88a1d0-53d7-497e-a5d4-e612ba7759f1", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "e45341af-3063-4847-b0ab-26727292d9a0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "f24e68c6-200c-4441-8c20-37dcb9758c5b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["value"], - "ops": ["max"], - "as": ["value"] - }, - { - "type": "formula", - "expr": "clamp((datum.value - 2.0) / (4.0 - 2.0), 0, 1)", - "as": "fe77b431-471f-4f58-9143-b3fdbb81d24b" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_99cb7335-7d2e-43e1-b0b4-dba12158de2a", - "type": "linear", - "domain": { - "data": "blobs_polygons_9a88a1d0-53d7-497e-a5d4-e612ba7759f1", - "field": "fe77b431-471f-4f58-9143-b3fdbb81d24b" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 2.0) / (4.0 - 2.0), 0, 1)", + "as": "85feb21e-65d3-444d-9fb6-2acb7f861f03" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_c57ab748-de7c-47f3-80d4-d02905b8be58", + "type": "linear", + "domain": { + "data": "blobs_polygons_5619ef43-5833-4ebf-9cac-cd068b339722", + "field": "85feb21e-65d3-444d-9fb6-2acb7f861f03" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_99cb7335-7d2e-43e1-b0b4-dba12158de2a", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [2.0, 2.5, 3.0, 3.5, 4.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_9a88a1d0-53d7-497e-a5d4-e612ba7759f1" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c57ab748-de7c-47f3-80d4-d02905b8be58", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [2.0, 2.5, 3.0, 3.5, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_5619ef43-5833-4ebf-9cac-cd068b339722" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_c57ab748-de7c-47f3-80d4-d02905b8be58", + "value": "85feb21e-65d3-444d-9fb6-2acb7f861f03" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 2.0", + "value": "#000000" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_99cb7335-7d2e-43e1-b0b4-dba12158de2a", - "value": "fe77b431-471f-4f58-9143-b3fdbb81d24b" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 4.0", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 2.0", - "value": "#000000" - }, - { - "test": "datum.value) > 4.0", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "31584187-588f-5769-b393-edd0730253af" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json index e7061038..566f03a2 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.json @@ -1,219 +1,214 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e4fe4e6f-b22c-422b-8ee1-825a60dc0a2f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "d5d943ac-1d68-4a64-8dbd-30a6472c5929", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_ad62d211-faef-4f97-adae-460a757e7ed6", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_a00043bc-e062-4f29-b28d-850351bed71b", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "e4fe4e6f-b22c-422b-8ee1-825a60dc0a2f", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "d5d943ac-1d68-4a64-8dbd-30a6472c5929", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["value"], - "ops": ["max"], - "as": ["value"] - }, - { - "type": "formula", - "expr": "(datum.value - 2.0) / (4.0 - 2.0)", - "as": "fcb9e930-f5ac-4c02-879b-b9bdcf2ce68b" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_224d59eb-cbea-435e-9210-86acfaf88182", - "type": "linear", - "domain": { - "data": "blobs_polygons_a00043bc-e062-4f29-b28d-850351bed71b", - "field": "fcb9e930-f5ac-4c02-879b-b9bdcf2ce68b" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 2.0) / (4.0 - 2.0)", + "as": "790fb368-c8e0-4a3e-bb43-03780ab3c2ea" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_c0e07a75-7f26-4d70-835b-f0ae547b3a7b", + "type": "linear", + "domain": { + "data": "blobs_polygons_ad62d211-faef-4f97-adae-460a757e7ed6", + "field": "790fb368-c8e0-4a3e-bb43-03780ab3c2ea" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_224d59eb-cbea-435e-9210-86acfaf88182", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [2.0, 2.5, 3.0, 3.5, 4.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_a00043bc-e062-4f29-b28d-850351bed71b" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c0e07a75-7f26-4d70-835b-f0ae547b3a7b", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [2.0, 2.5, 3.0, 3.5, 4.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_ad62d211-faef-4f97-adae-460a757e7ed6" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_c0e07a75-7f26-4d70-835b-f0ae547b3a7b", + "value": "790fb368-c8e0-4a3e-bb43-03780ab3c2ea" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 2.0", + "value": "#000000" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_224d59eb-cbea-435e-9210-86acfaf88182", - "value": "fcb9e930-f5ac-4c02-879b-b9bdcf2ce68b" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 4.0", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 2.0", - "value": "#000000" - }, - { - "test": "datum.value) > 4.0", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "fd9eb870-535f-55ec-bfbc-5eb1a2207b8c" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json index 2caee8be..deb7df24 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json @@ -1,262 +1,257 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0f3256da-b552-4640-8e09-9e69c0000a79", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "205a4223-178a-471c-8c62-1ac89cace850", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_8e04de68-c684-47e9-bc32-85d2901cbeb5", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_300e9c83-98ad-4adc-8e33-b028405d7087", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "0f3256da-b552-4640-8e09-9e69c0000a79", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "205a4223-178a-471c-8c62-1ac89cace850", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_polygons_c4cfd430-6433-4079-855f-a31503e97dd8", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_4a4b7dc6-de81-4ccb-b1f5-bf5da64ef46c", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "0f3256da-b552-4640-8e09-9e69c0000a79", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "205a4223-178a-471c-8c62-1ac89cace850", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_multipolygons_90183a76-c6a0-49c8-9573-e4e92554dcd0", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_multipolygons_368bcc6a-0a1d-4c6c-b501-2cf7dc9b840c", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "0f3256da-b552-4640-8e09-9e69c0000a79", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" }, - "source": "205a4223-178a-471c-8c62-1ac89cace850", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multipolygons" + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_8e04de68-c684-47e9-bc32-85d2901cbeb5" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_300e9c83-98ad-4adc-8e33-b028405d7087" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_c4cfd430-6433-4079-855f-a31503e97dd8" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_4a4b7dc6-de81-4ccb-b1f5-bf5da64ef46c" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_90183a76-c6a0-49c8-9573-e4e92554dcd0" }, - { - "type": "path", - "from": { - "data": "blobs_multipolygons_368bcc6a-0a1d-4c6c-b501-2cf7dc9b840c" - }, - "zindex": 2, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#ff0000" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#ff0000" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "34d5b766-51ed-54e6-b228-7bb13d8fea6d" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json index 1b64a845..2c971964 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json @@ -1,262 +1,257 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "ae0b83c5-5c80-4d2f-a13d-21538d177a64", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "7f5c3f13-540c-451b-b82c-1027c78b96f0", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_b7e8cb8e-74e1-4fa0-a44e-6b83bafca479", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_fb23125b-a71e-4b2e-916b-1d879228122c", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "ae0b83c5-5c80-4d2f-a13d-21538d177a64", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "7f5c3f13-540c-451b-b82c-1027c78b96f0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_polygons_b69df1e7-71dd-42fd-84e6-c218820b05e5", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_60e2553f-a6fe-4617-b6a9-164aed069beb", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "ae0b83c5-5c80-4d2f-a13d-21538d177a64", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "7f5c3f13-540c-451b-b82c-1027c78b96f0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_multipolygons_7b724c3d-265f-4842-bc8c-79495b22c9a7", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_multipolygons_442f6b85-086c-42f7-af5a-19f4c9860924", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "ae0b83c5-5c80-4d2f-a13d-21538d177a64", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" }, - "source": "7f5c3f13-540c-451b-b82c-1027c78b96f0", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multipolygons" + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_b7e8cb8e-74e1-4fa0-a44e-6b83bafca479" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_fb23125b-a71e-4b2e-916b-1d879228122c" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_b69df1e7-71dd-42fd-84e6-c218820b05e5" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_60e2553f-a6fe-4617-b6a9-164aed069beb" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_7b724c3d-265f-4842-bc8c-79495b22c9a7" }, - { - "type": "path", - "from": { - "data": "blobs_multipolygons_442f6b85-086c-42f7-af5a-19f4c9860924" - }, - "zindex": 2, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - } + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "f010839a-dfdc-531d-bf8f-b01b17f53b90" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json index 1d0cdf8a..18e5b09e 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2bba079c-e1e6-4aad-be0e-238a74d44064", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "b8524803-d1d6-4435-b38c-10bda92cfb3c", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_b56eaf39-66fa-4dd9-995c-946fdad280ce", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_27c0a723-98e7-4bb1-9b27-684992d38566", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "2bba079c-e1e6-4aad-be0e-238a74d44064", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "b8524803-d1d6-4435-b38c-10bda92cfb3c", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_b56eaf39-66fa-4dd9-995c-946fdad280ce" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_27c0a723-98e7-4bb1-9b27-684992d38566" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#ff0000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#ff0000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "715bd498-2f4c-5976-a4ab-9871bde47282" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json index 15cf4d60..ab6c9389 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "558dbdee-ce62-48d1-ba64-215a00c640aa", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "020be3e6-b83e-4750-98ce-798777208495", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_53c4cce8-1f08-48a6-82dc-a9e68679339b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_f73adae1-8ff9-4bbd-8cdf-068501b1ca72", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "558dbdee-ce62-48d1-ba64-215a00c640aa", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "020be3e6-b83e-4750-98ce-798777208495", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_53c4cce8-1f08-48a6-82dc-a9e68679339b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_f73adae1-8ff9-4bbd-8cdf-068501b1ca72" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 0.5 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 0.5 } } } - ], - "usermeta": { - "axis_uuid": "19a9c0b0-0710-53b7-8569-1d2504250f6b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json index c3eadff5..51a56bd7 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "4dcc4a99-9578-427a-85fb-ed5a159244fa", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "ce8f2c18-e2f8-4765-b08a-afdd56111184", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_2298a19e-9ab9-48c5-817c-bfc92f9fcb57", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_16884a1c-57b7-48e3-85d6-33a7401980c8", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "4dcc4a99-9578-427a-85fb-ed5a159244fa", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "ce8f2c18-e2f8-4765-b08a-afdd56111184", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_2298a19e-9ab9-48c5-817c-bfc92f9fcb57" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_16884a1c-57b7-48e3-85d6-33a7401980c8" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 5.0 - }, - "strokeOpacity": { - "value": 1.0 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 5.0 + }, + "strokeOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "c6b82c47-ae51-5658-a684-7e9ad87fa771" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json index 6a0fbaaa..5e18fd84 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json @@ -1,262 +1,257 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "a0f2c390-2263-46c1-8213-f63086a86096", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_7feab3c1-77d8-44ee-847b-6bc135f83afd", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_851d287a-ac9c-477b-b9a8-c44ed440aac1", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "a0f2c390-2263-46c1-8213-f63086a86096", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_polygons_e61c0755-9257-4163-bc6a-8d97681d97d8", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_448beade-eb12-4971-8f5f-8246fa2b9eff", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "a0f2c390-2263-46c1-8213-f63086a86096", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + }, + { + "name": "blobs_multipolygons_8711ac98-5bfc-426e-bcb2-00595e1696cd", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_multipolygons_069cd020-b7c3-4672-98f5-55b5e32ad178", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "a0f2c390-2263-46c1-8213-f63086a86096", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" }, - "source": "23ddd2fd-6fce-4bc6-a61e-0c288e43e08b", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multipolygons" + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [98.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 137.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [100, 200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [150, 200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_7feab3c1-77d8-44ee-847b-6bc135f83afd" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [98.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 137.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [100, 200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [150, 200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_851d287a-ac9c-477b-b9a8-c44ed440aac1" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 0.7 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 0.7 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_e61c0755-9257-4163-bc6a-8d97681d97d8" }, - { - "type": "path", - "from": { - "data": "blobs_polygons_448beade-eb12-4971-8f5f-8246fa2b9eff" - }, - "zindex": 1, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 0.7 - } + "zindex": 1, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 0.7 } } + } + }, + { + "type": "path", + "from": { + "data": "blobs_multipolygons_8711ac98-5bfc-426e-bcb2-00595e1696cd" }, - { - "type": "path", - "from": { - "data": "blobs_multipolygons_069cd020-b7c3-4672-98f5-55b5e32ad178" - }, - "zindex": 2, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 0.7 - } + "zindex": 2, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 0.7 } } } - ], - "usermeta": { - "axis_uuid": "a8190cc1-bd58-56c4-8340-e2dc2434bb68" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json index 73f3b751..9db8f931 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "ef9e544a-b89f-418c-9475-ac97d6469a50", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "5b9a605c-1cf9-4b8a-9e39-434df47e14aa", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_27440a3a-9749-477f-baa1-a59bf25a587b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_009a0417-9db2-4c42-9631-92df181dbf54", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "ef9e544a-b89f-418c-9475-ac97d6469a50", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "5b9a605c-1cf9-4b8a-9e39-434df47e14aa", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_27440a3a-9749-477f-baa1-a59bf25a587b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_009a0417-9db2-4c42-9631-92df181dbf54" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "f9e173df-a025-5278-8c63-592350da3bce" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json index 59326843..491e4abe 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3aa05c3b-b9ec-4156-a4af-3ab403b0b83f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "f26835e9-8aab-4ab6-8b67-f052fcaddd48", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_451c3ae1-bbde-492e-a48e-c8919e1c4972", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_b25a638c-60d0-43d1-a844-2af3cbfeaa5d", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "3aa05c3b-b9ec-4156-a4af-3ab403b0b83f", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "f26835e9-8aab-4ab6-8b67-f052fcaddd48", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_451c3ae1-bbde-492e-a48e-c8919e1c4972" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_b25a638c-60d0-43d1-a844-2af3cbfeaa5d" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#0000ff" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#0000ff" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "f89408da-a17b-58df-b713-c8d3cad3b2a0" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json index d33b93d1..d064d3fb 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "35f177fe-75cc-4366-bbbc-2abedce1779e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "63b2022f-6b96-4c68-894d-cf2719905a50", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_9f1d9d30-4916-481e-917b-a4177a9034bf", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_b1b1ea36-31a7-4470-aa93-f60e346ac579", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "35f177fe-75cc-4366-bbbc-2abedce1779e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "63b2022f-6b96-4c68-894d-cf2719905a50", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_9f1d9d30-4916-481e-917b-a4177a9034bf" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_b1b1ea36-31a7-4470-aa93-f60e346ac579" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#00ff00" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#00ff00" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1 } } } - ], - "usermeta": { - "axis_uuid": "b03f9b9f-bfb5-5dd3-abc7-975ea5ed4c70" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json b/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json index 7c959867..61dc9c37 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fd692690-3639-428d-8130-1eb1b0cc04ab", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "78e57bd6-7699-4552-8d1e-d63962996de5", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_circles_db4cbdfa-99f2-4654-a459-2ad45e263d9b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_circles_c2e87394-bcd6-4828-8ee9-c393f797f4b8", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "fd692690-3639-428d-8130-1eb1b0cc04ab", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" }, - "source": "78e57bd6-7699-4552-8d1e-d63962996de5", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_circles" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-580.5624257141354, -45.275966500273434], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-204.149037642031, -623.3858457994218], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-400, -200], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-600, -500, -400, -300], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_circles_db4cbdfa-99f2-4654-a459-2ad45e263d9b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [-580.5624257141354, -45.275966500273434], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [-204.149037642031, -623.3858457994218], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-400, -200], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-600, -500, -400, -300], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_circles_c2e87394-bcd6-4828-8ee9-c393f797f4b8" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1.0 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "db38b25c-02f3-5e15-8cc2-f17fdb5bb1a4" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json b/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json index 3e9b562d..a8ccdec2 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3467fe2e-211e-4816-ba8a-18f00210423a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "62ed2e0e-7954-4e32-ba5e-6efd036dbbde", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_multipolygons_5c7fb897-d409-4147-a5e5-db85d58f633b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_multipolygons_79ac14b8-ec94-4bf9-9ff5-001caa0d9297", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "3467fe2e-211e-4816-ba8a-18f00210423a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" }, - "source": "62ed2e0e-7954-4e32-ba5e-6efd036dbbde", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_multipolygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-503.3827552451457, -373.83299073217603], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-363.0369921097614, -599.7025350355941], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-500, -450, -400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-550, -500, -450, -400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_multipolygons_5c7fb897-d409-4147-a5e5-db85d58f633b" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [-503.3827552451457, -373.83299073217603], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [-363.0369921097614, -599.7025350355941], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-500, -450, -400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-550, -500, -450, -400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_multipolygons_79ac14b8-ec94-4bf9-9ff5-001caa0d9297" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1.0 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "8f19df5c-f1ca-58d7-ae3f-1ff267f6ad47" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json b/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json index 3c156f2b..59fa8255 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json @@ -1,169 +1,164 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "0f3d8b14-402e-4fd6-ba98-8d648889e5e8", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "7a577ba6-3f68-4bfc-9414-b79c0c3d658e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_56619734-61b3-406c-ba75-f86421c3a884", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_03610787-9e2f-44b3-9f69-d46560a66f87", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "0f3d8b14-402e-4fd6-ba98-8d648889e5e8", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "7a577ba6-3f68-4bfc-9414-b79c0c3d658e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["count"], + "as": ["count"] + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-592.0096679034098, -117.03467315555264], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [-310.74557710724594, -668.0575932183025], + "range": "height" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-500, -400, -300, -200], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [-600, -500, -400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_56619734-61b3-406c-ba75-f86421c3a884" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" }, - { - "type": "filter_cs", - "expr": "global" + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "aggregate", - "field": ["*"], - "ops": ["count"], - "as": ["count"] - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [-592.0096679034098, -117.03467315555264], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [-310.74557710724594, -668.0575932183025], - "range": "height" - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-500, -400, -300, -200], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [-600, -500, -400], - "zindex": 1.5 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_03610787-9e2f-44b3-9f69-d46560a66f87" - }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "value": "#d3d3d3" - }, - "fillOpacity": { - "value": 1.0 - }, - "stroke": { - "value": "#000000" - }, - "strokeWidth": { - "value": 1.5 - }, - "strokeOpacity": { - "value": 1.0 - } + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#d3d3d3" + }, + "fillOpacity": { + "value": 1.0 + }, + "stroke": { + "value": "#000000" + }, + "strokeWidth": { + "value": 1.5 + }, + "strokeOpacity": { + "value": 1.0 } } } - ], - "usermeta": { - "axis_uuid": "b9aaeb23-f3da-5259-acd0-e91080c8dd49" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json index 878b745c..6c44c735 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json +++ b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.json @@ -1,223 +1,217 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3aa41169-ccaa-465a-af73-187d381db9e1", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "9fd3ee24-2c76-482f-bfd6-c4cd8fda8408", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_4011cbca-91cb-41e3-9eff-8198d16150f4", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_db440e45-8335-4b68-bef0-2e9682f7ebc2", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "3aa41169-ccaa-465a-af73-187d381db9e1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "9fd3ee24-2c76-482f-bfd6-c4cd8fda8408", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["value"], - "ops": ["max"], - "as": ["value"] - }, - { - "type": "formula", - "expr": "clamp((datum.value - 2.5) / (3.5 - 2.5), 0, 1)", - "as": "b9fc6adf-3907-4f4b-94da-62e705a320bb" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_6d131c1f-d4ab-4ada-a0a9-5f1729f4a503", - "type": "linear", - "domain": { - "data": "blobs_polygons_db440e45-8335-4b68-bef0-2e9682f7ebc2", - "field": "b9fc6adf-3907-4f4b-94da-62e705a320bb" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "clamp((datum.value - 2.5) / (3.5 - 2.5), 0, 1)", + "as": "5bea0f25-73ea-4327-bca0-b1b025432b78" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_57b6ef79-05bd-43ce-b514-9c5786e87241", + "type": "linear", + "domain": { + "data": "blobs_polygons_4011cbca-91cb-41e3-9eff-8198d16150f4", + "field": "5bea0f25-73ea-4327-bca0-b1b025432b78" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_6d131c1f-d4ab-4ada-a0a9-5f1729f4a503", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 2.4000000000000004, 2.6000000000000005, 2.8000000000000003, - 3.0000000000000004, 3.2, 3.4000000000000004, - 3.6000000000000005 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_db440e45-8335-4b68-bef0-2e9682f7ebc2" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_57b6ef79-05bd-43ce-b514-9c5786e87241", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 2.4000000000000004, 2.6000000000000005, 2.8000000000000003, + 3.0000000000000004, 3.2, 3.4000000000000004, 3.6000000000000005 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_4011cbca-91cb-41e3-9eff-8198d16150f4" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_57b6ef79-05bd-43ce-b514-9c5786e87241", + "value": "5bea0f25-73ea-4327-bca0-b1b025432b78" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 2.5", + "value": "#000000" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_6d131c1f-d4ab-4ada-a0a9-5f1729f4a503", - "value": "b9fc6adf-3907-4f4b-94da-62e705a320bb" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 3.5", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 2.5", - "value": "#000000" - }, - { - "test": "datum.value) > 3.5", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "8548bc92-78ab-58e5-b323-d8fb0834790b" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json index 6cf3576b..f116f740 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json +++ b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.json @@ -1,223 +1,217 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cf409518-211c-45ad-b851-1a2cd7271512", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "7bb83c5c-2428-42b4-8c7b-e020bbd1e198", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_e5579b05-056e-4acb-a502-82917b74e0a9", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_f717dfb3-4678-47e1-b0b3-2474d426f6de", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "cf409518-211c-45ad-b851-1a2cd7271512", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "7bb83c5c-2428-42b4-8c7b-e020bbd1e198", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["value"], - "ops": ["max"], - "as": ["value"] - }, - { - "type": "formula", - "expr": "(datum.value - 2.5) / (3.5 - 2.5)", - "as": "3f56c6b7-07da-4508-b101-22dd9c2e6221" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_8ee1b08a-0d11-425d-9cfd-30ab8d5ca193", - "type": "linear", - "domain": { - "data": "blobs_polygons_f717dfb3-4678-47e1-b0b3-2474d426f6de", - "field": "3f56c6b7-07da-4508-b101-22dd9c2e6221" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["max"], + "as": ["value"] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 2.5) / (3.5 - 2.5)", + "as": "fdc6722f-a0ef-4ca5-9426-66aacd70cdad" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_c1441043-e207-4826-9627-d9de6bae35ac", + "type": "linear", + "domain": { + "data": "blobs_polygons_e5579b05-056e-4acb-a502-82917b74e0a9", + "field": "fdc6722f-a0ef-4ca5-9426-66aacd70cdad" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_8ee1b08a-0d11-425d-9cfd-30ab8d5ca193", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [ - 2.4000000000000004, 2.6000000000000005, 2.8000000000000003, - 3.0000000000000004, 3.2, 3.4000000000000004, - 3.6000000000000005 - ], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 28.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_f717dfb3-4678-47e1-b0b3-2474d426f6de" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_c1441043-e207-4826-9627-d9de6bae35ac", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [ + 2.4000000000000004, 2.6000000000000005, 2.8000000000000003, + 3.0000000000000004, 3.2, 3.4000000000000004, 3.6000000000000005 + ], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 28.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_e5579b05-056e-4acb-a502-82917b74e0a9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_c1441043-e207-4826-9627-d9de6bae35ac", + "value": "fdc6722f-a0ef-4ca5-9426-66aacd70cdad" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 2.5", + "value": "#000000" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_8ee1b08a-0d11-425d-9cfd-30ab8d5ca193", - "value": "3f56c6b7-07da-4508-b101-22dd9c2e6221" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 3.5", + "value": "#808080" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 2.5", - "value": "#000000" - }, - { - "test": "datum.value) > 3.5", - "value": "#808080" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "13381ec3-b11e-5ba6-8704-72248334c11f" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json b/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json index 43575dbe..b388cd18 100644 --- a/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json +++ b/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.json @@ -1,219 +1,214 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5cec467f-84c7-4858-9ae5-f88d2173c759", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "e9290aa5-431f-4b97-b09e-3e5d120db95a", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" - } + { + "name": "blobs_polygons_1e5ce91b-ec0b-45ec-b53c-66798dbfad3d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "blobs_polygons_6c6e6ce6-3192-4385-b75d-04f1fdec87d3", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + "source": "5cec467f-84c7-4858-9ae5-f88d2173c759", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "e9290aa5-431f-4b97-b09e-3e5d120db95a", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" - }, - { - "type": "filter_cs", - "expr": "global" - }, - { - "type": "aggregate", - "field": ["value"], - "ops": ["sum"], - "as": ["value"] - }, - { - "type": "formula", - "expr": "(datum.value - 1.0) / (20.0 - 1.0)", - "as": "ba4786e0-c7d4-46bc-8988-5e0b48426372" - } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_d0dd5d47-1faf-44e8-bbe6-6cf1c417b5bb", - "type": "linear", - "domain": { - "data": "blobs_polygons_6c6e6ce6-3192-4385-b75d-04f1fdec87d3", - "field": "ba4786e0-c7d4-46bc-8988-5e0b48426372" + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["value"], + "ops": ["sum"], + "as": ["value"] }, - "range": { - "scheme": "viridis", - "count": 256 + { + "type": "formula", + "expr": "(datum.value - 1.0) / (20.0 - 1.0)", + "as": "1b754fd8-39a6-4d10-bc8d-0c301c654a7e" } - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_a99096dd-91ff-4f43-959b-da74d7950e8e", + "type": "linear", + "domain": { + "data": "blobs_polygons_1e5ce91b-ec0b-45ec-b53c-66798dbfad3d", + "field": "1b754fd8-39a6-4d10-bc8d-0c301c654a7e" }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "gradient", - "direction": "vertical", - "orient": "none", - "fill": "color_d0dd5d47-1faf-44e8-bbe6-6cf1c417b5bb", - "fillColor": "#ffffff", - "gradientLength": 243.2, - "gradientOpacity": 1.0, - "gradientThickness": 8.106666666666662, - "gradientStrokeColor": "#000000", - "gradientStrokeWidth": 0.8888888888888888, - "values": [0.0, 5.0, 10.0, 15.0, 20.0], - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 287.23199999999997, - "legendY": 22.80000000000001, - "zindex": 0 + "range": { + "scheme": "viridis", + "count": 256 } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_6c6e6ce6-3192-4385-b75d-04f1fdec87d3" + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_a99096dd-91ff-4f43-959b-da74d7950e8e", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": 1.0, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.0, 5.0, 10.0, 15.0, 20.0], + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 287.23199999999997, + "legendY": 22.80000000000001, + "zindex": 0 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_1e5ce91b-ec0b-45ec-b53c-66798dbfad3d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_a99096dd-91ff-4f43-959b-da74d7950e8e", + "value": "1b754fd8-39a6-4d10-bc8d-0c301c654a7e" + }, + "fillOpacity": { + "value": 1.0 + } }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" }, - "y": { - "scale": "Y_scale", - "field": "y" + { + "test": "datum.value) < 1.0", + "value": "#440154" }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_d0dd5d47-1faf-44e8-bbe6-6cf1c417b5bb", - "value": "ba4786e0-c7d4-46bc-8988-5e0b48426372" - }, - "fillOpacity": { - "value": 1.0 + { + "test": "datum.value) > 20.0", + "value": "#fde725" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.value)", - "value": "#d3d3d3" - }, - { - "test": "datum.value) < 1.0", - "value": "#440154" - }, - { - "test": "datum.value) > 20.0", - "value": "#fde725" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "aea21008-1acf-574c-a1f5-bd34acf3262d" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json b/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json index 54547125..ba3e306d 100644 --- a/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json +++ b/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json @@ -1,217 +1,212 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "64c9a803-1fc3-4933-a4b1-9f0fae9ecd2e", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "7f09f346-c7a4-4dc1-8216-bf8d53cf1f1e", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "a84061fc-ea69-48b8-a34a-cd511e367148", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "64c9a803-1fc3-4933-a4b1-9f0fae9ecd2e", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_polygons_8d5dcab2-374c-499f-93fb-bf4127848594", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "b9bb444b-5de9-4d9c-b28c-ecdf50bb154c", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "64c9a803-1fc3-4933-a4b1-9f0fae9ecd2e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "7f09f346-c7a4-4dc1-8216-bf8d53cf1f1e", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_polygons_28c6b35e-06a8-4b07-b4cb-36fc6e494ff1", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "7f09f346-c7a4-4dc1-8216-bf8d53cf1f1e", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "lookup", + "from": "a84061fc-ea69-48b8-a34a-cd511e367148", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_508038f7-a404-49ee-898c-49cd402b3fa4", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_508038f7-a404-49ee-898c-49cd402b3fa4", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_8d5dcab2-374c-499f-93fb-bf4127848594" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "filter_cs", - "expr": "global" + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_508038f7-a404-49ee-898c-49cd402b3fa4", + "field": "category" }, - { - "type": "lookup", - "from": "b9bb444b-5de9-4d9c-b28c-ecdf50bb154c", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["category"], - "as": ["category"], - "default": null + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_4bdb204c-f15d-4b9f-b669-0e939e18652b", - "type": "ordinal", - "domain": ["a", "b", "c"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_4bdb204c-f15d-4b9f-b669-0e939e18652b", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.8405555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_28c6b35e-06a8-4b07-b4cb-36fc6e494ff1" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_4bdb204c-f15d-4b9f-b669-0e939e18652b", - "field": "category" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.category)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "b31d077e-eecd-53fb-ba3c-f779f19bc620" } - } -] + ] +} diff --git a/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json b/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json index b8a1c598..e9054224 100644 --- a/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json +++ b/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json @@ -1,217 +1,212 @@ -[ - { - "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", - "height": 320.0, - "width": 320.0, - "padding": { - "left": 57.599999999999994, - "top": 28.79999999999999, - "right": 12.800000000000011, - "bottom": 48.0 - }, - "title": { - "text": "global", - "orient": "top", - "anchor": "middle", - "baseline": "baseline", - "color": "black", - "font": "Arial", - "fontSize": 15.555555555555555, - "fontStyle": "normal", - "fontWeight": "normal" +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 48.0 + }, + "title": { + "text": "global", + "orient": "top", + "anchor": "middle", + "baseline": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "5ecfba63-7cd2-4647-b734-ebf5b41606bf", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } }, - "data": [ - { - "name": "49d67eee-d1c9-4735-9f13-84a3f285f081", - "url": "sdata.zarr", - "format": { - "type": "SpatialData", - "version": "0.3.1.dev31+g4021946.d20250416" + { + "name": "362588b6-3f40-457e-96cb-3311265e085a", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "5ecfba63-7cd2-4647-b734-ebf5b41606bf", + "transform": [ + { + "type": "filter_element", + "expr": "table" } + ] + }, + { + "name": "blobs_polygons_0add0ecc-85ba-4f20-8dc4-79b41610ec1a", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" }, - { - "name": "1e2aeef0-0d99-4763-ab7e-f7e915538461", - "format": { - "type": "spatialdata_table", - "version": 0.1 + "source": "5ecfba63-7cd2-4647-b734-ebf5b41606bf", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" }, - "source": "49d67eee-d1c9-4735-9f13-84a3f285f081", - "transform": [ - { - "type": "filter_element", - "expr": "table" - } - ] - }, - { - "name": "blobs_polygons_5a762587-da69-4c16-a024-b403ef7be586", - "format": { - "type": "ShapesFormatV02", - "version": "0.2" + { + "type": "filter_cs", + "expr": "global" }, - "source": "49d67eee-d1c9-4735-9f13-84a3f285f081", - "transform": [ - { - "type": "filter_element", - "expr": "blobs_polygons" + { + "type": "lookup", + "from": "362588b6-3f40-457e-96cb-3311265e085a", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [461.8520923943867, 188.62348968860152], + "range": "height" + }, + { + "name": "color_0a74c2ea-cc57-4b34-b7eb-ff6abe4fcad1", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#1f77b4", "#ff7f0e", "#279e68"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 300, 400], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [200, 250, 300, 350, 400, 450], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_0a74c2ea-cc57-4b34-b7eb-ff6abe4fcad1", + "orient": "none", + "columns": 1, + "columnPadding": 2.2222222222222223, + "rowPadding": 0.5555555555555556, + "padding": 0.4444444444444444, + "fillColor": "#ffffffcc", + "strokeColor": "#cccccccc", + "strokeWidth": 1.1111111111111112, + "labelOffset": 0.4444444444444444, + "labelAlign": "left", + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 14.311111111111112, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "legendX": 267.8405555555555, + "legendY": 35.95555555555558 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "blobs_polygons_0add0ecc-85ba-4f20-8dc4-79b41610ec1a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" }, - { - "type": "filter_cs", - "expr": "global" + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_0a74c2ea-cc57-4b34-b7eb-ff6abe4fcad1", + "field": "category" }, - { - "type": "lookup", - "from": "1e2aeef0-0d99-4763-ab7e-f7e915538461", - "key": "instance_id", - "fields": ["instance_ids"], - "values": ["category"], - "as": ["category"], - "default": null + "fillOpacity": { + "value": 1.0 } - ] - } - ], - "scales": [ - { - "name": "X_scale", - "type": "linear", - "domain": [149.92618678876784, 446.7026437060826], - "range": "width" - }, - { - "name": "Y_scale", - "type": "linear", - "domain": [461.8520923943867, 188.62348968860152], - "range": "height" - }, - { - "name": "color_21ad53a3-eb0e-4679-a24f-935d8fde7fe7", - "type": "ordinal", - "domain": ["a", "b", "c"], - "range": ["#1f77b4", "#ff7f0e", "#279e68"] - } - ], - "axes": [ - { - "scale": "X_scale", - "orient": "bottom", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 300, 400], - "zindex": 1.5 - }, - { - "scale": "Y_scale", - "orient": "left", - "domain": true, - "domainOpacity": 1, - "domainColor": "#000000", - "domainWidth": 0.8888888888888888, - "grid": true, - "gridOpacity": 1.0, - "gridCap": "butt", - "gridColor": "#cccccc", - "gridWidth": 1.1111111111111112, - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 15.555555555555555, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "ticks": true, - "tickOpacity": 1, - "tickColor": "#000000", - "tickCap": "butt", - "tickWidth": 1.6666666666666667, - "tickSize": 3.888888888888889, - "values": [200, 250, 300, 350, 400, 450], - "zindex": 1.5 - } - ], - "legend": [ - { - "type": "discrete", - "direction": "vertical", - "fill": "color_21ad53a3-eb0e-4679-a24f-935d8fde7fe7", - "orient": "none", - "columns": 1, - "columnPadding": 2.2222222222222223, - "rowPadding": 0.5555555555555556, - "padding": 0.4444444444444444, - "fillColor": "#ffffffcc", - "strokeColor": "#cccccccc", - "strokeWidth": 1.1111111111111112, - "labelOffset": 0.4444444444444444, - "labelAlign": "left", - "labelColor": "#000000", - "labelOpacity": 1, - "labelFont": "Arial", - "labelFontSize": 14.311111111111112, - "labelFontStyle": "normal", - "labelFontWeight": "normal", - "legendX": 267.8405555555555, - "legendY": 35.95555555555558 - } - ], - "marks": [ - { - "type": "path", - "from": { - "data": "blobs_polygons_5a762587-da69-4c16-a024-b403ef7be586" }, - "zindex": 0, - "encode": { - "enter": { - "x": { - "scale": "X_scale", - "field": "x" - }, - "y": { - "scale": "Y_scale", - "field": "y" - }, - "scaleX": 1.0, - "scaleY": 1.0, - "fill": { - "scale": "color_21ad53a3-eb0e-4679-a24f-935d8fde7fe7", - "field": "category" - }, - "fillOpacity": { - "value": 1.0 + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" } - }, - "update": { - "fill": [ - { - "test": "!isValid(datum.category)", - "value": "#d3d3d3" - } - ] - } + ] } } - ], - "usermeta": { - "axis_uuid": "e44c0e72-0819-570d-bfe6-38c3cd4dd76a" } - } -] + ] +} From fe9e8ce5f3247fc7ea32c5b3c1373b919b5a298f Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 23 May 2025 19:40:29 +0200 Subject: [PATCH 55/56] revert list index --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index d8024b4d..43990fc3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -442,7 +442,7 @@ def test_viewconfig_output(actual_json_path, expected_json_path): actual_json = json.load(f) with expected_json_path.open() as f: expected_json = json.load(f) - assert compare_json_ignore_uuids(actual_json, expected_json[0]) + assert compare_json_ignore_uuids(actual_json, expected_json) class PlotTesterMeta(ABCMeta): From 86917ba785132adf19b4a3fd012ec2e62608e4ec Mon Sep 17 00:00:00 2001 From: Wouter-Michiel Vierdag Date: Fri, 12 Sep 2025 16:03:07 +0200 Subject: [PATCH 56/56] attempt at caption --- src/spatialdata_plot/pl/basic.py | 58 ++++++++++++++++++++++++ src/spatialdata_plot/pl/render_params.py | 10 ++++ src/spatialdata_plot/pl/utils.py | 18 +++++++- 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 597546bd..f914750f 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -707,6 +707,9 @@ def render_labels( def show( self, coordinate_systems: list[str] | str | None = None, + caption: list[str] | None = None, + caption_fontsize: int | float | _FontSize | None = None, + caption_fontweight: int | float | _FontSize | None = None, legend_fontsize: int | float | _FontSize | None = None, legend_fontweight: int | _FontWeight = "bold", legend_loc: str | None = "right margin", @@ -738,6 +741,7 @@ def show( Name(s) of the coordinate system(s) to be plotted. If None, all coordinate systems are plotted. If a coordinate system doesn't contain any relevant elements (as specified in the render_* calls), it is automatically not plotted. + legend_fontsize : Font size of the legend text. legend_fontweight : @@ -922,6 +926,8 @@ def show( hspace=hspace, ncols=ncols, frameon=frameon, + caption=caption, + font_size=12, ) legend_params = LegendParams( legend_fontsize=legend_fontsize, @@ -1080,6 +1086,58 @@ def show( ax.set_xlim(x_min, x_max) ax.set_ylim(y_max, y_min) # (0, 0) is top-left + if caption is not None: + # If one caption for all + if len(caption) == 1: + fig = fig_params.fig + + fig.canvas.draw() + # Get bounding box of all tick labels in display coordinates + renderer = fig.canvas.get_renderer() + all_axes = fig.get_axes() + bboxes = [] + + for ax in all_axes: + for label in ax.get_xticklabels(): + if label.get_visible(): + bbox = label.get_window_extent(renderer=renderer) + bboxes.append(bbox) + + if not bboxes: + # Fallback: just use subplot bottom position + min_y_display = min(ax.get_position().y0 for ax in all_axes) + else: + # Convert from display to figure coordinates + min_y_display = min(b.y0 for b in bboxes) + min_y_fig = min_y_display / fig.bbox.height + + # Move 5% of the figure height below the tick labels + offset = 0.01 # fraction of figure height + caption_y = min_y_fig - offset + + fig.text(0.5, caption_y, caption[0], ha="center", va="top", fontsize=legend_fontsize or 12) + + # If captions per subplot + elif len(caption) == len(coordinate_systems): + for i, cap in enumerate(caption): + ax_to_use = fig_params.ax if fig_params.axs is None else fig_params.axs[i] + # Position text slightly below x-axis + xlim = ax_to_use.get_xlim() + ymin, ymax = ax.get_ylim() + offset = 0.4 * (ymax - ymin) + y_text = ymin - offset + ax_to_use.text( + 0.5, + y_text, # 5% below x-axis min + cap, + ha="center", + va="top", + fontsize=legend_fontsize or 12, + clip_on=False, + ) + else: + raise ValueError("Length of 'caption' must be 1 or equal to the number of subplots.") + existing_viewconfig = None if store_viewconfig_name: root = sdata diff --git a/src/spatialdata_plot/pl/render_params.py b/src/spatialdata_plot/pl/render_params.py index 981f77e4..0ef6b402 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -62,6 +62,16 @@ class LegendParams: colorbar: bool = True +@dataclass +class CaptionParams: + """Caption params.""" + + caption_fontsize: int | float | _FontSize | None = None + caption_fontweight: int | _FontWeight = "normal" + horizontal_alignment: str = "center" + vertical_alignment: str = "top" + + @dataclass class ScalebarParams: """Scalebar params.""" diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index 527e8d2f..41684e26 100644 --- a/src/spatialdata_plot/pl/utils.py +++ b/src/spatialdata_plot/pl/utils.py @@ -160,6 +160,14 @@ def _is_color_like(color: Any) -> bool: return bool(colors.is_color_like(color)) +def _estimate_caption_lines(text_ls) -> int: + """Estimate number of lines based on explicit line breaks.""" + counts = [] + for caption in text_ls: + counts.append(caption.count("\\n") + 1) + return max(counts) + + def _prepare_params_plot( # this param is inferred when `pl.show`` is called num_panels: int, @@ -175,11 +183,19 @@ def _prepare_params_plot( # this args will be inferred from coordinate system scalebar_dx: float | Sequence[float] | None = None, scalebar_units: str | Sequence[str] | None = None, + caption=None, + font_size=None, ) -> tuple[FigParams, ScalebarParams]: # handle axes and size wspace = 0.75 / rcParams["figure.figsize"][0] + 0.02 if wspace is None else wspace figsize = rcParams["figure.figsize"] if figsize is None else figsize dpi = rcParams["figure.dpi"] if dpi is None else dpi + + if caption: + num_lines = _estimate_caption_lines(caption) + extra_height = num_lines * font_size / 72 * 1.2 # 1.2 is extra factor for line spacing + figsize[1] += extra_height + 2 + if num_panels > 1 and ax is None: fig, grid = _panel_grid( num_panels=num_panels, hspace=hspace, wspace=wspace, ncols=ncols, dpi=dpi, figsize=figsize @@ -204,7 +220,7 @@ def _prepare_params_plot( # needed for rasterization if user provides Axes object fig = ax.get_figure() fig.set_dpi(dpi) - + fig.subplots_adjust(bottom=0.2) # set scalebar if scalebar_dx is not None: scalebar_dx, scalebar_units = _get_scalebar(scalebar_dx, scalebar_units, num_panels)