When method=datashader is used the colors that are produced are wrong. Strangely the colorbar is correct. Initially I though this was due to the choice of the agg function when each pixel of the rasterized image was overlapping multiple elements. But since this problem appears also for large bins, which span several pixels, and since no border effect is observed, I believe that the problem lies elsewhere.
Code to reproduce.
##importspatialdata_plotfromspatialdataimportread_zarr, bounding_box_queryimportmatplotlib.pyplotaspltf='spatialdata-sandbox/visium_hd_3.0.0_io/data.zarr'sdata=read_zarr(f)
sdatafortableinsdata.tables.values():
table.var_names_make_unique()
##crop=lambdax: bounding_box_query(
x, min_coordinate=[5000, 7000], max_coordinate=[10000, 12000], axes=("x", "y"), target_coordinate_system="global"
)
gene_name="AA986860"##crop(sdata).pl.render_shapes('Visium_HD_Mouse_Small_Intestine_square_016um', color=gene_name).pl.show(coordinate_systems='global')
plt.show()
##crop(sdata).pl.render_shapes('Visium_HD_Mouse_Small_Intestine_square_016um', color=gene_name, method='datashader').pl.show(coordinate_systems='global')
plt.show()
When
method=datashaderis used the colors that are produced are wrong. Strangely the colorbar is correct. Initially I though this was due to the choice of theaggfunction when each pixel of the rasterized image was overlapping multiple elements. But since this problem appears also for large bins, which span several pixels, and since no border effect is observed, I believe that the problem lies elsewhere.Code to reproduce.