Closed
Description
When plotting points and the points has a transformation additionally to the coordinates in the dataframe, the transformation is ignored.
This could be related to #171.
Example code
from spatialdata import SpatialData
from spatialdata.models import Image2DModel, PointsModel
from spatialdata.transformations import Scale
import numpy as np
import pandas as pd
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"))},
)
},
)
sdata.pl.render_images("image1").pl.render_points("points1").pl.show()
Workaround
Convert the coordinates in the dataframe to the global coordinate system (either overwriting, or storing under another key):
sdata.points["points1"] = sdata.transform_element_to_coordinate_system(
sdata.points["points1"], "global"
)
Now the points have transformation Identity()
for which it is no problem to be ignored.
Metadata
Metadata
Assignees
Labels
No labels