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 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/axis.py b/src/spatialdata_plot/_viewconfig/axis.py new file mode 100644 index 00000000..f90a3941 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/axis.py @@ -0,0 +1,80 @@ +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 + + +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"] = 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 + axis_config["labelFontStyle"] = axis_props["majorticklabels"][0].get_fontstyle() + axis_config["labelFontWeight"] = axis_props["majorticklabels"][0].get_fontweight() + 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 + 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. + + vmin, vmax = np.sort(axis_props["view_interval"]) + tick_str_values = [ + ticklabel.get_text() + for ticklabel in axis_props["ticklabels"] + if vmin <= float(ticklabel.get_text().replace("−", "-")) <= vmax + ] + axis_config["values"] = parse_numbers_with_exact_format(tick_str_values) + + 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/config.py b/src/spatialdata_plot/_viewconfig/config.py new file mode 100644 index 00000000..129106d3 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/config.py @@ -0,0 +1,387 @@ +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 +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, VegaTextBaseline, 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, 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 + 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. + 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] + + """ + 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, + "orient": "top", # there is not really a nice conversion here of matplotlib to vega + "anchor": VegaAlignment.from_matplotlib(title_obj.get_horizontalalignment()), + "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, + "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(): + 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(): + 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_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, + 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 + ---------- + 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. + 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 + 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 + + # 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, + "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(subplot_axes_objects) > 1: + ax_index = subplot_axes_objects.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) + 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/data.py b/src/spatialdata_plot/_viewconfig/data.py new file mode 100644 index 00000000..e0e645cd --- /dev/null +++ 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"] + else: + 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 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: + norm_expr = f"clamp({norm_expr}, 0, 1)" + + data_object["transform"].append({"type": "formula", "expr": norm_expr, "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", "expr": table_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": (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(): + 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..2bcc3a5b --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/legend.py @@ -0,0 +1,200 @@ +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 matplotlib.transforms import Bbox + +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": 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"], + "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 _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]]: + """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() + cbar_bbox = cbar.ax.get_position() + if cbar.orientation == "vertical": + gradient_length = cbar_bbox.height * fig.bbox.height + labels = axis_props["yticklabels"] + else: + gradient_length = cbar_bbox.width * fig.bbox.width + 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["edgecolor"]) if spine_outline["edgecolor"][-1] > 0 else None + legend_title_object = _create_legend_title_config(cbar.ax.title, fig.dpi) + + 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, + "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": 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], + "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 |= legend_title_object + legend_array.append(legend_object) + return legend_array diff --git a/src/spatialdata_plot/_viewconfig/marks.py b/src/spatialdata_plot/_viewconfig/marks.py new file mode 100644 index 00000000..3bf16b31 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/marks.py @@ -0,0 +1,338 @@ +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 _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": params.cmap_params.na_color.get_hex()} + if color_scale_array is not None and params.color: + return {"value": params.color.get_hex()} + + 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]]: + """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. + """ + update = [ + { + "test": f"!isValid(datum.{params.col_for_color})", + "value": params.cmap_params.na_color.get_hex(), + } + ] + + 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)] + ) + + 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_id}, + "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]: + """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 = _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"] + 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.outer_outline_linewidth and params.outline_alpha[0] != 0: + outline_par = params.outline_params + stroke_color = {"value": outline_par.outer_outline_color.get_hex()} + + mark["encode"]["enter"].update( # type: ignore[index] + { + "stroke": stroke_color, + "strokeWidth": {"value": outline_par.outer_outline_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]: + """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): + 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]: + """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 + + if params.colortype == "continuous": + 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": [ + {"test": "isValid(datum.value)", "scale": color_scale_array[0]["name"], "field": field}, + {"value": params.cmap_params.na_color.get_hex_with_alpha()}, + ] + } + 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.get_hex_with_alpha()}, + ] + } + 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/_viewconfig/misc.py b/src/spatialdata_plot/_viewconfig/misc.py new file mode 100644 index 00000000..f0c1bc19 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/misc.py @@ -0,0 +1,68 @@ +import re +from collections import Counter +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 + + +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: + 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) + + +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: + s = s.replace("−", "-") + if "." in s: + float_ls.append(float(s)) + else: + float_ls.append(int(s)) + return float_ls diff --git a/src/spatialdata_plot/_viewconfig/scales.py b/src/spatialdata_plot/_viewconfig/scales.py new file mode 100644 index 00000000..2a9f3e94 --- /dev/null +++ b/src/spatialdata_plot/_viewconfig/scales.py @@ -0,0 +1,342 @@ +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. + + 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", + } + + +def _generate_color_scale_object( + 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. + + 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 {} + 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 {} + + +def create_colorscale_array_points_shapes_labels( + coloring: dict[str, str] | Literal["continuous"] | str, + 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"], + ) + ) + else: + return [] + + 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. + """ + 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 + + for index, cmap in enumerate(cmaps): + + color_range = _process_colormap(cmap) + 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" + + color_scale_array.append( + _generate_color_scale_object( + f"color_{uuid4()}", "linear", {"data": data_id, "field": field_val}, color_range + ) + ) + + return color_scale_array + + +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/src/spatialdata_plot/config.py b/src/spatialdata_plot/config.py new file mode 100644 index 00000000..f643554c --- /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_NAME = None diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 025eb9ed..72ae3602 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -1,5 +1,6 @@ from __future__ import annotations +import json import sys import warnings from collections import OrderedDict @@ -22,7 +23,9 @@ 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._viewconfig.config import create_viewconfig from spatialdata_plot.pl.render import ( _render_images, _render_labels, @@ -149,6 +152,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 @@ -720,6 +724,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", @@ -739,6 +746,8 @@ def show( ax: list[Axes] | Axes | None = None, return_ax: bool = False, save: str | Path | None = None, + store_viewconfig_name: str | None = None, + store_viewconfig_to_disk: Path | None = None, ) -> sd.SpatialData: """ Plot the images in the SpatialData object. @@ -749,6 +758,28 @@ 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. @@ -756,17 +787,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_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. Returns ------- @@ -804,6 +843,9 @@ def show( save, ) + if store_viewconfig_name is None: + store_viewconfig_name = spatialdata_plot.config.STORE_VIEWCONFIG_NAME + sdata = self._copy() # Evaluate execution tree for plotting @@ -846,7 +888,18 @@ 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_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_name: + store_viewconfig_cs = coordinate_systems coordinate_systems = [coordinate_systems] for cs in coordinate_systems: @@ -890,6 +943,8 @@ def show( hspace=hspace, ncols=ncols, frameon=frameon, + caption=caption, + font_size=12, ) legend_params = LegendParams( legend_fontsize=legend_fontsize, @@ -920,7 +975,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: @@ -943,6 +1000,7 @@ def show( scalebar_params=scalebar_params, legend_params=legend_params, rasterize=rasterize, + render_count=prefix, ) elif cmd == "render_shapes" and has_shapes: @@ -959,6 +1017,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: @@ -975,6 +1034,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: @@ -1008,6 +1068,7 @@ def show( scalebar_params=scalebar_params, legend_params=legend_params, rasterize=rasterize, + render_count=prefix, ) if title is None: @@ -1043,6 +1104,87 @@ 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 + 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 + + 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) + if fig_params.fig is not None and save is not None: save_fig(fig_params.fig, path=save) diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index f74259a4..6f3dbb7d 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -68,6 +68,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 @@ -108,7 +109,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, @@ -121,6 +122,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 @@ -219,8 +223,11 @@ def _render_shapes( 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." @@ -369,10 +376,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": # render outlines separately to ensure they are always underneath the shape @@ -439,6 +449,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), @@ -452,6 +463,15 @@ 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 ( + 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 + # False if user specified color-like with 'color' parameter colorbar = False if render_params.col_for_color is None else legend_params.colorbar @@ -485,6 +505,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 @@ -606,7 +627,7 @@ def _render_points( ) assert isinstance(default_color, Color) # shut up mypy - 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, @@ -643,9 +664,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( @@ -668,11 +691,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." @@ -688,6 +716,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: @@ -773,11 +802,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( @@ -793,6 +825,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) @@ -805,9 +839,13 @@ def _render_points( ): 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()])) + 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, cax=cax, @@ -839,6 +877,7 @@ def _render_images( scalebar_params: ScalebarParams, legend_params: LegendParams, rasterize: bool, + render_count: int, ) -> None: sdata_filt = sdata.filter_by_coordinate_system( coordinate_system=coordinate_system, @@ -907,6 +946,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 + # norm needs to be passed directly to ax.imshow(). If we normalize before, that method would always clip. _ax_show_and_transform( layer, @@ -970,22 +1012,19 @@ def _render_images( # 2B) Image has n channels, no palette/cmap info -> sample n categorical colors elif palette is None and not got_multiple_cmaps: # overwrite if n_channels == 2 for intuitive result - if n_channels == 2: - seed_colors = ["#ff0000ff", "#00ff00ff"] + if n_channels in {2, 3}: + seed_colors = ( + ["#ff0000ff", "#00ff00ff"] + if n_channels == 2 + else _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[ch_ind](layers[ch]) for ch_ind, ch in enumerate(channels)], 0, ).sum(0) colored = colored[:, :, :3] - elif n_channels == 3: - seed_colors = _get_colors_for_categorical_obs(list(range(n_channels))) - channel_cmaps = [_get_linear_colormap([c], "k")[0] for c in seed_colors] - colored = np.stack( - [channel_cmaps[ind](layers[ch]) for ind, ch in enumerate(channels)], - 0, - ).sum(0) - colored = colored[:, :, :3] else: if isinstance(render_params.cmap_params, list): cmap_is_default = render_params.cmap_params[0].cmap_is_default @@ -1035,6 +1074,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] @@ -1079,6 +1120,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 @@ -1133,7 +1175,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, @@ -1161,7 +1203,7 @@ def _render_labels( assert color_source_vector is None 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, @@ -1183,7 +1225,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, @@ -1192,12 +1234,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, @@ -1207,10 +1249,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, @@ -1222,7 +1264,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 5e3af820..19440537 100644 --- a/src/spatialdata_plot/pl/render_params.py +++ b/src/spatialdata_plot/pl/render_params.py @@ -183,6 +183,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.""" @@ -200,6 +210,7 @@ class ShapesRenderParams: element: str color: Color | None = None col_for_color: str | 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 @@ -211,7 +222,8 @@ 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 @dataclass @@ -222,6 +234,7 @@ class PointsRenderParams: element: str color: Color | None = None col_for_color: str | 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 @@ -231,7 +244,8 @@ 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 @dataclass @@ -243,7 +257,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 @@ -266,3 +279,4 @@ class LabelsRenderParams: table_name: str | None = None table_layer: str | None = None zorder: int = 0 + colortype: dict[str, str] | str | None = None diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index 9df1f3d0..ee884825 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 @@ -37,6 +36,7 @@ LinearSegmentedColormap, ListedColormap, Normalize, + to_hex, to_rgba, ) from matplotlib.figure import Figure @@ -84,7 +84,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 @@ -165,6 +165,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, @@ -180,11 +188,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, @@ -214,7 +230,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) @@ -649,57 +665,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, @@ -752,13 +717,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.") @@ -778,10 +743,11 @@ 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]: +) -> 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.get_hex_with_alpha()) - return color, color, False + return color, color, False, color_mapping # Figure out where to get the color from origins = _locate_value( @@ -819,11 +785,10 @@ 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` - # TODO check why table_name is not passed here. color_mapping = _get_categorical_color_mapping( adata=sdata["table"], cluster_key=value_to_plot, @@ -843,11 +808,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, na_color.get_hex_with_alpha()) - return color, color, False + color = np.full(sdata[table_name].n_obs, to_hex_alpha(na_color)) + return color, color, False, color_mapping def _map_color_seg( @@ -862,18 +827,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 ( @@ -885,6 +854,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) @@ -892,6 +862,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 = to_hex(color_vector[0], keep_alpha=False) else: cols = cmap_params.cmap(cmap_params.norm(color_vector)) @@ -910,11 +881,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( @@ -928,7 +899,8 @@ def _generate_base_categorial_color_mapping( colors = adata.uns[f"{cluster_key}_colors"] categories = color_source_vector.categories.tolist() + ["NaN"] - colors = [to_hex(to_rgba(color)[:3]) for color in colors] + colors = [to_hex_alpha(to_rgba(color)[:3]) for color in colors] + na_color = to_hex_alpha(to_rgba(na_color)[:3]) if len(categories) > len(colors): return dict(zip(categories, colors + [na_color.get_hex_with_alpha()], strict=True)) @@ -1013,9 +985,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): @@ -2516,7 +2488,7 @@ 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]], + cmap=[to_hex_alpha(cmap.get_under())[:7]], min_alpha=min_alpha, color_key=color_key, ) @@ -2524,7 +2496,7 @@ def _datashader_map_aggregate_to_color( agg_over = agg.where(agg > span[1]) img_over = ds.tf.shade( agg_over, - cmap=[to_hex(cmap.get_over())[:7]], + cmap=[to_hex_alpha(cmap.get_over())[:7]], min_alpha=min_alpha, color_key=color_key, ) diff --git a/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_circles.json b/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_circles.json new file mode 100644 index 00000000..c4073526 --- /dev/null +++ b/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_circles.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "bb000a20-9fb0-4e40-b741-055459f2c90f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_588487c5-9934-482d-8443-c1ef70b03888", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "bb000a20-9fb0-4e40-b741-055459f2c90f", + "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_588487c5-9934-482d-8443-c1ef70b03888" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_circles_and_polygons.json b/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_circles_and_polygons.json new file mode 100644 index 00000000..8d730092 --- /dev/null +++ b/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_circles_and_polygons.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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "15a3a07b-3bdb-4314-860d-d5fadacc107c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_f681113b-12c2-409f-a4b5-47537e57895d", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "15a3a07b-3bdb-4314-860d-d5fadacc107c", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_36517a85-6c72-485e-a3c7-458386642ead", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "15a3a07b-3bdb-4314-860d-d5fadacc107c", + "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_f681113b-12c2-409f-a4b5-47537e57895d" + }, + "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_36517a85-6c72-485e-a3c7-458386642ead" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_polygons.json b/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_polygons.json new file mode 100644 index 00000000..07255ef9 --- /dev/null +++ b/tests/_figures_viewconfig/Extent_extent_calculation_respects_element_selection_polygons.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "182cc64a-f5bc-4a7d-9197-799f2d8d4dac", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_polygons_7a2c3574-84d1-4dc3-9980-5bf2899aad44", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "182cc64a-f5bc-4a7d-9197-799f2d8d4dac", + "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_7a2c3574-84d1-4dc3-9980-5bf2899aad44" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Extent_extent_of_img_full_canvas.json b/tests/_figures_viewconfig/Extent_extent_of_img_full_canvas.json new file mode 100644 index 00000000..917d7e46 --- /dev/null +++ b/tests/_figures_viewconfig/Extent_extent_of_img_full_canvas.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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d3d59b40-101c-49ae-a933-6fcf26f74b55", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_image_d85eee63-74f6-449f-9bb2-c01cd6639ca0", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "d3d59b40-101c-49ae-a933-6fcf26f74b55", + "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_7de66cac-4c48-4821-a8ad-ec64ad9b1a6a", + "type": "linear", + "domain": { + "data": "blobs_image_d85eee63-74f6-449f-9bb2-c01cd6639ca0", + "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_d85eee63-74f6-449f-9bb2-c01cd6639ca0" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_7de66cac-4c48-4821-a8ad-ec64ad9b1a6a", + "value": "value" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Extent_extent_of_img_is_correct_after_spatial_query.json b/tests/_figures_viewconfig/Extent_extent_of_img_is_correct_after_spatial_query.json new file mode 100644 index 00000000..ed14854e --- /dev/null +++ b/tests/_figures_viewconfig/Extent_extent_of_img_is_correct_after_spatial_query.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "272efab7-39df-4860-8ba5-5b42d6331dbc", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_image_b657f258-aa34-4e27-ae62-638f33a90f28", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "272efab7-39df-4860-8ba5-5b42d6331dbc", + "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_50cbf9f9-13bf-4276-b49b-8b841823dc0c", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "272efab7-39df-4860-8ba5-5b42d6331dbc", + "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": [100.0, 400.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [400.0, 100.0], + "range": "height" + }, + { + "name": "color_a1c8e9e7-19d8-48fe-bdc9-7144f75f1526", + "type": "linear", + "domain": { + "data": "blobs_image_b657f258-aa34-4e27-ae62-638f33a90f28", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_3c69f293-817f-4e45-b044-22df58403444", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_50cbf9f9-13bf-4276-b49b-8b841823dc0c", + "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": [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": [100, 150, 200, 250, 300, 350, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_b657f258-aa34-4e27-ae62-638f33a90f28" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_a1c8e9e7-19d8-48fe-bdc9-7144f75f1526", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_image", + "from": { + "data": "blobs_multiscale_image_50cbf9f9-13bf-4276-b49b-8b841823dc0c" + }, + "zindex": 1, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_3c69f293-817f-4e45-b044-22df58403444", + "value": "value" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Extent_extent_of_partial_canvas_on_full_canvas.json b/tests/_figures_viewconfig/Extent_extent_of_partial_canvas_on_full_canvas.json new file mode 100644 index 00000000..1aae62bf --- /dev/null +++ b/tests/_figures_viewconfig/Extent_extent_of_partial_canvas_on_full_canvas.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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "40a9ed18-9448-4811-88eb-1799a8809dd6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_image_bdbc15b6-2e76-4d75-ad4d-0045062c385f", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "40a9ed18-9448-4811-88eb-1799a8809dd6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_image" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "blobs_points_791e7aaf-1a02-499f-9cc3-980f408fb6c4", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "40a9ed18-9448-4811-88eb-1799a8809dd6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "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_dba949c8-68f2-41c6-8970-ab3fbf0592ce", + "type": "linear", + "domain": { + "data": "blobs_image_bdbc15b6-2e76-4d75-ad4d-0045062c385f", + "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_bdbc15b6-2e76-4d75-ad4d-0045062c385f" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_dba949c8-68f2-41c6-8970-ab3fbf0592ce", + "value": "value" + } + ] + } + } + }, + { + "type": "symbol", + "from": { + "data": "blobs_points_791e7aaf-1a02-499f-9cc3-980f408fb6c4" + }, + "zindex": 1, + "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" + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Extent_extent_of_points_partial_canvas.json b/tests/_figures_viewconfig/Extent_extent_of_points_partial_canvas.json new file mode 100644 index 00000000..d68eb198 --- /dev/null +++ b/tests/_figures_viewconfig/Extent_extent_of_points_partial_canvas.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "44201cf5-9dea-47af-a9c7-41dfe877a847", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_points_1603c277-b465-476b-ac64-c7090fe1841b", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "44201cf5-9dea-47af-a9c7-41dfe877a847", + "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_1603c277-b465-476b-ac64-c7090fe1841b" + }, + "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" + } + } + } + } + ] +} 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..bff641e5 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_do_rasterization.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": "310f27ee-6454-459b-8f5e-4e16b623c0e0", + "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" + }, + "source": "310f27ee-6454-459b-8f5e-4e16b623c0e0", + "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_479b979e-0b64-4446-a073-f289ec0964e1", + "type": "linear", + "domain": { + "data": "blobs_giant_image_83d630c4-742c-4760-8689-cfc36982f767", + "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, 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" + } + ] + } + } + } + ] +} 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 new file mode 100644 index 00000000..69c96565 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_cmap_to_each_channel.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": "5a0bb292-f260-4cbd-b3e0-47af4aba90ee", + "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" + }, + "source": "5a0bb292-f260-4cbd-b3e0-47af4aba90ee", + "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_92ab80f1-bed8-4fbc-89b5-577a017537dd", + "type": "linear", + "domain": { + "data": "blobs_image_4b0bddae-3ec9-47e8-b8b2-6347a616addb", + "field": "channel_0" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "name": "color_29e1b005-ce0b-43ea-a493-5d9ebd2932db", + "type": "linear", + "domain": { + "data": "blobs_image_4b0bddae-3ec9-47e8-b8b2-6347a616addb", + "field": "channel_1" + }, + "range": { + "scheme": "Greens", + "count": 256 + } + }, + { + "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" + }, + { + "scale": "color_5f9f8ab3-fef5-4769-8234-9cc992ada633", + "field": "channel_2" + } + ] + } + } + } + ] +} 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..273e4060 --- /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": "1cfd0773-9e4b-4648-873b-dc2de16dac79", + "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" + }, + "source": "1cfd0773-9e4b-4648-873b-dc2de16dac79", + "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_2b265a69-5444-4a45-8c48-58992831d857", + "type": "linear", + "domain": { + "data": "blobs_image_69c900bf-5fb9-49d9-beeb-ec427033c897", + "field": "value" + }, + "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 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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" + } + ] + } + } + } + ] +} 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..114172ba --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_color_to_each_channel.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": "e3ed7e3d-c431-401e-9016-96758d66ed26", + "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" + }, + "source": "e3ed7e3d-c431-401e-9016-96758d66ed26", + "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_b081d115-aff5-4522-80ed-08e136a620aa", + "type": "linear", + "domain": { + "data": "blobs_image_630d6c03-37fc-4649-aaaf-d3d3e3a76ad7", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_a3f8b7d7-7e9e-48aa-b998-e6e6f15da4bf", + "type": "linear", + "domain": { + "data": "blobs_image_630d6c03-37fc-4649-aaaf-d3d3e3a76ad7", + "field": "channel_1" + }, + "range": { + "scheme": "green", + "count": 256 + } + }, + { + "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" + }, + { + "scale": "color_fc2bb56c-d9f6-4903-b421-e884d7ccf4b9", + "field": "channel_2" + } + ] + } + } + } + ] +} 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..1f3a2dc3 --- /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": "5e7d03da-0619-4b9e-8f37-74ebcb652893", + "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" + }, + "source": "5e7d03da-0619-4b9e-8f37-74ebcb652893", + "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_cd39d565-2502-48df-b81d-25f612e96a8e", + "type": "linear", + "domain": { + "data": "blobs_image_f9ebf8a6-4d3b-4553-92b2-f44e92c411cd", + "field": "value" + }, + "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 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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" + } + ] + } + } + } + ] +} 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..99f67c6e --- /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": "c3a00559-2577-4250-94d9-4dc536170140", + "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" + }, + "source": "c3a00559-2577-4250-94d9-4dc536170140", + "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": "8d7ccef3-8b28-4588-92bb-afdf8e57a5e9" + } + ] + } + ], + "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" + }, + "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_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" + } + ] + } + } + } + ] +} 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..ba8e48bb --- /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": "d860d8a5-5790-4ef1-aa6c-175850621d3e", + "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" + }, + "source": "d860d8a5-5790-4ef1-aa6c-175850621d3e", + "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": "efb5b22f-9657-462f-bca2-5764b6ae6693" + } + ] + } + ], + "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" + }, + "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_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" + } + ] + } + } + } + ] +} 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..58da2fc3 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_pass_normalize_clip_true_list_cmap.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": "3913eefe-b116-4c2e-bfb6-d7d336be7624", + "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" + }, + "source": "3913eefe-b116-4c2e-bfb6-d7d336be7624", + "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": "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 + } + }, + { + "name": "color_55ff1948-3d0d-4303-a66f-622a691cb1f7", + "type": "linear", + "domain": { + "data": "281ad89d-ff5e-45b1-8871-69a330bc5b0a", + "field": "channel_1" + }, + "range": { + "scheme": "Reds", + "count": 256 + } + }, + { + "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" + }, + { + "scale": "color_b4ebab40-e949-49c4-9b3b-2538c6c1ba68", + "field": "channel_2" + } + ] + } + } + } + ] +} 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 new file mode 100644 index 00000000..492d42cd --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_image.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": "8b73b613-7de4-4b66-99e8-adf8495fe2f9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_c9157b68-6ffc-499d-8129-cf64c4208f10", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "8b73b613-7de4-4b66-99e8-adf8495fe2f9", + "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_da1920b3-21fc-4831-9c25-759322e747ba", + "type": "linear", + "domain": { + "data": "blobs_image_c9157b68-6ffc-499d-8129-cf64c4208f10", + "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 + } + ], + "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" + } + ] + } + } + } + ] +} 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..d067307f --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_from_multiscale_image.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": "18c56ea6-26db-471f-a90d-f4f7c1160496", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_image_05c6ea95-9022-4098-9cc0-15e00818271e", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "18c56ea6-26db-471f-a90d-f4f7c1160496", + "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_0b446852-de5c-4f0b-a174-25fbad30ca8f", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_05c6ea95-9022-4098-9cc0-15e00818271e", + "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 + } + ], + "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" + } + ] + } + } + } + ] +} 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..223ebf0d --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_image.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": "825b16c6-6b89-4091-8809-5b6823c66348", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_image_bb84f6ff-822e-49ee-88f3-1a3460d879df", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "825b16c6-6b89-4091-8809-5b6823c66348", + "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_1cc6a24e-19e0-4056-aedf-2deae948a3eb", + "type": "linear", + "domain": { + "data": "blobs_image_bb84f6ff-822e-49ee-88f3-1a3460d879df", + "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 + } + ], + "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" + } + ] + } + } + } + ] +} 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..1952e7d6 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_a_single_channel_str_from_multiscale_image.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": "73169fe4-42d5-4031-a2cf-1e91891796c3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.3.1.dev31+g4021946.d20250416" + } + }, + { + "name": "blobs_multiscale_image_bfc72005-530b-4856-8326-6a217664011a", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "73169fe4-42d5-4031-a2cf-1e91891796c3", + "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_7b255ff1-7bbb-419d-96ff-3adc33c5d784", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_bfc72005-530b-4856-8326-6a217664011a", + "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 + } + ], + "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" + } + ] + } + } + } + ] +} 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..e0b952c9 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_given_scale_of_multiscale_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": "26e46eea-c230-4ec1-b66d-4c9087f07a5e", + "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" + }, + "source": "26e46eea-c230-4ec1-b66d-4c9087f07a5e", + "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_6bbd2fcc-2048-41e5-8f94-5a82261da007", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_cbc68b20-0373-4e7e-b03b-021f929292e6", + "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_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" + } + ] + } + } + } + ] +} 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 new file mode 100644 index 00000000..3a0b4d80 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_multiscale_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": "fca0896d-55a1-4f0c-ae3d-30748c67aa9a", + "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" + }, + "source": "fca0896d-55a1-4f0c-ae3d-30748c67aa9a", + "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_b0792709-3fe3-447b-a882-af004a788e12", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_75a801cf-b82f-443b-bfca-4917b3a4567b", + "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_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" + } + ] + } + } + } + ] +} 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..732dcce9 --- /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": "43ed4d7b-b39c-476f-b492-e29ab0b537e5", + "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" + }, + "source": "43ed4d7b-b39c-476f-b492-e29ab0b537e5", + "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_95961a83-8b52-4225-bc77-d47b5c7db421", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_22c88290-dd1f-47dd-9219-bcae514b2c5b", + "field": "value" + }, + "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": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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" + } + ] + } + } + } + ] +} 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..17985c70 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_image.json @@ -0,0 +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" + }, + "data": [ + { + "name": "52adc31c-ff3c-413a-9e1a-42f70abd463b", + "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" + }, + "source": "52adc31c-ff3c-413a-9e1a-42f70abd463b", + "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_474a59ad-5353-4979-b2a6-8b15235ea292", + "type": "linear", + "domain": { + "data": "blobs_image_58d4303d-cf92-4241-82f3-d4ff0c0de44f", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_7e710624-0e4d-4585-844b-4520a1760c27", + "type": "linear", + "domain": { + "data": "blobs_image_58d4303d-cf92-4241-82f3-d4ff0c0de44f", + "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": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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" + }, + { + "scale": "color_7e710624-0e4d-4585-844b-4520a1760c27", + "field": "channel_1" + } + ] + } + } + } + ] +} 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..45830102 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_from_multiscale_image.json @@ -0,0 +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" + }, + "data": [ + { + "name": "b25cb110-4d88-47d4-af39-2216bc347dbf", + "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" + }, + "source": "b25cb110-4d88-47d4-af39-2216bc347dbf", + "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_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 + } + }, + { + "name": "color_81b34f18-602d-43b7-9dd0-75fe46fafbcd", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_969bab36-b421-43df-bf58-530489006d0e", + "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": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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" + }, + { + "scale": "color_81b34f18-602d-43b7-9dd0-75fe46fafbcd", + "field": "channel_1" + } + ] + } + } + } + ] +} 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..79b1f147 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_image.json @@ -0,0 +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" + }, + "data": [ + { + "name": "2bb8c9cf-3ede-4a75-a651-e2e4033cfe30", + "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" + }, + "source": "2bb8c9cf-3ede-4a75-a651-e2e4033cfe30", + "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_385e32f0-3036-44ad-bfe6-bc945f2e882b", + "type": "linear", + "domain": { + "data": "blobs_image_6a5ce105-d7f0-448e-b18e-6c466e40a3e4", + "field": "channel_0" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_35a9d003-2c62-4bd1-80d5-7f4e62a58b16", + "type": "linear", + "domain": { + "data": "blobs_image_6a5ce105-d7f0-448e-b18e-6c466e40a3e4", + "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": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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" + }, + { + "scale": "color_35a9d003-2c62-4bd1-80d5-7f4e62a58b16", + "field": "channel_1" + } + ] + } + } + } + ] +} 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..489377ff --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_render_two_channels_str_from_multiscale_image.json @@ -0,0 +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" + }, + "data": [ + { + "name": "f656da23-df6a-4138-a077-a7387db7be53", + "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" + }, + "source": "f656da23-df6a-4138-a077-a7387db7be53", + "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_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 + } + }, + { + "name": "color_2cf38f71-902c-4bfb-97c9-be49c9ef8037", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_699e2f11-1b9a-4664-a024-4927881d0e82", + "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": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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" + }, + { + "scale": "color_2cf38f71-902c-4bfb-97c9-be49c9ef8037", + "field": "channel_1" + } + ] + } + } + } + ] +} 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..c714b15f --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_stack_render_images.json @@ -0,0 +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" + }, + "data": [ + { + "name": "914ee764-08a4-4ad7-8b63-3182de6d8b1c", + "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" + }, + "source": "914ee764-08a4-4ad7-8b63-3182de6d8b1c", + "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_2dd09406-f795-418e-88d7-cb80a4bc0edc", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "914ee764-08a4-4ad7-8b63-3182de6d8b1c", + "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_1eac3ec0-f7bf-4fa8-8194-9ba1fedfb91b", + "type": "linear", + "domain": { + "data": "blobs_image_fb9a125e-f992-4d8d-9398-72076c339a87", + "field": "value" + }, + "range": { + "scheme": "red", + "count": 256 + } + }, + { + "name": "color_6778ee81-85e2-4a13-9da5-2dbcf226b2d3", + "type": "linear", + "domain": { + "data": "blobs_image_2dd09406-f795-418e-88d7-cb80a4bc0edc", + "field": "value" + }, + "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, 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" + }, + "zindex": 1, + "encode": { + "enter": { + "opacity": { + "value": 0.5 + }, + "fill": [ + { + "scale": "color_6778ee81-85e2-4a13-9da5-2dbcf226b2d3", + "value": "value" + } + ] + } + } + } + ] +} 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..866ccbbb --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_stick_to_zorder.json @@ -0,0 +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" + }, + "data": [ + { + "name": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "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" + }, + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_d443aa65-ae23-4fa6-89ad-386f54c0e362", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_728308be-d846-4ab0-a9e6-7842ba2f6b5c", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_image_6da32144-7f97-4e3a-933f-d0e14d202be9", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "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_2747caaa-a6f5-4b36-9da5-14a00e57d0a8", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "0ca3e9d6-2256-4329-8c68-2a68328d88a3", + "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_7cc8cbd4-1f81-4540-bf76-deae65d7d419", + "type": "linear", + "domain": { + "data": "blobs_image_6da32144-7f97-4e3a-933f-d0e14d202be9", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_6e1ecf3c-e558-4319-bde0-dd4054b51883", + "type": "linear", + "domain": { + "data": "blobs_multiscale_image_2747caaa-a6f5-4b36-9da5-14a00e57d0a8", + "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": "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" + }, + "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" + }, + "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" + }, + "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" + }, + "zindex": 4, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_6e1ecf3c-e558-4319-bde0-dd4054b51883", + "value": "value" + } + ] + } + } + } + ] +} 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..be1df037 --- /dev/null +++ b/tests/_figures_viewconfig/Images_can_stop_rasterization_with_scale_full.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": "2cdd9e63-38e2-4d06-a449-a236fb828aa3", + "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" + }, + "source": "2cdd9e63-38e2-4d06-a449-a236fb828aa3", + "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_ec0ae51e-e677-467e-9268-93af907100f0", + "type": "linear", + "domain": { + "data": "blobs_giant_image_00816b4e-df7d-401d-a590-623139665e4e", + "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, 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" + } + ] + } + } + } + ] +} 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..29efecc4 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_annotate_labels_with_table_layer.json @@ -0,0 +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" + }, + "data": [ + { + "name": "508c0d93-5996-49a6-b67c-1f5992327e6e", + "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 + }, + "source": "508c0d93-5996-49a6-b67c-1f5992327e6e", + "transform": [ + { + "type": "filter_element", + "expr": "table" + }, + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_labels_e2efe281-9f48-4f2d-aa63-ae4f7b872b9c", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "508c0d93-5996-49a6-b67c-1f5992327e6e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "6d94b8ab-9478-48bd-943b-134755ffae6f", + "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_813c1063-5d20-4cb5-a4e7-a2624c981c3c", + "type": "linear", + "domain": { + "data": "blobs_labels_e2efe281-9f48-4f2d-aa63-ae4f7b872b9c", + "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_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 + }, + "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" + } + ] + } + } + } + ] +} 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..c1b10451 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable.json @@ -0,0 +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" + }, + "data": [ + { + "name": "0fefd8ec-6282-4244-ad12-df06477b3a01", + "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" + }, + "source": "0fefd8ec-6282-4244-ad12-df06477b3a01", + "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 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_e246018a-8b16-4177-ac54-a6f98d4deaab", + "field": "which_max" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..c2736bbb --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_categorical_variable_in_other_table.json @@ -0,0 +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 + }, + "data": [ + { + "name": "11a31e13-7858-42ff-b3c4-051a0a1a655a", + "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" + }, + "source": "11a31e13-7858-42ff-b3c4-051a0a1a655a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "scale0" + }, + { + "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 + }, + "y": { + "value": 113.6941176470588 + }, + "width": { + "value": 73.41176470588236 + }, + "height": { + "value": 73.41176470588238 + } + } + }, + "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" + }, + { + "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_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, 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 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_1d0e960e-5e61-49b3-bfde-f2d15dc7d9f8", + "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 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 145.69411764705882 + }, + "y": { + "value": 113.6941176470588 + }, + "width": { + "value": 73.41176470588232 + }, + "height": { + "value": 73.41176470588235 + } + } + }, + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "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_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, 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 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_22521af9-1104-4fe0-8082-a03bed3a4a4b", + "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 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 233.7882352941176 + }, + "y": { + "value": 113.6941176470588 + }, + "width": { + "value": 73.41176470588238 + }, + "height": { + "value": 73.41176470588238 + } + } + }, + "scales": [ + { + "name": "X_scale_2", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "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 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_f08e03c5-045b-4050-ade4-4cc468c29b7f", + "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 + } + ] + } + ] +} 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..ff9263cb --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_labels_by_continuous_variable.json @@ -0,0 +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" + }, + "data": [ + { + "name": "7ad2eda1-7f95-4bc0-9eea-d55b77fc82f6", + "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" + }, + "source": "7ad2eda1-7f95-4bc0-9eea-d55b77fc82f6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "a51a8bc8-78f5-4073-a856-aca8a03f2691", + "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_08e37103-26f9-4924-b982-ffabdeba929c", + "type": "linear", + "domain": { + "data": "blobs_labels_0942bd06-7b2f-484b-83fa-20862313ab26", + "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_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 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_08e37103-26f9-4924-b982-ffabdeba929c", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..0a09644d --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_with_norm_and_clipping.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": "d25724cd-5a33-4c05-a342-57cf77fdb2b5", + "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" + }, + "source": "d25724cd-5a33-4c05-a342-57cf77fdb2b5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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 + }, + { + "type": "formula", + "expr": "clamp((datum.value - 400.0) / (1000.0 - 400.0), 0, 1)", + "as": "ae0c077f-cdea-4247-a5bf-26e045ab199e" + } + ] + } + ], + "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" + }, + "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_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 + }, + "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" + } + ] + } + } + } + ] +} 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..5fe23820 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_color_with_norm_no_clipping.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": "7e5b4966-863c-4cde-b600-6f5b54d2b5f6", + "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" + }, + "source": "7e5b4966-863c-4cde-b600-6f5b54d2b5f6", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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 + }, + { + "type": "formula", + "expr": "(datum.value - 400.0) / (1000.0 - 400.0)", + "as": "1cf6df50-fadf-4472-87fa-ef111a8c376c" + } + ] + } + ], + "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" + }, + "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_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 + }, + "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" + } + ] + } + } + } + ] +} 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..b3c5ad5d --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_control_label_infill.json @@ -0,0 +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" + }, + "data": [ + { + "name": "81a6fc5e-c2d2-4cfd-bab8-a0ff16d55179", + "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" + }, + "source": "81a6fc5e-c2d2-4cfd-bab8-a0ff16d55179", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "1a9e3c5e-fbf5-4189-8f92-451c9944307f", + "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_2dde8833-baa0-4dad-9991-20c40538c0c0", + "type": "linear", + "domain": { + "data": "blobs_labels_0d37d4d5-16a0-4e8d-8477-930e29064291", + "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_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 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_2dde8833-baa0-4dad-9991-20c40538c0c0", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..e4a7850a --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_control_label_outline.json @@ -0,0 +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" + }, + "data": [ + { + "name": "9de77b43-a363-4186-93a0-6078dc218aba", + "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" + }, + "source": "9de77b43-a363-4186-93a0-6078dc218aba", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "c974aded-3c13-43fb-9c80-d7a8a8af79fb", + "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_8fe101e5-e6b5-4e5e-9b5f-115e11b05a7f", + "type": "linear", + "domain": { + "data": "blobs_labels_3b489c4d-ea37-4cb1-bbbe-553e0ad074f2", + "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_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 + }, + "strokeWidth": { + "value": 15 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_8fe101e5-e6b5-4e5e-9b5f-115e11b05a7f", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..2eec8651 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_do_rasterization.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": "9952e569-f365-4965-bb68-70338c8f4e70", + "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" + }, + "source": "9952e569-f365-4965-bb68-70338c8f4e70", + "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_df7cdfed-fd93-406f-9510-222b32489094", + "type": "ordinal", + "domain": { + "data": "blobs_giant_labels_3fc3d131-9a97-47da-892e-8fe709ad1037", + "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_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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_handle_dropping_small_labels_after_rasterize_categorical.json b/tests/_figures_viewconfig/Labels_can_handle_dropping_small_labels_after_rasterize_categorical.json new file mode 100644 index 00000000..0c28da2d --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_handle_dropping_small_labels_after_rasterize_categorical.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "6f68d8db-3e08-400d-ae47-1a4c60a04974", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "ef36f5fe-d192-4d3f-8a6f-f31159eeb52d", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "6f68d8db-3e08-400d-ae47-1a4c60a04974", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_large_801d212b-f627-40cc-9b1e-2f0e1b5bc615", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "6f68d8db-3e08-400d-ae47-1a4c60a04974", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels_large" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "ef36f5fe-d192-4d3f-8a6f-f31159eeb52d", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["category"], + "as": ["category"], + "default": null + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 2048.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [2048.0, 0.0], + "range": "height" + }, + { + "name": "color_e75e86b4-e9c7-456a-8c10-4e34c9d3f9e1", + "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, 500, 1000, 1500, 2000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "discrete", + "direction": "vertical", + "fill": "color_e75e86b4-e9c7-456a-8c10-4e34c9d3f9e1", + "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_large_801d212b-f627-40cc-9b1e-2f0e1b5bc615" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_e75e86b4-e9c7-456a-8c10-4e34c9d3f9e1", + "value": "category" + } + ], + "fill": [ + { + "scale": "color_e75e86b4-e9c7-456a-8c10-4e34c9d3f9e1", + "value": "category" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_e75e86b4-e9c7-456a-8c10-4e34c9d3f9e1", + "field": "category" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Labels_can_handle_dropping_small_labels_after_rasterize_continuous.json b/tests/_figures_viewconfig/Labels_can_handle_dropping_small_labels_after_rasterize_continuous.json new file mode 100644 index 00000000..e1ef5fe9 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_handle_dropping_small_labels_after_rasterize_continuous.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "13068f3d-27b2-41a6-bd73-1a624c06dab4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "ab3253ab-3649-46c6-87aa-24a0b6b40819", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "13068f3d-27b2-41a6-bd73-1a624c06dab4", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_large_137a0f2f-3a4a-4add-aa80-145f35a4854c", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "13068f3d-27b2-41a6-bd73-1a624c06dab4", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels_large" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "ab3253ab-3649-46c6-87aa-24a0b6b40819", + "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, 2048.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [2048.0, 0.0], + "range": "height" + }, + { + "name": "color_b1f03be0-bbb2-4684-a298-e979b8075b40", + "type": "linear", + "domain": { + "data": "blobs_labels_large_137a0f2f-3a4a-4add-aa80-145f35a4854c", + "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, 1000, 2000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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], + "zindex": 1.5 + } + ], + "legend": [ + { + "type": "gradient", + "direction": "vertical", + "orient": "none", + "fill": "color_b1f03be0-bbb2-4684-a298-e979b8075b40", + "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_large_137a0f2f-3a4a-4add-aa80-145f35a4854c" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_b1f03be0-bbb2-4684-a298-e979b8075b40", + "value": "channel_0_sum" + } + ], + "fill": [ + { + "scale": "color_b1f03be0-bbb2-4684-a298-e979b8075b40", + "value": "channel_0_sum" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_b1f03be0-bbb2-4684-a298-e979b8075b40", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..9b7c1148 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_plot_with_one_element_color_table.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": "f964c795-b1af-4649-93d6-32b69389d1d7", + "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 + }, + "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" + }, + "source": "f964c795-b1af-4649-93d6-32b69389d1d7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "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 + }, + "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" + }, + "source": "f964c795-b1af-4649-93d6-32b69389d1d7", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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 + } + ] + } + ], + "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"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_7484dba0-c6c4-4571-bde9-333fac8bcb14", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_43390fdb-4b0e-45c4-bb6c-7264a9236c58", + "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_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 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_51aaadce-6295-41bc-b469-7c301c1bfe2a", + "field": "channel_0_sum" + }, + { + "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 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_7484dba0-c6c4-4571-bde9-333fac8bcb14", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..b2bb7053 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_render_given_scale_of_multiscale_labels.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": "87293909-715a-4292-8d50-38294effca8b", + "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" + }, + "source": "87293909-715a-4292-8d50-38294effca8b", + "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_ba245473-5102-4955-849d-529c412218d8", + "type": "ordinal", + "domain": { + "data": "blobs_multiscale_labels_f4cf783d-0adb-4641-b1f9-7c825b7abad2", + "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_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 + } + } + } + } + ] +} 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..cc81c0b4 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_render_labels.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": "bd8cf430-570b-49ab-9bd9-dca6c51d8ab3", + "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" + }, + "source": "bd8cf430-570b-49ab-9bd9-dca6c51d8ab3", + "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_e9a1a0d8-c8b6-40b1-a599-49ff6d284185", + "type": "ordinal", + "domain": { + "data": "blobs_labels_f1254fbd-a1cf-4a39-af40-08f20e824d1c", + "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_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 + } + } + } + } + ] +} 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..1559129b --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_render_multiscale_labels.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": "d9ba20c7-cad0-4851-9fef-d19fa210506b", + "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" + }, + "source": "d9ba20c7-cad0-4851-9fef-d19fa210506b", + "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_c59852be-fc98-45c4-af85-ceed8c467020", + "type": "ordinal", + "domain": { + "data": "blobs_multiscale_labels_96bec926-1efe-4243-a071-8852021e2fc3", + "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_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 + } + } + } + } + ] +} 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..03578b7a --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_stack_render_labels.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": "e21c21c8-5f5b-4fa8-89da-604f68d78c28", + "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" + }, + "source": "e21c21c8-5f5b-4fa8-89da-604f68d78c28", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "blobs_labels_a6869836-35fc-4cb3-9fff-b23541f65ce1", + "format": { + "type": "RasterFormatV02", + "version": "0.2" + }, + "source": "e21c21c8-5f5b-4fa8-89da-604f68d78c28", + "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_ff2f67ed-d4e9-41e1-9e5d-fc271817989c" + }, + "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_a6869836-35fc-4cb3-9fff-b23541f65ce1" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "value": "#0000ff" + } + ], + "fill": [ + { + "value": "#0000ff" + } + ], + "fillOpacity": { + "value": 0 + }, + "strokeOpacity": { + "value": 1 + }, + "strokeWidth": { + "value": 15 + } + } + } + } + ] +} 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..aaf4a41e --- /dev/null +++ b/tests/_figures_viewconfig/Labels_can_stop_rasterization_with_scale_full.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": "e70c4f52-b2f1-4804-865a-dc9e5e3e33ad", + "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" + }, + "source": "e70c4f52-b2f1-4804-865a-dc9e5e3e33ad", + "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_396f1ebc-dda9-4b51-94cb-7ff14678495f", + "type": "ordinal", + "domain": { + "data": "blobs_giant_labels_10d6b6a2-cadb-4508-a47f-aa29adfec5c1", + "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_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 + } + } + } + } + ] +} 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..ad5fd9f5 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_label_categorical_color.json @@ -0,0 +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" + }, + "data": [ + { + "name": "2836bed2-7cd2-442e-9809-a3096fdcefb7", + "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" + }, + "source": "2836bed2-7cd2-442e-9809-a3096fdcefb7", + "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 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_001be20c-b06b-4329-8a8c-4391e86cae67", + "field": "category" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..c65bf87a --- /dev/null +++ b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_infill.json @@ -0,0 +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" + }, + "data": [ + { + "name": "cdcc1f2b-1c58-4ec6-924a-c26ff2275961", + "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" + }, + "source": "cdcc1f2b-1c58-4ec6-924a-c26ff2275961", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "f931a0c1-e7dd-4cc9-a85d-3dc59650242f", + "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_f88e66f7-3829-46b0-9c1f-ce82da2c608a", + "type": "linear", + "domain": { + "data": "blobs_labels_516e21ed-547c-4d2c-9a1d-5696a083b631", + "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_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 + }, + "strokeWidth": { + "value": 15 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_f88e66f7-3829-46b0-9c1f-ce82da2c608a", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..dce1a692 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_label_colorbar_uses_alpha_of_less_transparent_outline.json @@ -0,0 +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" + }, + "data": [ + { + "name": "4f93dcc9-ee59-41ae-8964-41b780f6e117", + "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" + }, + "source": "4f93dcc9-ee59-41ae-8964-41b780f6e117", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "f130214b-7200-4c2a-83a6-00db22e8858c", + "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_2069823d-fa3b-4467-b40b-e3972d328ac8", + "type": "linear", + "domain": { + "data": "blobs_labels_385c0aa5-39e3-4d0b-b2eb-943eed930aef", + "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_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 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_2069823d-fa3b-4467-b40b-e3972d328ac8", + "field": "channel_0_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} 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..e759241a --- /dev/null +++ b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order.json @@ -0,0 +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 + }, + "data": [ + { + "name": "54dff630-dfce-49e8-aafd-d5e811da81b4", + "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" + }, + "source": "54dff630-dfce-49e8-aafd-d5e811da81b4", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "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 + }, + "y": { + "value": 93.67272727272727 + }, + "width": { + "value": 113.45454545454545 + }, + "height": { + "value": 113.45454545454545 + } + } + }, + "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" + }, + { + "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 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_fd7d1678-5de3-45e4-88e7-73b4fd65701e", + "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": 93.57727272727273 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 93.67272727272727 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 113.45454545454544 + } + } + }, + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "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 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_ad66c4d1-b3e4-43e1-8dea-c95a35124ef8", + "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": 229.72272727272727 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + } + ] +} 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..80a98f20 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_subset_categorical_label_maintains_order_when_palette_overwrite.json @@ -0,0 +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 + }, + "data": [ + { + "name": "93e36e8c-3ac2-43eb-978d-31e7da669877", + "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" + }, + "source": "93e36e8c-3ac2-43eb-978d-31e7da669877", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "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 + }, + "y": { + "value": 93.67272727272727 + }, + "width": { + "value": 113.45454545454545 + }, + "height": { + "value": 113.45454545454545 + } + } + }, + "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" + }, + { + "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 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_acdf3dfb-31e4-4066-942f-639ccf89ccdc", + "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": 93.57727272727273 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 93.67272727272727 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 113.45454545454544 + } + } + }, + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "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 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_ab6b42a8-a361-41f4-95b8-81bd8e040c18", + "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": 229.72272727272727 + }, + "y": { + "value": 75.0060606060606 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + } + ] +} 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..0c4542c9 --- /dev/null +++ b/tests/_figures_viewconfig/Labels_two_calls_with_coloring_result_in_two_colorbars.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": "3e9a598d-f682-434a-9513-e49924876bc1", + "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 + }, + "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" + }, + "source": "3e9a598d-f682-434a-9513-e49924876bc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "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 + }, + "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" + }, + "source": "3e9a598d-f682-434a-9513-e49924876bc1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multiscale_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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 + } + ] + } + ], + "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"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_dce43504-13d9-4fc5-9789-0b22d586ac5e", + "type": "linear", + "domain": { + "data": "blobs_multiscale_labels_19fc95a8-c587-4fa9-9327-69bbc0f99443", + "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_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 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_bfd54971-c0e2-40d9-8dda-3b4c921ecd56", + "field": "channel_0_sum" + }, + { + "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 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_dce43504-13d9-4fc5-9789-0b22d586ac5e", + "field": "channel_1_sum" + }, + { + "value": "#d3d3d3ff" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_affine.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_affine.json new file mode 100644 index 00000000..1bad58f3 --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_affine.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "2a9c7c09-e360-4e8f-9c94-160289e4100b", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_140f6a5e-7826-454e-bdbf-307752cb3c85", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "2a9c7c09-e360-4e8f-9c94-160289e4100b", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_4cd3b660-2008-4c59-8213-ef932d572a66", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "2a9c7c09-e360-4e8f-9c94-160289e4100b", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_78c730d2-ca24-4675-9679-0b91e624d371", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "2a9c7c09-e360-4e8f-9c94-160289e4100b", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-767.9999999999999, 1773.6200269505305], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [1177.107510106449, 0.0], + "range": "height" + }, + { + "name": "color_a986de6a-9e01-47b8-975e-25fe091d0e6b", + "type": "linear", + "domain": { + "data": "raccoon_140f6a5e-7826-454e-bdbf-307752cb3c85", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_d7eef9df-a2aa-4b89-89e9-b05fb100d0fa", + "type": "ordinal", + "domain": { + "data": "segmentation_4cd3b660-2008-4c59-8213-ef932d572a66", + "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], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_140f6a5e-7826-454e-bdbf-307752cb3c85" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_a986de6a-9e01-47b8-975e-25fe091d0e6b", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_4cd3b660-2008-4c59-8213-ef932d572a66" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_d7eef9df-a2aa-4b89-89e9-b05fb100d0fa", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_d7eef9df-a2aa-4b89-89e9-b05fb100d0fa", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_78c730d2-ca24-4675-9679-0b91e624d371" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_composition.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_composition.json new file mode 100644 index 00000000..69503371 --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_composition.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "4554ad26-1a22-4af2-ad6f-dedcd1f8eb63", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_45436cd8-5690-46ef-8314-e662828b4940", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "4554ad26-1a22-4af2-ad6f-dedcd1f8eb63", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_4027ab05-2246-409d-9311-6c4648a2b4eb", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "4554ad26-1a22-4af2-ad6f-dedcd1f8eb63", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_b039358e-a2e1-4114-84fb-50c89499da2d", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "4554ad26-1a22-4af2-ad6f-dedcd1f8eb63", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-383.99999999999994, 2048.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [1177.107510106449, 0.0], + "range": "height" + }, + { + "name": "color_95d07df6-54e8-4cad-95ce-ab3f1ea54629", + "type": "linear", + "domain": { + "data": "raccoon_45436cd8-5690-46ef-8314-e662828b4940", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_65790703-c8c3-473f-b38f-6d65156ca8d1", + "type": "ordinal", + "domain": { + "data": "segmentation_4027ab05-2246-409d-9311-6c4648a2b4eb", + "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, 500, 1000, 1500, 2000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_45436cd8-5690-46ef-8314-e662828b4940" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_95d07df6-54e8-4cad-95ce-ab3f1ea54629", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_4027ab05-2246-409d-9311-6c4648a2b4eb" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_65790703-c8c3-473f-b38f-6d65156ca8d1", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_65790703-c8c3-473f-b38f-6d65156ca8d1", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_b039358e-a2e1-4114-84fb-50c89499da2d" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_inverse.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_inverse.json new file mode 100644 index 00000000..258b968b --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_inverse.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "c4ceae3e-5a03-48df-85c8-751ab4a844e3", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_685d6dd7-c683-49aa-a412-fe72c2619cf1", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "c4ceae3e-5a03-48df-85c8-751ab4a844e3", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_ef728767-b616-4932-8edd-6e662451478a", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "c4ceae3e-5a03-48df-85c8-751ab4a844e3", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_de6d614e-bd75-4cac-98a3-270edee40c7e", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "c4ceae3e-5a03-48df-85c8-751ab4a844e3", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 1024.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [768.0000000000001, 0.0], + "range": "height" + }, + { + "name": "color_4e08fd50-095b-43c9-9a21-630d04093ae0", + "type": "linear", + "domain": { + "data": "raccoon_685d6dd7-c683-49aa-a412-fe72c2619cf1", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_fb26d6a7-37b5-4e46-b261-e0948dd29ffe", + "type": "ordinal", + "domain": { + "data": "segmentation_ef728767-b616-4932-8edd-6e662451478a", + "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, 250, 500, 750, 1000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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, 600], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_685d6dd7-c683-49aa-a412-fe72c2619cf1" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_4e08fd50-095b-43c9-9a21-630d04093ae0", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_ef728767-b616-4932-8edd-6e662451478a" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_fb26d6a7-37b5-4e46-b261-e0948dd29ffe", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_fb26d6a7-37b5-4e46-b261-e0948dd29ffe", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_de6d614e-bd75-4cac-98a3-270edee40c7e" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_mapaxis.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_mapaxis.json new file mode 100644 index 00000000..a5762d40 --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_mapaxis.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "fc054c15-4258-46e2-9088-b309bf4472a7", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_9533fa83-2ac8-4dd8-9ab0-753d1138bb06", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "fc054c15-4258-46e2-9088-b309bf4472a7", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_18a4ee19-c4bf-49dd-a217-6c4bea385e6d", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "fc054c15-4258-46e2-9088-b309bf4472a7", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_1d1c6f3c-cf8c-490a-9369-1b49a606d6c5", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "fc054c15-4258-46e2-9088-b309bf4472a7", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 1024.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [1024.0, 0.0], + "range": "height" + }, + { + "name": "color_f5c6d522-e076-4be0-9580-f2901e075bfd", + "type": "linear", + "domain": { + "data": "raccoon_9533fa83-2ac8-4dd8-9ab0-753d1138bb06", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_8f55b707-5487-4ded-836e-b6dbbb9612fd", + "type": "ordinal", + "domain": { + "data": "segmentation_18a4ee19-c4bf-49dd-a217-6c4bea385e6d", + "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, 250, 500, 750, 1000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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, 600, 800, 1000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_9533fa83-2ac8-4dd8-9ab0-753d1138bb06" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_f5c6d522-e076-4be0-9580-f2901e075bfd", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_18a4ee19-c4bf-49dd-a217-6c4bea385e6d" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_8f55b707-5487-4ded-836e-b6dbbb9612fd", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_8f55b707-5487-4ded-836e-b6dbbb9612fd", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_1d1c6f3c-cf8c-490a-9369-1b49a606d6c5" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_overlay.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_overlay.json new file mode 100644 index 00000000..cb63ca20 --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_overlay.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "04577b82-dff4-4168-8243-191f1f33f0f4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_8879bbb4-67d6-4f8f-9d20-a2f85ae0f1dc", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "04577b82-dff4-4168-8243-191f1f33f0f4", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_3381de92-6649-46bd-8d62-fbdae41c913a", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "04577b82-dff4-4168-8243-191f1f33f0f4", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_0b0c957e-2aa1-4b48-a21f-c86ce817d5c6", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "04577b82-dff4-4168-8243-191f1f33f0f4", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 1024.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [768.0, 0.0], + "range": "height" + }, + { + "name": "color_c44730b2-747d-4786-80a7-b2bc5ff8ce33", + "type": "linear", + "domain": { + "data": "raccoon_8879bbb4-67d6-4f8f-9d20-a2f85ae0f1dc", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_db0dfe8f-7ccb-4a45-adc4-105d3e802371", + "type": "ordinal", + "domain": { + "data": "segmentation_3381de92-6649-46bd-8d62-fbdae41c913a", + "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, 250, 500, 750, 1000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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, 600], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_8879bbb4-67d6-4f8f-9d20-a2f85ae0f1dc" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_c44730b2-747d-4786-80a7-b2bc5ff8ce33", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_3381de92-6649-46bd-8d62-fbdae41c913a" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_db0dfe8f-7ccb-4a45-adc4-105d3e802371", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_db0dfe8f-7ccb-4a45-adc4-105d3e802371", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_0b0c957e-2aa1-4b48-a21f-c86ce817d5c6" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_rotation.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_rotation.json new file mode 100644 index 00000000..636307da --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_rotation.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "f5246c9c-3a82-4b73-88e9-7863b25e5934", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_82f89d13-9739-4973-9e55-a0266747cd64", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "f5246c9c-3a82-4b73-88e9-7863b25e5934", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_01477de2-22ed-4581-a94b-2821c7752c32", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "f5246c9c-3a82-4b73-88e9-7863b25e5934", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_333d0e86-d882-4861-9a49-4e59dd2d08b4", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "f5246c9c-3a82-4b73-88e9-7863b25e5934", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [-383.99999999999994, 1024.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [1177.107510106449, 0.0], + "range": "height" + }, + { + "name": "color_56e90c1c-9486-41d4-be66-e9a0b9e9e369", + "type": "linear", + "domain": { + "data": "raccoon_82f89d13-9739-4973-9e55-a0266747cd64", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_d2ed052a-3505-48a4-8bb0-7713bea31d07", + "type": "ordinal", + "domain": { + "data": "segmentation_01477de2-22ed-4581-a94b-2821c7752c32", + "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, 500, 1000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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, 600, 800, 1000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_82f89d13-9739-4973-9e55-a0266747cd64" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_56e90c1c-9486-41d4-be66-e9a0b9e9e369", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_01477de2-22ed-4581-a94b-2821c7752c32" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_d2ed052a-3505-48a4-8bb0-7713bea31d07", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_d2ed052a-3505-48a4-8bb0-7713bea31d07", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_333d0e86-d882-4861-9a49-4e59dd2d08b4" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_scale.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_scale.json new file mode 100644 index 00000000..0299ea22 --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_scale.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "d5405acd-617c-4caf-b56e-7d2b74d9ec5f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_6e9d0e98-9fde-4ddc-85bd-30276a2493ed", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "d5405acd-617c-4caf-b56e-7d2b74d9ec5f", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_4b1a989a-4667-4f47-b10f-24dc8e1c075d", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "d5405acd-617c-4caf-b56e-7d2b74d9ec5f", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_cc846c7b-4b49-43f5-bbc4-2ec8fe0b552f", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "d5405acd-617c-4caf-b56e-7d2b74d9ec5f", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 2048.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [768.0, 0.0], + "range": "height" + }, + { + "name": "color_7a0d83bf-c20d-41f4-b910-a3bb2c7a87e8", + "type": "linear", + "domain": { + "data": "raccoon_6e9d0e98-9fde-4ddc-85bd-30276a2493ed", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_d5cd3fd0-445b-44a2-9c57-fac899ef48fd", + "type": "ordinal", + "domain": { + "data": "segmentation_4b1a989a-4667-4f47-b10f-24dc8e1c075d", + "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, 500, 1000, 1500, 2000], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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_image", + "from": { + "data": "raccoon_6e9d0e98-9fde-4ddc-85bd-30276a2493ed" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_7a0d83bf-c20d-41f4-b910-a3bb2c7a87e8", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_4b1a989a-4667-4f47-b10f-24dc8e1c075d" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_d5cd3fd0-445b-44a2-9c57-fac899ef48fd", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_d5cd3fd0-445b-44a2-9c57-fac899ef48fd", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_cc846c7b-4b49-43f5-bbc4-2ec8fe0b552f" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_split.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_split.json new file mode 100644 index 00000000..8608f2b8 --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_split.json @@ -0,0 +1,551 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 240.0, + "width": 960.0, + "padding": { + "left": 172.79999999999998, + "top": 21.599999999999994, + "right": 38.400000000000034, + "bottom": 48.0 + }, + "data": [ + { + "name": "df9598d8-afd5-4894-9861-f7eb80a933e7", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_7c49b534-d7a1-437e-ba04-1ed12e3d630d", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "df9598d8-afd5-4894-9861-f7eb80a933e7", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 172.79999999999998 + }, + "y": { + "value": 24.21176470588234 + }, + "width": { + "value": 220.23529411764707 + }, + "height": { + "value": 165.1764705882353 + } + } + }, + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [0.0, 1024.0], + "range": "width" + }, + { + "name": "Y_scale_0", + "type": "linear", + "domain": [768.0, 0.0], + "range": "height" + }, + { + "name": "color_036bcc6a-639e-4386-ab28-b7395316b595", + "type": "linear", + "domain": { + "data": "raccoon_7c49b534-d7a1-437e-ba04-1ed12e3d630d", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "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, 1000], + "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, 600], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_7c49b534-d7a1-437e-ba04-1ed12e3d630d" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_036bcc6a-639e-4386-ab28-b7395316b595", + "value": "value" + } + ] + } + } + }, + { + "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": 262.16764705882355 + }, + "y": { + "value": 5.545098039215674 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 437.08235294117645 + }, + "y": { + "value": 24.211764705882366 + }, + "width": { + "value": 220.23529411764696 + }, + "height": { + "value": 165.17647058823525 + } + } + }, + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 1024.0], + "range": "width" + }, + { + "name": "Y_scale_1", + "type": "linear", + "domain": [768.0, 0.0], + "range": "height" + }, + { + "name": "color_c1a3ee11-db68-4911-81c0-b7d4ebdf88c6", + "type": "ordinal", + "domain": { + "data": "segmentation_1ab6470b-3715-405a-9db9-b7fd34e94c80", + "field": "value" + }, + "range": ["random"] + } + ], + "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, 1000], + "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, 600], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "segmentation_1ab6470b-3715-405a-9db9-b7fd34e94c80" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_c1a3ee11-db68-4911-81c0-b7d4ebdf88c6", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_c1a3ee11-db68-4911-81c0-b7d4ebdf88c6", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "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": 526.4499999999999 + }, + "y": { + "value": 5.545098039215702 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 747.5823529411764 + }, + "y": { + "value": 21.599999999999994 + }, + "width": { + "value": 127.79999999999994 + }, + "height": { + "value": 170.39999999999998 + } + } + }, + "scales": [ + { + "name": "X_scale_2", + "type": "linear", + "domain": [430.0, 760.0], + "range": "width" + }, + { + "name": "Y_scale_2", + "type": "linear", + "domain": [480.0, 40.0], + "range": "height" + } + ], + "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": [500, 600, 700], + "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": [100, 200, 300, 400], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "path", + "from": { + "data": "circles_9a36606a-679e-4367-b617-766dfb899c6f" + }, + "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": "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": 790.7323529411764 + }, + "y": { + "value": 2.933333333333337 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + } + ] +} diff --git a/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_translation.json b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_translation.json new file mode 100644 index 00000000..af1b79f4 --- /dev/null +++ b/tests/_figures_viewconfig/NotebooksTransformations_can_render_transformations_raccoon_translation.json @@ -0,0 +1,270 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "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": "4628ef91-cbfe-417b-ae6e-6d605469189d", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "raccoon_f1a1ba12-56f2-47cc-bd24-ead64ae91543", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "4628ef91-cbfe-417b-ae6e-6d605469189d", + "transform": [ + { + "type": "filter_element", + "expr": "raccoon" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "filter_channel", + "expr": null + } + ] + }, + { + "name": "segmentation_397fb41e-da56-465a-b5c1-423d4392cf43", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "4628ef91-cbfe-417b-ae6e-6d605469189d", + "transform": [ + { + "type": "filter_element", + "expr": "segmentation" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + } + ] + }, + { + "name": "circles_517bf614-b487-4edb-8149-5e7311df1289", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "4628ef91-cbfe-417b-ae6e-6d605469189d", + "transform": [ + { + "type": "filter_element", + "expr": "circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + } + ], + "scales": [ + { + "name": "X_scale", + "type": "linear", + "domain": [0.0, 1524.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [1068.0, 0.0], + "range": "height" + }, + { + "name": "color_2cd13e38-a7b8-487d-8d1e-a598c3debc82", + "type": "linear", + "domain": { + "data": "raccoon_f1a1ba12-56f2-47cc-bd24-ead64ae91543", + "field": "value" + }, + "range": { + "scheme": "viridis", + "count": 256 + } + }, + { + "name": "color_85ded3b0-1c63-4bf5-80bb-e09366134595", + "type": "ordinal", + "domain": { + "data": "segmentation_397fb41e-da56-465a-b5c1-423d4392cf43", + "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, 500, 1000, 1500], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "Arial", + "labelFontSize": 15.555555555555555, + "labelFontStyle": "normal", + "labelFontWeight": "normal", + "ticks": true, + "tickOpacity": 1, + "tickColor": "#000000", + "tickCap": "butt", + "tickWidth": 1.6666666666666667, + "tickSize": 3.888888888888889, + "values": [0, 250, 500, 750, 1000], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "raccoon_f1a1ba12-56f2-47cc-bd24-ead64ae91543" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_2cd13e38-a7b8-487d-8d1e-a598c3debc82", + "value": "value" + } + ] + } + } + }, + { + "type": "raster_label", + "from": { + "data": "segmentation_397fb41e-da56-465a-b5c1-423d4392cf43" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_85ded3b0-1c63-4bf5-80bb-e09366134595", + "value": "value" + } + ], + "fill": [ + { + "scale": "color_85ded3b0-1c63-4bf5-80bb-e09366134595", + "value": "value" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + } + } + }, + { + "type": "path", + "from": { + "data": "circles_517bf614-b487-4edb-8149-5e7311df1289" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Points_alpha_overwrites_opacity_from_color.json b/tests/_figures_viewconfig/Points_alpha_overwrites_opacity_from_color.json new file mode 100644 index 00000000..d6fd437b --- /dev/null +++ b/tests/_figures_viewconfig/Points_alpha_overwrites_opacity_from_color.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "fba8fa33-fd2f-4ab6-86bc-e9fdf8572ff6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_points_a3279e81-af58-4152-8ed8-af03fc465dc6", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "fba8fa33-fd2f-4ab6-86bc-e9fdf8572ff6", + "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_a3279e81-af58-4152-8ed8-af03fc465dc6" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#8080ff" + }, + "fill": { + "value": "#8080ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + } + } + } + ] +} 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..0520d1c1 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_X.json @@ -0,0 +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": "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" + } + }, + { + "name": "befc7bf7-f8c6-45e8-9b1d-dba610466075", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "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" + }, + "source": "3f246bc8-d27a-4987-906a-113fdff9b73a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "befc7bf7-f8c6-45e8-9b1d-dba610466075", + "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_f5977572-cbf6-4633-aa21-4d2e96ba2f21", + "type": "linear", + "domain": { + "data": "blobs_points_d5e914c0-9e9d-4ec0-b492-c43a7e0f256d", + "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_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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..8b837454 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_and_groups.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "f1c997f1-0282-4235-8c21-8520830b4d81", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.extra_feature_cat)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..0a5af779 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_layer.json @@ -0,0 +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": "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" + } + }, + { + "name": "a47c9e4b-cd9c-4994-9377-ec4b84301ff4", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "99002bc0-cf06-4295-bc99-ca9bd71afe2e", + "transform": [ + { + "type": "filter_element", + "expr": "points_table" + }, + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_points_5a7eabd3-fa6a-4a8b-bf45-e8b271619a55", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "99002bc0-cf06-4295-bc99-ca9bd71afe2e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "a47c9e4b-cd9c-4994-9377-ec4b84301ff4", + "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_ad93d6a2-e5bf-438b-8414-39d77febe5ed", + "type": "linear", + "domain": { + "data": "blobs_points_5a7eabd3-fa6a-4a8b-bf45-e8b271619a55", + "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_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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.feature0)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..afb88f71 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_annotate_points_with_table_obs.json @@ -0,0 +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": "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" + } + }, + { + "name": "1ff46703-be53-4b80-95df-f6995a1e9ba5", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "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" + }, + "source": "3d941238-ef1f-418a-ac2d-326512b5a3f1", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "1ff46703-be53-4b80-95df-f6995a1e9ba5", + "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_5b8d274a-67ce-47ae-bd71-39ad784ce0bc", + "type": "linear", + "domain": { + "data": "blobs_points_46d740f2-95d8-481c-b0d9-1109b1514765", + "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_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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 10 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.extra_feature)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Points_can_color_by_color_name.json b/tests/_figures_viewconfig/Points_can_color_by_color_name.json new file mode 100644 index 00000000..b478b3ac --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_color_by_color_name.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e659d717-0c6b-4826-87eb-517297667c35", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_points_5cea07d8-3bdc-4623-9b60-49325832a913", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "e659d717-0c6b-4826-87eb-517297667c35", + "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_5cea07d8-3bdc-4623-9b60-49325832a913" + }, + "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" + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Points_can_color_by_hex.json b/tests/_figures_viewconfig/Points_can_color_by_hex.json new file mode 100644 index 00000000..b922cfcd --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_color_by_hex.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "e28a9607-191b-44e3-9aa2-d34c94383727", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_points_67af9c74-cf2d-4036-b850-87f0de5cff29", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "e28a9607-191b-44e3-9aa2-d34c94383727", + "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_67af9c74-cf2d-4036-b850-87f0de5cff29" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#88a136" + }, + "fill": { + "value": "#88a136" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Points_can_color_by_hex_with_alpha.json b/tests/_figures_viewconfig/Points_can_color_by_hex_with_alpha.json new file mode 100644 index 00000000..30b755dd --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_color_by_hex_with_alpha.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "c26bc9af-9805-4ec9-a7c5-5b879867ef74", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_points_0f6b4f09-82a8-43c2-ad7c-0d1aab88dbe8", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "c26bc9af-9805-4ec9-a7c5-5b879867ef74", + "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_0f6b4f09-82a8-43c2-ad7c-0d1aab88dbe8" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#88a136" + }, + "fill": { + "value": "#88a136" + }, + "fillOpacity": { + "value": 0.5333333333333333 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Points_can_color_by_rgb_array.json b/tests/_figures_viewconfig/Points_can_color_by_rgb_array.json new file mode 100644 index 00000000..08fe3bdd --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_color_by_rgb_array.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "165f1aa3-c5c3-472e-81c7-8e80e893e09f", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_points_9d169a52-bedc-4616-9190-19b1b5dcb9d9", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "165f1aa3-c5c3-472e-81c7-8e80e893e09f", + "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_9d169a52-bedc-4616-9190-19b1b5dcb9d9" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#8080ff" + }, + "fill": { + "value": "#8080ff" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Points_can_color_by_rgba_array.json b/tests/_figures_viewconfig/Points_can_color_by_rgba_array.json new file mode 100644 index 00000000..c54a1533 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_color_by_rgba_array.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2da0c8cb-1283-45ee-a10e-b5ebf805914a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_points_b6d6ea79-f0dc-4fb9-9bff-59b021e6816d", + "format": { + "type": "PointsFormatV02", + "version": "0.2" + }, + "source": "2da0c8cb-1283-45ee-a10e-b5ebf805914a", + "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_b6d6ea79-f0dc-4fb9-9bff-59b021e6816d" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#8080ff" + }, + "fill": { + "value": "#8080ff" + }, + "fillOpacity": { + "value": 0.5019607843137255 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + } + } + } + ] +} 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..ef69d5ad --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_filter_with_groups_custom_palette.json @@ -0,0 +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 + }, + "data": [ + { + "name": "be571835-0411-46c4-821e-b5203f52b7ba", + "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" + }, + "source": "be571835-0411-46c4-821e-b5203f52b7ba", + "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 + }, + "width": { + "value": 113.45454545454545 + }, + "height": { + "value": 112.78189004671219 + } + } + }, + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "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" + }, + "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 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 94.0090549766439 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 112.78189004671218 + } + } + }, + "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" + }, + { + "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" + }, + "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" + } + ] + } + } + }, + { + "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" + } + } + }, + "zindex": 3 + } + ] + } + ] +} 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..092f9da0 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_filter_with_groups_default_palette.json @@ -0,0 +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 + }, + "data": [ + { + "name": "aa47f50c-0a7d-420a-9b21-0c24df85042f", + "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" + }, + "source": "aa47f50c-0a7d-420a-9b21-0c24df85042f", + "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 + }, + "width": { + "value": 113.45454545454545 + }, + "height": { + "value": 112.78189004671219 + } + } + }, + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [3.0, 509.0], + "range": "width" + }, + { + "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" + }, + "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 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 94.0090549766439 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 112.78189004671218 + } + } + }, + "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" + }, + { + "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" + }, + "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" + } + ] + } + } + }, + { + "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" + } + } + }, + "zindex": 3 + } + ] + } + ] +} 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..52b87aed --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_render_points.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_068027f8-b0ff-47de-834a-6dc306f1674f", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "16a3d04e-4014-4fcf-9320-f201516f7866", + "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_068027f8-b0ff-47de-834a-6dc306f1674f" + }, + "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" + } + } + } + } + ] +} 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..6fd863b5 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_stack_render_points.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": "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" + } + }, + { + "name": "blobs_points_de2155f4-c647-473b-bf40-dbdb7784be5b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "322e8e79-82b9-40f3-a65d-013d13a92692", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_points_4d57b93c-6c4d-4766-907b-dedfc800e048", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "322e8e79-82b9-40f3-a65d-013d13a92692", + "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_de2155f4-c647-473b-bf40-dbdb7784be5b" + }, + "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" + }, + "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" + } + } + } + } + ] +} 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..58cc3510 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_use_norm_with_clip.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_abae57c5-0a4c-4f0d-97a3-3cafcfd1ce26", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "83135f09-a388-4622-8cf9-de7306cab9ad", + "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": "72384dc8-4c10-4402-88a9-0761e73a8555" + } + ] + } + ], + "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" + }, + "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_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" + } + }, + "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" + } + ] + } + } + } + ] +} 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..39824162 --- /dev/null +++ b/tests/_figures_viewconfig/Points_can_use_norm_without_clip.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_9e4f57d8-7506-438f-af2b-cb6c07403a4b", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "fba62948-61fb-4b42-9ede-7e38dab8a46e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "formula", + "expr": "(datum.value - 3.0) / (7.0 - 3.0)", + "as": "d2cc8577-63fd-4327-9594-e8e9a7a98fcd" + } + ] + } + ], + "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" + }, + "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_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" + } + }, + "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" + } + ] + } + } + } + ] +} 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..5c67b4eb --- /dev/null +++ b/tests/_figures_viewconfig/Points_color_recognises_actual_color_as_color.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_593211b0-ae6e-41d9-8b26-bbe9c6c46580", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "42b205fa-d6e0-44a8-85a3-25acbf52aa9e", + "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_593211b0-ae6e-41d9-8b26-bbe9c6c46580" + }, + "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" + } + } + } + } + ] +} 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..f533cd8f --- /dev/null +++ b/tests/_figures_viewconfig/Points_coloring_with_cmap.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_0931a066-1c38-453c-a1e1-80dbea88b4c0", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "75b59781-1162-4506-bd17-98b42267e110", + "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" + }, + "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" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..b552ed8f --- /dev/null +++ b/tests/_figures_viewconfig/Points_coloring_with_palette.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_041bdafa-2c77-4fa9-9ace-34ef4c3f856c", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "7f7bba57-d695-4be7-abbb-7c35c6749d96", + "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" + }, + "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" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..8a2dc1fd --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_color_by_category.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_97f7724d-b13b-4239-a028-9f60474b7103", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "39c3e105-9059-4e61-8e84-f248c21a9b4c", + "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_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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 20 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..f614c025 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_transform_points.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_a51f2137-2eee-43cb-b5cb-58ed1bf4e42d", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "391aff9d-0c22-4df0-bfb3-1fb464031f39", + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "value": "#000000" + }, + "fill": { + "value": "#000000" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 5 + }, + "shape": { + "value": "circle" + } + } + } + } + ] +} 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..e5739ef2 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_any_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_72899df1-8d1f-46ed-92d3-de89569a6dc6", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_08e89279-7627-4b17-99b2-4ba6ce3f5db9", + "value": "instance_id" + }, + "fill": { + "scale": "color_08e89279-7627-4b17-99b2-4ba6ce3f5db9", + "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" + } + ] + } + } + } + ] +} 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..0408dd47 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_count_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_0e72a2ad-b47b-49b9-924b-33912c46dd26", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_9b5890e1-98c2-49e7-acbe-5f71c7194e50", + "value": "instance_id" + }, + "fill": { + "scale": "color_9b5890e1-98c2-49e7-acbe-5f71c7194e50", + "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" + } + ] + } + } + } + ] +} 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..c5fc2dec --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_max_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_79d47228-ce3d-494c-b4a3-5921042c4a78", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_4a15eeb1-67a6-4e6f-9e98-cca461d6145f", + "value": "instance_id" + }, + "fill": { + "scale": "color_4a15eeb1-67a6-4e6f-9e98-cca461d6145f", + "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" + } + ] + } + } + } + ] +} 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..12954ab2 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_mean_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_d5dbde4c-0908-4d4e-b664-71b63d826eda", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_af1e1a93-61be-4075-824e-1b1db514fedc", + "value": "instance_id" + }, + "fill": { + "scale": "color_af1e1a93-61be-4075-824e-1b1db514fedc", + "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" + } + ] + } + } + } + ] +} 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..d17017bd --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_min_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_f08a9f2d-4d95-4f6d-8b9e-9205a90c33d4", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_d9594b35-beb3-4e9d-b089-f781823af0f0", + "value": "instance_id" + }, + "fill": { + "scale": "color_d9594b35-beb3-4e9d-b089-f781823af0f0", + "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" + } + ] + } + } + } + ] +} 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..d093cb5e --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_norm_with_clip.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_caa80dcf-c5a8-48b1-9b62-df5d2a8fd045", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_8c41861f-9c05-4631-8986-30e531f70ef7", + "value": "instance_id" + }, + "fill": { + "scale": "color_8c41861f-9c05-4631-8986-30e531f70ef7", + "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" + } + ] + } + } + } + ] +} 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..d2283551 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_norm_without_clip.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_eb0858ef-d6c9-4eb9-9bd3-608738c6605b", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_b45a82ef-6e7e-4dec-b140-1a4042f3f254", + "value": "instance_id" + }, + "fill": { + "scale": "color_b45a82ef-6e7e-4dec-b140-1a4042f3f254", + "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" + } + ] + } + } + } + ] +} 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..96e3c2ee --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_b59d28b9-5a05-4fb7-b4f5-9af8f671b296", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_715a81ad-2dae-45de-85e1-bb885e8c054d", + "value": "instance_id" + }, + "fill": { + "scale": "color_715a81ad-2dae-45de-85e1-bb885e8c054d", + "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" + } + ] + } + } + } + ] +} 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..8e8d7159 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_std_as_reduction_not_all_zero.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_8bda3e59-c139-4d6c-8786-2bf109593561", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_abb335ce-a709-40a3-bc6a-baf71fe2fc1c", + "value": "instance_id" + }, + "fill": { + "scale": "color_abb335ce-a709-40a3-bc6a-baf71fe2fc1c", + "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" + } + ] + } + } + } + ] +} 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..51298710 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_sum_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_e423810c-57f3-44c0-a114-e6726f586e8a", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_4d90dfe4-5b0f-48af-9fd8-c3b1d7ee67ea", + "value": "instance_id" + }, + "fill": { + "scale": "color_4d90dfe4-5b0f-48af-9fd8-c3b1d7ee67ea", + "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" + } + ] + } + } + } + ] +} 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..eca702a2 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_can_use_var_as_reduction.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_b04a7fec-6777-494a-94af-e53eaa5d1fd9", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_9f365982-e562-466d-b5af-974151f3a43f", + "value": "instance_id" + }, + "fill": { + "scale": "color_9f365982-e562-466d-b5af-974151f3a43f", + "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" + } + ] + } + } + } + ] +} 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..791ee699 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_continuous_color.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_327cfd41-64ea-418c-880c-cc8955f3d012", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_a1e5e814-22be-45ad-96f1-dc7aa92405b1", + "value": "instance_id" + }, + "fill": { + "scale": "color_a1e5e814-22be-45ad-96f1-dc7aa92405b1", + "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" + } + ] + } + } + } + ] +} 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..979856e7 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_matplotlib_stack.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "0c4d7f4f-d8a5-4e1e-9fd6-7e03653c4734", + "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" + }, + "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_067ee6b1-fcaa-4293-8a0b-968ad5d1973b" + }, + "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" + } + } + } + } + ] +} 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..f2632200 --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_with_clip.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_12113b8a-3a83-456f-b868-6449fefa3968", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_f973207b-2ebc-4c48-a350-823e431c1cf7", + "value": "instance_id" + }, + "fill": { + "scale": "color_f973207b-2ebc-4c48-a350-823e431c1cf7", + "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" + } + ] + } + } + } + ] +} 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..b10947ff --- /dev/null +++ b/tests/_figures_viewconfig/Points_datashader_norm_vmin_eq_vmax_without_clip.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_7bb6e31a-168c-4322-964e-9ccb5e8db60c", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_f2455f8a-9f44-4086-9e7a-e6c82613d3a9", + "value": "instance_id" + }, + "fill": { + "scale": "color_f2455f8a-9f44-4086-9e7a-e6c82613d3a9", + "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" + } + ] + } + } + } + ] +} 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..89f1c1c7 --- /dev/null +++ b/tests/_figures_viewconfig/Points_mpl_and_datashader_point_sizes_agree_after_altered_dpi.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_ba437bf3-0521-4f38-b9dd-1d1514662548", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "c7e50577-ac41-4f0f-8c55-6595f68feec5", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_points_faa8c9bf-7905-408d-ac52-c2bb3499a36f", + "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"] + }, + { + "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" + }, + "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_faa8c9bf-7905-408d-ac52-c2bb3499a36f" + }, + "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" + } + } + } + } + ] +} 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..bbef138d --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_categorical_color.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "91878c28-e876-4094-8fcc-8f017ff357d2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..e2f102b1 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_categorical_color_column_datashader.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_598650b0-9873-41ef-9ffc-5e5bcd961b1e", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "c45d84d6-45de-4d8a-906e-fb15f30e849c", + "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_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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..697b9349 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_categorical_color_column_matplotlib.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_36c064a2-e752-4ea2-aa45-1257b9719153", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "10988ceb-98e9-4f84-bfaf-f6f8b6c850d3", + "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" + }, + "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" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.genes)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..dc8ef6ab --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_coercable_categorical_color.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "d101f387-af84-4b81-99ce-a3badc823f1a", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_points" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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" + }, + "fillOpacity": { + "value": 1.0 + }, + "size": { + "value": 1.0 + }, + "shape": { + "value": "circle" + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..d72a27c1 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_continuous_color_column_datashader.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_018564f6-057f-46a8-a52b-9086e75d9284", + "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"] + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "stroke": { + "scale": "color_d48ef410-fc8a-43c6-8999-d4a6e8da5b00", + "value": "instance_id" + }, + "fill": { + "scale": "color_d48ef410-fc8a-43c6-8999-d4a6e8da5b00", + "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" + } + ] + } + } + } + ] +} 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..3c17c1a3 --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_continuous_color_column_matplotlib.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_points_d0a641ed-3f0e-441f-8f2c-a96622ff28e8", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "08b1b9cb-2915-4321-85c9-b38344623c08", + "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_72541271-1cee-4f59-903a-2aa0e38bfe96", + "type": "linear", + "domain": { + "data": "blobs_points_d0a641ed-3f0e-441f-8f2c-a96622ff28e8", + "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_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" + }, + "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" + } + ] + } + } + } + ] +} 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..b9aa77db --- /dev/null +++ b/tests/_figures_viewconfig/Points_points_transformed_ds_agrees_with_mpl.json @@ -0,0 +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": "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" + } + }, + { + "name": "points1_2355f2a3-ebeb-476b-a52a-ae94b43ae962", + "format": { + "type": "PointsFormatV01", + "version": "0.1" + }, + "source": "cd447067-24c2-4f8a-8eb3-3c88e8442c58", + "transform": [ + { + "type": "filter_element", + "expr": "points1" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "points1_e2f780ff-20e8-4e3e-be7f-abc949020e14", + "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"] + }, + { + "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" + }, + "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_e2f780ff-20e8-4e3e-be7f-abc949020e14" + }, + "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" + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_alpha_overwrites_opacity_from_color.json b/tests/_figures_viewconfig/Shapes_alpha_overwrites_opacity_from_color.json new file mode 100644 index 00000000..ff9c3910 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_alpha_overwrites_opacity_from_color.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "eb1c4651-03ea-47c2-b852-898176e49807", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_cbd0f2a0-f163-4e4c-bf0f-c00a91e302fb", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "eb1c4651-03ea-47c2-b852-898176e49807", + "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_cbd0f2a0-f163-4e4c-bf0f-c00a91e302fb" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#8080ff" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ] +} 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..99fbdf9d --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_annotate_shapes_with_table_layer.json @@ -0,0 +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": "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" + } + }, + { + "name": "e503ab70-9515-42d3-846f-4c480f066903", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "4fa14607-0505-4772-bfc0-7711dece0336", + "transform": [ + { + "type": "filter_element", + "expr": "circle_table" + }, + { + "type": "filter_layer", + "expr": "normalized" + } + ] + }, + { + "name": "blobs_circles_3abbf654-22fc-4fc6-9ae7-cd3f4e4f5c37", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "4fa14607-0505-4772-bfc0-7711dece0336", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "e503ab70-9515-42d3-846f-4c480f066903", + "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_cd9b06e5-cab1-400e-9c14-6b4ff91b60b8", + "type": "linear", + "domain": { + "data": "blobs_circles_3abbf654-22fc-4fc6-9ae7-cd3f4e4f5c37", + "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_cd9b06e5-cab1-400e-9c14-6b4ff91b60b8", + "fillColor": "#ffffff", + "gradientLength": 243.2, + "gradientOpacity": null, + "gradientThickness": 8.106666666666662, + "gradientStrokeColor": "#000000", + "gradientStrokeWidth": 0.8888888888888888, + "values": [0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8], + "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" + }, + "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" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_by_category_with_cmap.json b/tests/_figures_viewconfig/Shapes_can_color_by_category_with_cmap.json new file mode 100644 index 00000000..56714a1d --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_by_category_with_cmap.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "62a8715e-9bc7-4e9c-8631-15868fb0c658", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "f2a31ef8-4927-4a82-b46e-bdcf34f51fe4", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "62a8715e-9bc7-4e9c-8631-15868fb0c658", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_bc9cad6c-d3cf-41dd-9db8-da66ef37a72d", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "62a8715e-9bc7-4e9c-8631-15868fb0c658", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "f2a31ef8-4927-4a82-b46e-bdcf34f51fe4", + "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_2d9831c7-0707-49d3-ab25-b02b63eb4a49", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#00ffff", "#807fff", "#ff00ff"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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_2d9831c7-0707-49d3-ab25-b02b63eb4a49", + "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_bc9cad6c-d3cf-41dd-9db8-da66ef37a72d" + }, + "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_2d9831c7-0707-49d3-ab25-b02b63eb4a49", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_by_color_name.json b/tests/_figures_viewconfig/Shapes_can_color_by_color_name.json new file mode 100644 index 00000000..bcce58d4 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_by_color_name.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "f504fb01-566a-443a-90c4-4b9e323044e4", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_fd4a1d0a-50a2-49b8-8ed8-411e4bcd2b72", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "f504fb01-566a-443a-90c4-4b9e323044e4", + "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_fd4a1d0a-50a2-49b8-8ed8-411e4bcd2b72" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_by_hex.json b/tests/_figures_viewconfig/Shapes_can_color_by_hex.json new file mode 100644 index 00000000..7a52353d --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_by_hex.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "3f466051-9135-46fd-bbdb-7c9bd7e4e75c", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_1abc64fe-d8cd-406f-a229-6d21cf2f468e", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "3f466051-9135-46fd-bbdb-7c9bd7e4e75c", + "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_1abc64fe-d8cd-406f-a229-6d21cf2f468e" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#88a136" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_by_hex_with_alpha.json b/tests/_figures_viewconfig/Shapes_can_color_by_hex_with_alpha.json new file mode 100644 index 00000000..1330b4b3 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_by_hex_with_alpha.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "44b52c42-a377-4ea9-91b5-d165cdb9cbc0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_e324f101-3a5c-43b1-9d02-dfb5bc3e49d4", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "44b52c42-a377-4ea9-91b5-d165cdb9cbc0", + "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_e324f101-3a5c-43b1-9d02-dfb5bc3e49d4" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#88a136" + }, + "fillOpacity": { + "value": 0.5333333333333333 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_by_rgb_array.json b/tests/_figures_viewconfig/Shapes_can_color_by_rgb_array.json new file mode 100644 index 00000000..4bacc623 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_by_rgb_array.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7bb120a9-c1e7-46e8-a452-99a79b9933cb", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_262bce98-f872-4682-bb61-9e9600c10a9f", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "7bb120a9-c1e7-46e8-a452-99a79b9933cb", + "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_262bce98-f872-4682-bb61-9e9600c10a9f" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#8080ff" + }, + "fillOpacity": { + "value": 1.0 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_color_by_rgba_array.json b/tests/_figures_viewconfig/Shapes_can_color_by_rgba_array.json new file mode 100644 index 00000000..3a66f890 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_by_rgba_array.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1652d83a-1646-4d32-9777-fd65518b3af8", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_e8110c37-63c1-4c51-b133-56ab42ec863a", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "1652d83a-1646-4d32-9777-fd65518b3af8", + "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_e8110c37-63c1-4c51-b133-56ab42ec863a" + }, + "zindex": 0, + "encode": { + "enter": { + "x": { + "scale": "X_scale", + "field": "x" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "value": "#8080ff" + }, + "fillOpacity": { + "value": 0.5019607843137255 + } + } + } + } + ] +} 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..c33e62cd --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_from_geodataframe.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": "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" + } + }, + { + "name": "blobs_polygons_0dd8ebf1-45df-48e7-ab67-50e27324c1b9", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7184d547-7537-424f-95e7-68fd7eadd421", + "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_d4fdda4d-9f6e-4cfc-9213-0d7bb37d7e0a", + "type": "linear", + "domain": { + "data": "blobs_polygons_0dd8ebf1-45df-48e7-ab67-50e27324c1b9", + "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_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" + }, + "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" + } + ] + } + } + } + ] +} 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..fe9aab26 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_two_queried_shapes_elements_by_annotation.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "860c9c99-e548-4cb8-a0f6-5f63dcce1297", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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 + }, + "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" + }, + "source": "860c9c99-e548-4cb8-a0f6-5f63dcce1297", + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_debcc46b-57ad-4123-8e2a-932bcb288e74", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_4cda9c5b-0d06-4923-acef-af217cd59ccd" + }, + "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" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..be3d33af --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_two_shapes_elements_by_annotation.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "823e8f26-12b1-41d3-90f0-2eeb58eebe60", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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 + }, + "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" + }, + "source": "823e8f26-12b1-41d3-90f0-2eeb58eebe60", + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_1daa0749-14b3-4cf2-aaa4-2278ce43b9c4", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + }, + { + "type": "path", + "from": { + "data": "blobs_polygons_a8aa5f0f-90d6-4c6d-afd9-f28b6e1a0e58" + }, + "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" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..b4808455 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_color_with_norm_no_clipping.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": "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" + } + }, + { + "name": "blobs_polygons_f0419e07-6c30-4ef1-99d3-289cfc3b2ecf", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "2a3cb7b1-ae0f-4435-b36a-4c5b7e1e2579", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "formula", + "expr": "(datum.value - 2.0) / (4.0 - 2.0)", + "as": "e39f14f1-78f5-4c84-9bf0-4d7796f84ecd" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.0", + "value": "#000000" + }, + { + "test": "datum.value) > 4.0", + "value": "#808080" + } + ] + } + } + } + ] +} 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..6994d8a9 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_do_non_matching_table.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "f7e084fd-3650-4f18-9cab-ec5634ac6fe2", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "fc701dbc-28d3-4673-bec9-35a86f476cbf", + "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_e9d0949f-f688-487a-b122-cb6d631417fa", + "type": "linear", + "domain": { + "data": "blobs_circles_4293ab8e-4a91-43ef-978f-1bcb19b179a1", + "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_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" + }, + "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" + } + ] + } + } + } + ] +} 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..6bf19885 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_filter_with_groups.json @@ -0,0 +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 + }, + "data": [ + { + "name": "72fc6b78-316c-4cd4-9ae2-5e4dc9b07979", + "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" + }, + "source": "72fc6b78-316c-4cd4-9ae2-5e4dc9b07979", + "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 + }, + "height": { + "value": 104.45244628620298 + } + } + }, + "scales": [ + { + "name": "X_scale_0", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "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" + }, + "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 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 98.17377685689851 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 104.45244628620294 + } + } + }, + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [149.92618678876784, 446.7026437060826], + "range": "width" + }, + { + "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" + }, + "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" + } + ] + } + } + }, + { + "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" + } + } + }, + "zindex": 3 + } + ] + } + ] +} 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..00072bf1 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_plot_queried_with_annotation_despite_random_shuffling.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "94f41227-c5d8-490f-9afe-9650280ab6cd", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_7e7b1875-9e01-45bd-8579-6fc3330e79e7", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..4efdca57 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_plot_shapes_after_spatial_query.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": "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" + } + }, + { + "name": "blobs_circles_621900c2-f2e6-448a-8529-4f92b797c3d1", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "5652de7d-1817-482e-8b8b-721289caa0de", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_ceef1ab4-13ee-4ab0-b99d-a3b92cb03de8", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "5652de7d-1817-482e-8b8b-721289caa0de", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_multipolygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_e4e76c97-9ecb-4a43-9a85-dc00daf0bc01", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "5652de7d-1817-482e-8b8b-721289caa0de", + "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_621900c2-f2e6-448a-8529-4f92b797c3d1" + }, + "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" + }, + "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" + }, + "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 + } + } + } + } + ] +} 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..7128f2b7 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_plot_with_annotation_despite_random_shuffling.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "d5fc7e04-2c9b-4313-a09d-e9ada3250913", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_0c7645fe-1040-44a2-b3f7-dce2e5d92dc8", + "field": "annotation" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.annotation)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..7e9160b8 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_0a1d45c9-9c20-4284-ae4f-62f60350d438", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "64392ed5-5d6f-4324-b478-c5b8a42f06bd", + "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_0a1d45c9-9c20-4284-ae4f-62f60350d438" + }, + "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 + } + } + } + } + ] +} 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..c5db4cf5 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_colored_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_453d6097-05e4-434d-9e4d-29814ac41c99", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f931a23b-9b22-4742-b057-e21ebaa371cb", + "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_453d6097-05e4-434d-9e4d-29814ac41c99" + }, + "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 + } + } + } + } + ] +} 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..7c355e9b --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_6911550f-81a9-4062-88b8-2f9fd5d64cc7", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "f9232b10-c4b7-4aba-b42c-2c7bf71c071e", + "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_6911550f-81a9-4062-88b8-2f9fd5d64cc7" + }, + "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 + } + } + } + } + ] +} 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..b7c77247 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_circles_with_specified_outline_width.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_09e9d7df-9d6c-4d4f-9624-2761c6ef591a", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "495ddb74-da1d-4880-8055-416758e5f733", + "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_09e9d7df-9d6c-4d4f-9624-2761c6ef591a" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_double_outline_with_diff_alpha.json b/tests/_figures_viewconfig/Shapes_can_render_double_outline_with_diff_alpha.json new file mode 100644 index 00000000..696c05c9 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_double_outline_with_diff_alpha.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7c67a39b-727c-4796-86b4-e02dbab5423a", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_c6d724b5-0444-42f5-8b34-dcbe6d7d3dc0", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "7c67a39b-727c-4796-86b4-e02dbab5423a", + "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_c6d724b5-0444-42f5-8b34-dcbe6d7d3dc0" + }, + "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": 20 + }, + "strokeOpacity": { + "value": [0.7, 0.3] + } + } + } + } + ] +} 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..dd562740 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_empty_geometry.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": "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" + } + }, + { + "name": "blobs_circles_21310b5b-0829-42e6-83cc-d1e04cc1ea45", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "d33d4957-9736-4833-b989-cf8b7fc4d1af", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_f2753726-8480-48a2-8128-2a033914cf21", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "d33d4957-9736-4833-b989-cf8b7fc4d1af", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_multipolygons_7b6cbd3f-a715-421d-88f7-5f2771ece230", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "d33d4957-9736-4833-b989-cf8b7fc4d1af", + "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_21310b5b-0829-42e6-83cc-d1e04cc1ea45" + }, + "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" + }, + "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" + }, + "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 + } + } + } + } + ] +} 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..582c95e1 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_multipolygons.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "0103c8fb-7e5b-4bf6-bdc9-52bad05bb6bf", + "transform": [ + { + "type": "filter_element", + "expr": "p" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "2d3f5016-5406-446f-84ea-6d35e7cd4245", + "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_c9fea7cc-7948-413f-a149-aac91d283e6a", + "type": "linear", + "domain": { + "data": "p_7bd3b270-04bb-403f-8994-1cc67128287f", + "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_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" + }, + "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" + } + ] + } + } + } + ] +} 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..d9c3f318 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_a5612389-e389-42fa-8027-99408c1baa93", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "b1520c0b-20fd-48f7-9378-6ab07e8aa69d", + "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_a5612389-e389-42fa-8027-99408c1baa93" + }, + "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 + } + } + } + } + ] +} 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..858dc31a --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_272da12d-ed18-431a-857a-9a565983c174", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "a261c3b4-1242-4a11-9a74-fc4899ff5390", + "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_272da12d-ed18-431a-857a-9a565983c174" + }, + "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 + } + } + } + } + ] +} 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..e9ea3bd3 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgb_colored_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_46b084f1-186b-4dd6-bf7d-1cceaf4d291f", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "56b1c3d9-a463-46ae-87bf-0b11e89ac29c", + "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_46b084f1-186b-4dd6-bf7d-1cceaf4d291f" + }, + "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 + } + } + } + } + ] +} 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..ae466acd --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_rgba_colored_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_f6c3addd-f7a6-484d-8811-0bcfb4a1c62e", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "a5d6e82e-04c0-4ca9-94c9-2870e2ac79cd", + "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_f6c3addd-f7a6-484d-8811-0bcfb4a1c62e" + }, + "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 + } + } + } + } + ] +} 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..a7da3f95 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_polygons_with_str_colored_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_0b1c99e5-289c-4a78-8c45-4e212f029a6d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "e9179e58-af36-4f2c-89ad-c357091a1177", + "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_0b1c99e5-289c-4a78-8c45-4e212f029a6d" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_shapes_with_colored_double_outline.json b/tests/_figures_viewconfig/Shapes_can_render_shapes_with_colored_double_outline.json new file mode 100644 index 00000000..fe86e005 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_shapes_with_colored_double_outline.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "45a8afd8-f86b-4926-a2b4-27349e95752d", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_polygons_ad286b2e-c1ee-4311-a92b-947a616b1c35", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "45a8afd8-f86b-4926-a2b4-27349e95752d", + "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_ad286b2e-c1ee-4311-a92b-947a616b1c35" + }, + "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": "#800080" + }, + "strokeWidth": { + "value": 10.0 + }, + "strokeOpacity": { + "value": [1.0, 1.0] + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_can_render_shapes_with_double_outline.json b/tests/_figures_viewconfig/Shapes_can_render_shapes_with_double_outline.json new file mode 100644 index 00000000..2d5ba5c5 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_render_shapes_with_double_outline.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "d39f7175-2ba2-4d78-a769-29ea4b8f4b81", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_b37b2c57-04ce-4dbb-beb9-5475407fbf05", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "d39f7175-2ba2-4d78-a769-29ea4b8f4b81", + "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_b37b2c57-04ce-4dbb-beb9-5475407fbf05" + }, + "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": 10.0 + }, + "strokeOpacity": { + "value": [1.0, 1.0] + } + } + } + } + ] +} 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..43d3a365 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_scale_shapes.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_79a03ead-8a1e-4d45-8484-30c11bd22619", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "35e0e259-17c2-4dab-8ec5-20f88163f8ea", + "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_79a03ead-8a1e-4d45-8484-30c11bd22619" + }, + "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 + } + } + } + } + ] +} 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..efc3f72a --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_set_clims_clip.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": "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" + } + }, + { + "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" + }, + "source": "a8952bdc-8218-4963-ac7e-eb937aeae08e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "e23dad2a-8aa1-4ca2-b638-6685a17e3de6", + "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": "98aca771-4e43-46cd-b8c0-2d9ff6e7d2a0" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "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" + } + ] + } + } + } + ] +} 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..184329cc --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_can_stack_render_shapes.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": "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" + } + }, + { + "name": "blobs_circles_1c2fe0a4-d0c6-4510-9eed-1e6e06a32b1a", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "900f1cad-eef1-47c9-adca-4fc4be218e12", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + } + ] + }, + { + "name": "blobs_polygons_2f0f2b50-42bc-4950-b5ca-f888eb8c78dd", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "900f1cad-eef1-47c9-adca-4fc4be218e12", + "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_1c2fe0a4-d0c6-4510-9eed-1e6e06a32b1a" + }, + "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" + }, + "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 + } + } + } + } + ] +} 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..4e74d8a8 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_color_recognises_actual_color_as_color.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_c7572120-628f-4af1-b136-5d279ed38a66", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "3429e0b0-4fa0-4f29-8adc-a99ffbcb5ea2", + "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_c7572120-628f-4af1-b136-5d279ed38a66" + }, + "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 + } + } + } + } + ] +} 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..8506bf88 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_colorbar_can_be_normalised.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": "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" + } + }, + { + "name": "blobs_polygons_3b322654-ac56-4a9b-aa42-b6c053e92ffa", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "9772359c-da78-4e4b-9cae-d07777fc2a94", + "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": "c8a78527-1eb6-4635-aeb5-bbb34dcb9c82" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + }, + { + "test": "datum.cluster) < 0.0", + "value": "#440154" + }, + { + "test": "datum.cluster) > 5.0", + "value": "#fde725" + } + ] + } + } + } + ] +} 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..bc5bfe33 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_colorbar_respects_input_limits.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": "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" + } + }, + { + "name": "blobs_polygons_62db3c7f-ae8d-4b81-97be-20a14c8bdcf6", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "7485b09d-5666-4d7b-b609-784b46695851", + "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_462d560f-14d0-461d-8adb-b0277b62a4d5", + "type": "linear", + "domain": { + "data": "blobs_polygons_62db3c7f-ae8d-4b81-97be-20a14c8bdcf6", + "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_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" + }, + "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" + } + ] + } + } + } + ] +} 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..a898040c --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_coloring_with_palette.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_b236717e-2714-41d2-80f0-b17569413cd2", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "94577357-79ca-4d5f-b39d-7cf089e3bbfd", + "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" + }, + "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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.cluster)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..9455aa7d --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "57a6cef5-6009-45ad-a7b2-4bbed96b9864", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "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 + }, + { + "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" + }, + "y": { + "scale": "Y_scale", + "field": "y" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_7b17704a-9fef-4baf-8a30-dd89df0af53a", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category_with_cmap.json b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category_with_cmap.json new file mode 100644 index 00000000..fa681664 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_category_with_cmap.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "cc8063e4-3e25-49d0-9c4b-bec275bec108", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "3549e460-f03d-48f3-b820-03e78f84d0f1", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "cc8063e4-3e25-49d0-9c4b-bec275bec108", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_polygons_02a77f61-19ea-4076-a5aa-d57a3e870e4b", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "cc8063e4-3e25-49d0-9c4b-bec275bec108", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "lookup", + "from": "3549e460-f03d-48f3-b820-03e78f84d0f1", + "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_0af56fbf-e4e9-43e9-a567-c2ea1ac47421", + "type": "ordinal", + "domain": ["a", "b", "c"], + "range": ["#00ffff", "#807fff", "#ff00ff"] + } + ], + "axes": [ + { + "scale": "X_scale", + "orient": "bottom", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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_0af56fbf-e4e9-43e9-a567-c2ea1ac47421", + "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_02a77f61-19ea-4076-a5aa-d57a3e870e4b" + }, + "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_0af56fbf-e4e9-43e9-a567-c2ea1ac47421", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..ca9213d8 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_identical_value.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": "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" + } + }, + { + "name": "blobs_polygons_c180760c-7703-4f54-b1c1-a28d6d227529", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "40acabdf-b0d8-4ac3-ba9e-2a69537353e4", + "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": "cb0e2809-2118-420b-8d4c-38d3b55cdbb3" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 1.0", + "value": "#440154" + }, + { + "test": "datum.value) > 2.0", + "value": "#fde725" + } + ] + } + } + } + ] +} 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..6a0dd3d5 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_by_value.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": "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" + } + }, + { + "name": "blobs_polygons_5f133ca9-46c2-448b-92b0-0b554e60f8c6", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "ad369602-1798-4d89-8eaf-83efdc7bab96", + "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": "63de657e-10ad-41fe-995b-acd5495468a4" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 1.0", + "value": "#440154" + }, + { + "test": "datum.value) > 20.0", + "value": "#fde725" + } + ] + } + } + } + ] +} 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..dfc0450e --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_and_clipping.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": "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" + } + }, + { + "name": "blobs_polygons_5619ef43-5833-4ebf-9cac-cd068b339722", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "e45341af-3063-4847-b0ab-26727292d9a0", + "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": "85feb21e-65d3-444d-9fb6-2acb7f861f03" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.0", + "value": "#000000" + }, + { + "test": "datum.value) > 4.0", + "value": "#808080" + } + ] + } + } + } + ] +} 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..566f03a2 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_color_with_norm_no_clipping.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": "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" + } + }, + { + "name": "blobs_polygons_ad62d211-faef-4f97-adae-460a757e7ed6", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "e4fe4e6f-b22c-422b-8ee1-825a60dc0a2f", + "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": "790fb368-c8e0-4a3e-bb43-03780ab3c2ea" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.0", + "value": "#000000" + }, + { + "test": "datum.value) > 4.0", + "value": "#808080" + } + ] + } + } + } + ] +} 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..deb7df24 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_colored_shapes.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_8e04de68-c684-47e9-bc32-85d2901cbeb5", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "0f3256da-b552-4640-8e09-9e69c0000a79", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "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" + }, + "source": "0f3256da-b552-4640-8e09-9e69c0000a79", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "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" + }, + "source": "0f3256da-b552-4640-8e09-9e69c0000a79", + "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_8e04de68-c684-47e9-bc32-85d2901cbeb5" + }, + "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_c4cfd430-6433-4079-855f-a31503e97dd8" + }, + "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" + }, + "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 + } + } + } + } + ] +} 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..2c971964 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_b7e8cb8e-74e1-4fa0-a44e-6b83bafca479", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "ae0b83c5-5c80-4d2f-a13d-21538d177a64", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "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" + }, + "source": "ae0b83c5-5c80-4d2f-a13d-21538d177a64", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "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" + }, + "source": "ae0b83c5-5c80-4d2f-a13d-21538d177a64", + "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_b7e8cb8e-74e1-4fa0-a44e-6b83bafca479" + }, + "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_b69df1e7-71dd-42fd-84e6-c218820b05e5" + }, + "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" + }, + "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 + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes_with_colored_double_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes_with_colored_double_outline.json new file mode 100644 index 00000000..7b68472f --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes_with_colored_double_outline.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2ce0fe69-4a94-4bdd-8486-1aee31792180", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_polygons_cfb6939a-35ca-4cb5-a624-e24394d94e5a", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "2ce0fe69-4a94-4bdd-8486-1aee31792180", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["sum"], + "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_cfb6939a-35ca-4cb5-a624-e24394d94e5a" + }, + "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": "#800080" + }, + "strokeWidth": { + "value": 10.0 + }, + "strokeOpacity": { + "value": [1.0, 1.0] + } + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes_with_double_outline.json b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes_with_double_outline.json new file mode 100644 index 00000000..cdeaae82 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_shapes_with_double_outline.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "7b3b385d-1ab0-4905-971d-215e47c3d4ab", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_24771f98-f734-4dad-814b-7fb5b501707c", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "7b3b385d-1ab0-4905-971d-215e47c3d4ab", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "aggregate", + "field": ["*"], + "ops": ["sum"], + "as": ["count"] + } + ] + } + ], + "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_24771f98-f734-4dad-814b-7fb5b501707c" + }, + "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": 10.0 + }, + "strokeOpacity": { + "value": [1.0, 1.0] + } + } + } + } + ] +} 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..18e5b09e --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_colored_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_b56eaf39-66fa-4dd9-995c-946fdad280ce", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "2bba079c-e1e6-4aad-be0e-238a74d44064", + "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" + }, + "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 + } + } + } + } + ] +} 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..ab6c9389 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_alpha_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_53c4cce8-1f08-48a6-82dc-a9e68679339b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "558dbdee-ce62-48d1-ba64-215a00c640aa", + "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" + }, + "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 + } + } + } + } + ] +} 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..51a56bd7 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_diff_width_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_2298a19e-9ab9-48c5-817c-bfc92f9fcb57", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "4dcc4a99-9578-427a-85fb-ed5a159244fa", + "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" + }, + "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 + } + } + } + } + ] +} 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..5e18fd84 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_different_alpha.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_7feab3c1-77d8-44ee-847b-6bc135f83afd", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "a0f2c390-2263-46c1-8213-f63086a86096", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_circles" + }, + { + "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" + }, + "source": "a0f2c390-2263-46c1-8213-f63086a86096", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "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" + }, + "source": "a0f2c390-2263-46c1-8213-f63086a86096", + "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_7feab3c1-77d8-44ee-847b-6bc135f83afd" + }, + "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_e61c0755-9257-4163-bc6a-8d97681d97d8" + }, + "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" + }, + "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 + } + } + } + } + ] +} 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..9db8f931 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_27440a3a-9749-477f-baa1-a59bf25a587b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "ef9e544a-b89f-418c-9475-ac97d6469a50", + "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" + }, + "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 + } + } + } + } + ] +} 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..491e4abe --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgb_colored_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_451c3ae1-bbde-492e-a48e-c8919e1c4972", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "3aa05c3b-b9ec-4156-a4af-3ab403b0b83f", + "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" + }, + "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 + } + } + } + } + ] +} 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..d064d3fb --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_render_with_rgba_colored_outline.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_9f1d9d30-4916-481e-917b-a4177a9034bf", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "35f177fe-75cc-4366-bbbc-2abedce1779e", + "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" + }, + "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 + } + } + } + } + ] +} 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..61dc9c37 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_circles.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_circles_db4cbdfa-99f2-4654-a459-2ad45e263d9b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "fd692690-3639-428d-8130-1eb1b0cc04ab", + "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" + }, + "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 + } + } + } + } + ] +} 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..a8ccdec2 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_multipolygons.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_multipolygons_5c7fb897-d409-4147-a5e5-db85d58f633b", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "3467fe2e-211e-4816-ba8a-18f00210423a", + "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" + }, + "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 + } + } + } + } + ] +} 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..59fa8255 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_can_transform_polygons.json @@ -0,0 +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": "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" + } + }, + { + "name": "blobs_polygons_56619734-61b3-406c-ba75-f86421c3a884", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "0f3d8b14-402e-4fd6-ba98-8d648889e5e8", + "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" + }, + "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 + } + } + } + } + ] +} 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..6c44c735 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_with_clip.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": "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" + } + }, + { + "name": "blobs_polygons_4011cbca-91cb-41e3-9eff-8198d16150f4", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "3aa41169-ccaa-465a-af73-187d381db9e1", + "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": "5bea0f25-73ea-4327-bca0-b1b025432b78" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.5", + "value": "#000000" + }, + { + "test": "datum.value) > 3.5", + "value": "#808080" + } + ] + } + } + } + ] +} 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..f116f740 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_norm_vmin_eq_vmax_without_clip.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": "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" + } + }, + { + "name": "blobs_polygons_e5579b05-056e-4acb-a502-82917b74e0a9", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "cf409518-211c-45ad-b851-1a2cd7271512", + "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": "fdc6722f-a0ef-4ca5-9426-66aacd70cdad" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 2.5", + "value": "#000000" + }, + { + "test": "datum.value) > 3.5", + "value": "#808080" + } + ] + } + } + } + ] +} 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..b388cd18 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_datashader_shades_with_linear_cmap.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": "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" + } + }, + { + "name": "blobs_polygons_1e5ce91b-ec0b-45ec-b53c-66798dbfad3d", + "format": { + "type": "ShapesFormatV02", + "version": "0.2" + }, + "source": "5cec467f-84c7-4858-9ae5-f88d2173c759", + "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": "1b754fd8-39a6-4d10-bc8d-0c301c654a7e" + } + ] + } + ], + "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" + }, + "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_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 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.value)", + "value": "#d3d3d3" + }, + { + "test": "datum.value) < 1.0", + "value": "#440154" + }, + { + "test": "datum.value) > 20.0", + "value": "#fde725" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Shapes_outline_alpha_takes_precedence.json b/tests/_figures_viewconfig/Shapes_outline_alpha_takes_precedence.json new file mode 100644 index 00000000..9bc87bb9 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_outline_alpha_takes_precedence.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1236ea96-10aa-4805-89a8-3a7f0d0d96a9", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_circles_f463d865-4661-42ea-98d8-8adda6a47a24", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "1236ea96-10aa-4805-89a8-3a7f0d0d96a9", + "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_f463d865-4661-42ea-98d8-8adda6a47a24" + }, + "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": "#ff6600" + }, + "strokeWidth": { + "value": 20 + }, + "strokeOpacity": { + "value": [1.0, 1.0] + } + } + } + } + ] +} 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..ba3e306d --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_shapes_categorical_color.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "64c9a803-1fc3-4933-a4b1-9f0fae9ecd2e", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_508038f7-a404-49ee-898c-49cd402b3fa4", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} 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..e9054224 --- /dev/null +++ b/tests/_figures_viewconfig/Shapes_shapes_coercable_categorical_color.json @@ -0,0 +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": "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" + } + }, + { + "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" + }, + "source": "5ecfba63-7cd2-4647-b734-ebf5b41606bf", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_polygons" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "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" + }, + "scaleX": 1.0, + "scaleY": 1.0, + "fill": { + "scale": "color_0a74c2ea-cc57-4b34-b7eb-ff6abe4fcad1", + "field": "category" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.category)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Show_pad_extent_adds_padding.json b/tests/_figures_viewconfig/Show_pad_extent_adds_padding.json new file mode 100644 index 00000000..afafbac6 --- /dev/null +++ b/tests/_figures_viewconfig/Show_pad_extent_adds_padding.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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "2b316027-3558-4574-9253-9f11ca51b572", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_image_05afc683-8dbf-4d71-89a6-5398a1ed61a7", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "2b316027-3558-4574-9253-9f11ca51b572", + "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": [-100.0, 612.0], + "range": "width" + }, + { + "name": "Y_scale", + "type": "linear", + "domain": [612.0, -100.0], + "range": "height" + }, + { + "name": "color_bc49ff42-2155-4bfc-9a3d-27e4f3f24f29", + "type": "linear", + "domain": { + "data": "blobs_image_05afc683-8dbf-4d71-89a6-5398a1ed61a7", + "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, 600], + "zindex": 1.5 + }, + { + "scale": "Y_scale", + "orient": "left", + "domain": true, + "domainOpacity": 1, + "domainColor": "#000000", + "domainWidth": 0.8888888888888888, + "grid": true, + "gridOpacity": 1.0, + "gridCap": "butt", + "gridColor": "#cccccc", + "gridWidth": 1.1111111111111112, + "labelColor": "#000000", + "labelOpacity": 1, + "labelFont": "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, 600], + "zindex": 1.5 + } + ], + "marks": [ + { + "type": "raster_image", + "from": { + "data": "blobs_image_05afc683-8dbf-4d71-89a6-5398a1ed61a7" + }, + "zindex": 0, + "encode": { + "enter": { + "opacity": { + "value": 1.0 + }, + "fill": [ + { + "scale": "color_bc49ff42-2155-4bfc-9a3d-27e4f3f24f29", + "value": "value" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Utils_can_set_zero_in_cmap_to_transparent.json b/tests/_figures_viewconfig/Utils_can_set_zero_in_cmap_to_transparent.json new file mode 100644 index 00000000..d7333cf6 --- /dev/null +++ b/tests/_figures_viewconfig/Utils_can_set_zero_in_cmap_to_transparent.json @@ -0,0 +1,445 @@ +{ + "$schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json", + "height": 320.0, + "width": 320.0, + "padding": { + "left": 57.599999999999994, + "top": 28.79999999999999, + "right": 12.800000000000011, + "bottom": 64.0 + }, + "data": [ + { + "name": "de6f4ee7-86e7-4282-a464-ea7b91bf5ec0", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "ae811167-5bee-46f6-a8c4-1b03a5009884", + "format": { + "type": "spatialdata_table", + "version": 0.1 + }, + "source": "de6f4ee7-86e7-4282-a464-ea7b91bf5ec0", + "transform": [ + { + "type": "filter_element", + "expr": "table" + } + ] + }, + { + "name": "blobs_labels_f0bd7196-2212-47ed-afbe-d4dab63db5c0", + "format": { + "type": "RasterFormatV03", + "version": "0.3" + }, + "source": "de6f4ee7-86e7-4282-a464-ea7b91bf5ec0", + "transform": [ + { + "type": "filter_element", + "expr": "blobs_labels" + }, + { + "type": "filter_cs", + "expr": "global" + }, + { + "type": "filter_scale", + "expr": "full" + }, + { + "type": "lookup", + "from": "ae811167-5bee-46f6-a8c4-1b03a5009884", + "key": "instance_id", + "fields": ["instance_ids"], + "values": ["my_var"], + "as": ["my_var"], + "default": null + } + ] + } + ], + "marks": [ + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 57.599999999999994 + }, + "y": { + "value": 85.67272727272723 + }, + "width": { + "value": 113.45454545454545 + }, + "height": { + "value": 113.4545454545455 + } + } + }, + "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" + }, + { + "name": "color_0cdd7483-4d9b-4c00-8dae-7dbd24aab925", + "type": "linear", + "domain": { + "data": "blobs_labels_f0bd7196-2212-47ed-afbe-d4dab63db5c0", + "field": ["my_var"] + }, + "range": { + "scheme": "viridis", + "count": 256 + } + } + ], + "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 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_f0bd7196-2212-47ed-afbe-d4dab63db5c0" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_0cdd7483-4d9b-4c00-8dae-7dbd24aab925", + "value": "my_var" + } + ], + "fill": [ + { + "scale": "color_0cdd7483-4d9b-4c00-8dae-7dbd24aab925", + "value": "my_var" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_0cdd7483-4d9b-4c00-8dae-7dbd24aab925", + "field": "my_var" + }, + { + "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": 93.57727272727273 + }, + "y": { + "value": 67.00606060606054 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + }, + { + "type": "group", + "encode": { + "enter": { + "x": { + "value": 193.74545454545455 + }, + "y": { + "value": 85.67272727272726 + }, + "width": { + "value": 113.45454545454544 + }, + "height": { + "value": 113.45454545454544 + } + } + }, + "scales": [ + { + "name": "X_scale_1", + "type": "linear", + "domain": [0.0, 512.0], + "range": "width" + }, + { + "name": "Y_scale_1", + "type": "linear", + "domain": [512.0, 0.0], + "range": "height" + }, + { + "name": "color_6eefc481-0785-424d-9c0b-0683b019c134", + "type": "linear", + "domain": { + "data": "blobs_labels_09530652-7d41-4db4-88dd-623e7901e7ff", + "field": ["my_var"] + }, + "range": {} + } + ], + "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 + } + ], + "marks": [ + { + "type": "raster_label", + "from": { + "data": "blobs_labels_09530652-7d41-4db4-88dd-623e7901e7ff" + }, + "zindex": 0, + "encode": { + "enter": { + "stroke": [ + { + "scale": "color_6eefc481-0785-424d-9c0b-0683b019c134", + "value": "my_var" + } + ], + "fill": [ + { + "scale": "color_6eefc481-0785-424d-9c0b-0683b019c134", + "value": "my_var" + } + ], + "fillOpacity": { + "value": 0.4 + }, + "strokeOpacity": { + "value": 0.0 + }, + "strokeWidth": { + "value": 3 + } + }, + "update": { + "fill": [ + { + "test": "isValid(datum.value)", + "scale": "color_6eefc481-0785-424d-9c0b-0683b019c134", + "field": "my_var" + }, + { + "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": 229.72272727272727 + }, + "y": { + "value": 67.0060606060606 + }, + "linebreak": { + "value": "\n" + } + } + }, + "zindex": 3 + } + ] + } + ] +} diff --git a/tests/_figures_viewconfig/Utils_colnames_that_are_valid_matplotlib_greyscale_colors_are_not_evaluated_as_colors.json b/tests/_figures_viewconfig/Utils_colnames_that_are_valid_matplotlib_greyscale_colors_are_not_evaluated_as_colors.json new file mode 100644 index 00000000..3c7125ee --- /dev/null +++ b/tests/_figures_viewconfig/Utils_colnames_that_are_valid_matplotlib_greyscale_colors_are_not_evaluated_as_colors.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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "1a41421e-51b8-4956-863b-db1587da47f6", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_polygons_63141571-dec5-4b13-b62b-8c85666d699c", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "1a41421e-51b8-4956-863b-db1587da47f6", + "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_ca281b3e-c33c-4219-a89f-dd7a7666be8d", + "type": "linear", + "domain": { + "data": "blobs_polygons_63141571-dec5-4b13-b62b-8c85666d699c", + "field": "1" + }, + "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_ca281b3e-c33c-4219-a89f-dd7a7666be8d", + "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_63141571-dec5-4b13-b62b-8c85666d699c" + }, + "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_ca281b3e-c33c-4219-a89f-dd7a7666be8d", + "value": "1" + }, + "fillOpacity": { + "value": 1.0 + } + }, + "update": { + "fill": [ + { + "test": "!isValid(datum.1)", + "value": "#d3d3d3" + } + ] + } + } + } + ] +} diff --git a/tests/_figures_viewconfig/Utils_set_outline_accepts_str_or_float_or_list_thereof.json b/tests/_figures_viewconfig/Utils_set_outline_accepts_str_or_float_or_list_thereof.json new file mode 100644 index 00000000..d8d75f47 --- /dev/null +++ b/tests/_figures_viewconfig/Utils_set_outline_accepts_str_or_float_or_list_thereof.json @@ -0,0 +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": "alphabetic", + "color": "black", + "font": "Arial", + "fontSize": 15.555555555555555, + "fontStyle": "normal", + "fontWeight": "normal" + }, + "data": [ + { + "name": "627ae5c9-3824-459c-b94c-216b53d2c380", + "url": "sdata.zarr", + "format": { + "type": "SpatialData", + "version": "0.4.1rc1.dev4+gb5239b43c" + } + }, + { + "name": "blobs_polygons_5fa7aab3-553b-4963-a00c-aefeabadc92a", + "format": { + "type": "ShapesFormatV03", + "version": "0.3" + }, + "source": "627ae5c9-3824-459c-b94c-216b53d2c380", + "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_5fa7aab3-553b-4963-a00c-aefeabadc92a" + }, + "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, 0.0] + } + } + } + } + ] +} 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 00000000..d1586573 Binary files /dev/null and b/tests/_images/Labels_can_plot_with_one_element_color_table.png differ diff --git a/tests/conftest.py b/tests/conftest.py index 896eaeb7..f38a0541 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +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 @@ -28,11 +32,14 @@ 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" +VIEWCONFIG_EXPECTED = HERE / "_figures_viewconfig" TOL = 15 DPI = 80 @@ -68,6 +75,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.""" @@ -396,6 +408,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(): @@ -418,12 +481,14 @@ 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: # 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 @@ -432,7 +497,39 @@ 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_blobs_shapes_annotated", + ] + 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_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 "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) + + # 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 + ) + self.compare(fig_name) if not callable(fn): diff --git a/tests/pl/test_get_extent.py b/tests/pl/test_get_extent.py index 9d9f1195..eb2db20c 100644 --- a/tests/pl/test_get_extent.py +++ b/tests/pl/test_get_extent.py @@ -50,9 +50,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]]] @@ -97,6 +98,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_images.py b/tests/pl/test_render_images.py index 5cba4e88..56e798cb 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): element="blobs_image", channel=0, norm=norm, cmap=_viridis_with_under_over() ).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.1, vmax=0.5, clip=False) sdata_blobs.pl.render_images( diff --git a/tests/pl/test_render_labels.py b/tests/pl/test_render_labels.py index 8184de0a..943053f5 100644 --- a/tests/pl/test_render_labels.py +++ b/tests/pl/test_render_labels.py @@ -133,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): @@ -144,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() @@ -183,7 +185,7 @@ def test_plot_label_colorbar_uses_alpha_of_less_transparent_outline( ): sdata_blobs.pl.render_labels("blobs_labels", color="channel_0_sum", fill_alpha=0.7, outline_alpha=0.1).pl.show() - def test_can_plot_with_one_element_color_table(self, sdata_blobs: SpatialData): + def test_plot_can_plot_with_one_element_color_table(self, sdata_blobs: SpatialData): table = sdata_blobs["table"].copy() table.obs["region"] = pd.Categorical(["blobs_multiscale_labels"] * table.n_obs) table.uns["spatialdata_attrs"]["region"] = "blobs_multiscale_labels" @@ -305,7 +307,7 @@ def test_warns_when_table_does_not_annotate_element(sdata_blobs: SpatialData): # Create a table that annotates a DIFFERENT element than the one we will render other_table = sdata_blobs_local["table"].copy() - other_table.obs["region"] = "blobs_multiscale_labels" + other_table.obs["region"] = pd.Categorical(["blobs_multiscale_labels"] * other_table.n_obs) other_table.uns["spatialdata_attrs"]["region"] = "blobs_multiscale_labels" sdata_blobs_local["other_table"] = other_table diff --git a/tests/pl/test_render_points.py b/tests/pl/test_render_points.py index 2a60f4c1..d0086784 100644 --- a/tests/pl/test_render_points.py +++ b/tests/pl/test_render_points.py @@ -231,6 +231,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, @@ -275,7 +276,7 @@ def test_plot_mpl_and_datashader_point_sizes_agree_after_altered_dpi(self, sdata 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( @@ -289,6 +290,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() @@ -473,7 +475,7 @@ def test_warns_when_table_does_not_annotate_element(sdata_blobs: SpatialData): # Create a table that annotates a DIFFERENT element than the one we will render other_table = sdata_blobs_local["table"].copy() - other_table.obs["region"] = "blobs_labels" # Different from blobs_points + other_table.obs["region"] = pd.Categorical(["blobs_labels"] * other_table.n_obs) # Different from blobs_points other_table.uns["spatialdata_attrs"]["region"] = "blobs_labels" sdata_blobs_local["other_table"] = other_table diff --git a/tests/pl/test_render_shapes.py b/tests/pl/test_render_shapes.py index 27924a71..450cec05 100644 --- a/tests/pl/test_render_shapes.py +++ b/tests/pl/test_render_shapes.py @@ -61,13 +61,10 @@ def test_plot_can_render_empty_geometry(self, sdata_blobs: SpatialData): sdata_blobs.shapes["blobs_circles"].at[0, "geometry"] = gpd.points_from_xy([None], [None])[0] sdata_blobs.pl.render_shapes().pl.show() - def test_plot_can_render_circles_with_default_outline_width(self, sdata_blobs: SpatialData): - sdata_blobs.pl.render_shapes(element="blobs_circles", outline_alpha=1).pl.show() - def test_plot_can_render_circles_with_specified_outline_width(self, sdata_blobs: SpatialData): sdata_blobs.pl.render_shapes(element="blobs_circles", 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))])] @@ -88,6 +85,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] @@ -100,6 +98,7 @@ def test_plot_can_color_from_geodataframe(self, sdata_blobs: SpatialData): blob["table"].obs["region"] = pd.Categorical(["blobs_polygons"] * blob["table"].n_obs) 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", @@ -162,6 +161,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): @@ -209,9 +209,11 @@ 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): + # TODO: discuss 2 color scales resulting in one legend -> array values for source? sdata_blobs["table"].obs["region"] = pd.Categorical(["blobs_circles"] * sdata_blobs["table"].n_obs) new_table = sdata_blobs["table"][:10].copy() new_table.uns["spatialdata_attrs"]["region"] = ["blobs_circles", "blobs_polygons"] @@ -255,6 +257,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() @@ -497,6 +500,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"] = pd.Categorical(["blobs_circles"] * table_shapes.n_obs) @@ -605,7 +609,7 @@ def test_warns_when_table_does_not_annotate_element(sdata_blobs: SpatialData): # Create a table that annotates a DIFFERENT element than the one we will render other_table = sdata_blobs_local["table"].copy() - other_table.obs["region"] = "blobs_points" # Different from blobs_circles + other_table.obs["region"] = pd.Categorical(["blobs_points"] * other_table.n_obs) # Different from blobs_circles other_table.uns["spatialdata_attrs"]["region"] = "blobs_points" sdata_blobs_local["other_table"] = other_table