Closed
Description
As per the title, I just ran into a case where datashader
was chosen as the method for render_points
, which led to my points being plotted without the relevant transformation being applied. I stole the example from #182 for testing below.
from spatialdata import SpatialData
from spatialdata.models import Image2DModel, PointsModel
from spatialdata.transformations import Scale
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import spatialdata_plot
sdata = SpatialData(
images={
"image1": Image2DModel.parse(
np.full((10, 10, 3), fill_value=128), dims=("y", "x", "c")
)
},
points={
"points1": PointsModel.parse(
pd.DataFrame({"y": [0.1, 0.1, 0.9, 0.9], "x": [0.1, 0.9, 0.9, 0.1]}),
transformations={"global": Scale([10, 10], ("y", "x"))},
)
},
)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))
sdata.pl.render_images("image1").pl.render_points("points1", method="datashader").pl.show(ax=ax1, title="datashader")
sdata.pl.render_images("image1").pl.render_points("points1", method="matplotlib").pl.show(ax=ax2, title="matplotlib")
With #309: