Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting of continuous values when norm=None #201

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning][].
- Now dropping index when plotting shapes after spatial query (#177)
- Points are now being correctly rotated (#198)
- User can now pass Colormap objects to the cmap argument in render_images. When only one cmap is given for 3 channels, it is now applied to each channel (#188, #194)
- Labels can now be colored by a continuous variable without setting `norm` (#201)

## [0.0.6] - 2023-11-06

Expand Down
4 changes: 3 additions & 1 deletion src/spatialdata_plot/pl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ def _prepare_cmap_norm(

cmap.set_bad("lightgray" if na_color is None else na_color)

if isinstance(norm, Normalize) or not norm:
if norm is None:
norm = Normalize(vmin=vmin, vmax=vmax)
elif isinstance(norm, Normalize) or not norm:
pass # TODO
elif vcenter is None:
norm = Normalize(vmin=vmin, vmax=vmax)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions tests/pl/test_render_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ def test_plot_can_stack_render_labels(self, sdata_blobs: SpatialData):
)
.pl.show()
)

def test_plot_can_color_labels_by_continuous_variable(self, sdata_blobs: SpatialData):
sdata_blobs.pl.render_labels("blobs_labels", color="channel_0_sum").pl.show()